Skip to content

Commit 9b1ad02

Browse files
committed
Documentation 3.0 - Retrieving payments
1 parent dbf3fb5 commit 9b1ad02

File tree

4 files changed

+63
-47
lines changed

4 files changed

+63
-47
lines changed

doc/get-payment.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

doc/get-payments.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

doc/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828

2929
[Creating payment](create-payment.md)
3030

31-
[Preauth payment](preauth-payments.md)
32-
33-
[Get Information about payment](get-payment.md)
31+
[Retrieving payments](retrieve-payments.md)
3432

35-
[Get payments](get-payments.md)
33+
[Preauth payment](preauth-payments.md)
3634

3735
[Payment events](payment-events.md)
3836

doc/retrieve-payments.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Retrieving payments
2+
3+
Use these methods to retrieve payment details from ThePay API — either a single payment by UID or multiple payments using filters and pagination.
4+
5+
## Get a Single Payment
6+
7+
To retrieve information about a single payment, call:
8+
9+
```php
10+
$payment = $thePayClient->getPayment('49096fe3-872d-3cbe-b908-2806ae2d7c79');
11+
```
12+
13+
**Parameters:**
14+
- string `$uid` — Unique identifier (UID) of the payment.
15+
16+
The payment must belong to the project configured in TheConfig.
17+
18+
**Returns:**
19+
20+
An object describing the payment.
21+
22+
## Get Multiple Payments
23+
24+
To retrieve multiple payments, you can use filters and pagination:
25+
26+
```php
27+
/** @var \ThePay\ApiClient\TheClient $thePayClient */
28+
$filters = new \ThePay\ApiClient\Filter\PaymentsFilter();
29+
$paymentPaginatedCollection = $thePayClient->getPayments($filters);
30+
```
31+
32+
**Parameters:**
33+
- `$filters` — An instance of `\ThePay\ApiClient\Filter\PaymentsFilter()`. (See online API documentation for all available filter options.)
34+
- `$page` *(optional)* — Page number.
35+
- `$limit` *(optional)* — Number of records per page.
36+
37+
**Returns:**
38+
39+
A `PaymentCollection` object containing:
40+
- A collection of payments
41+
- Current page number
42+
- Number of records per page
43+
- Includes helper methods such as `hasNextPage()` and `getPage()`
44+
45+
**Example: Iterate through all pages**
46+
47+
```php
48+
/** @var \ThePay\ApiClient\TheClient $thePayClient */
49+
$filters = new \ThePay\ApiClient\Filter\PaymentsFilter();
50+
$page = 1;
51+
52+
do {
53+
$collection = $thePayClient->getPayments($filters, $page);
54+
55+
foreach ($collection->all() as $payment) {
56+
// print logic
57+
}
58+
59+
$page = $collection->getPage() + 1;
60+
} while($collection->hasNextPage());
61+
```

0 commit comments

Comments
 (0)