List All Transactions
Returns a paginated list of transactions objects related to the current authenticated account. The list is sorted, with the most recent transactions appearing first by default.
Parameters
Filter and Sort Transactions
| Parameter | Type | Description |
|---|---|---|
sort_field | enum optional | Field you want to sort by. Accepted values: status (integer), paid_at (string), amount (integer), created_at (string). |
sort_order | string optional | Sorting order, can either be asc or desc. |
limit | integer optional | Limit query result (when working with pagination). |
filters | array optional | An array of filter criteria where each entry has the following keys: |
filters[].field | enum | Field you want to filter by. Accepted values: status (integer), paid_at (string), amount (integer), created_at (string/timestamp). |
filters[].value | string | The value to compare by. |
filters[].operator | string | Comparison operator (=: default, !=, >, <, =>, <=, is, is_not, in). |
Returns
Returns a paginated collection of transactions objects. If no transactions are found, returns an empty collection.
Request
Endpoint: https://api.youcanpay.com/transactionsMethod: GET
bash
$ curl --location -g --request GET 'https://api.youcanpay.com/transactions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'Request with Filters
bash
$ curl --location -g --request GET 'https://api.youcanpay.com/transactions?sort_field=amount&sort_order=asc&filters[0][field]=amount&filters[0][value]=10000' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'Response
json
{
"data": [
{
"object": "transaction",
"id": "10e7691c-14a2-4936-833b-ec154c817ce9",
"created_at": 1706515890,
"paid_at": 1706515899,
"status": 1,
"status_text": "paid",
"customer": "38678dea-d23a-4388-bb78-648892bce85b",
"order_id": "inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e",
"payment_method": {
"type": "credit_card",
"id": "0fd9bb2c-f14b-411c-bc90-deb73ddaf9ff"
},
"amount": {
"amount": "10000",
"currency": "MAD",
"localized": "MAD 100.00"
},
"fees": {
"amount": "690",
"currency": "MAD",
"localized": "MAD 6.90"
},
"metadata": {
"type": "youcan_pay.invoice"
},
"customer_ip": "192.168.65.1"
},
{...}
],
"meta": {
"pagination": {
"total": 6,
"count": 6,
"per_page": 10,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}