Transaction report
Search your orders and download them as a CSV transaction report through the Paytrim API.
Use the search endpoint to find orders and download them as a CSV report, for example for your bookkeeping or reconciliation. Send a POST request to /v1/search/orders/ with a query. Add ?format=csv to get CSV instead of JSON.
curl "https://api.pay.paytrim.com/v1/search/orders/?format=csv" \
--user "$API_KEY:" \
--header "Content-Type: application/json" \
--data '{
"query": "*"
}' \
--output orders.csvThe query * returns all orders.
Request fields
| Field | Description |
|---|---|
query | Search query. * matches all orders. See Filter results. |
size | Number of results per page. |
start | Position of the first result, for simple paging. |
sort | Field and direction to sort on, for example created asc. |
search_after | Cursor for paging through large result sets. See Page through large results. |
Filter results
Filter on a field with field:value. Filter on a range with field:[from TO to].
| Goal | Query |
|---|---|
| All orders | * |
| Only completed orders | status:completed |
| Orders created on one day | created:[2026-09-01 TO 2026-09-01] |
curl "https://api.pay.paytrim.com/v1/search/orders/?format=csv" \
--user "$API_KEY:" \
--header "Content-Type: application/json" \
--data '{
"query": "status:completed"
}'Page, limit and sort
Use start and size to page through results, and sort to order them:
curl https://api.pay.paytrim.com/v1/search/orders/ \
--user "$API_KEY:" \
--header "Content-Type: application/json" \
--data '{
"query": "*",
"size": 100,
"start": 1,
"sort": "created asc"
}'Simple paging returns at most 10,000 results. For more, use search_after.
Page through large results
search_after works like a cursor, so you can page through more than 10,000 results.
Send the first request
Set search_after to "-1":
curl https://api.pay.paytrim.com/v1/search/orders/ \
--user "$API_KEY:" \
--header "Content-Type: application/json" \
--data '{
"query": "*",
"size": 100,
"search_after": "-1",
"sort": "created asc"
}'The response contains a sort value.
Request the next page
Send the same request with the sort value of the previous response in search_after:
curl https://api.pay.paytrim.com/v1/search/orders/ \
--user "$API_KEY:" \
--header "Content-Type: application/json" \
--data '{
"query": "*",
"size": 100,
"search_after": "1234566",
"sort": "created asc"
}'Repeat
Keep using the latest sort value until you have all the results you need.
Keep in mind:
- Use the same
sortin every request, so the results stay in order. - Use the same
sizein every request. - Use either
startorsearch_after, never both.
Report columns
Every row of the CSV report is one transaction, together with the fields of its order. The report has many columns; these are the most important ones:
| Column | Description |
|---|---|
id | Order ID. |
merchant_order_id | Your own order reference. |
created, completed | When the order was created and completed. |
currency, amount | Currency and amount of the order, in the smallest currency unit. |
status | Order status. |
transaction.id | Transaction ID. |
transaction.status | Transaction status. |
transaction.payment_method | Payment method, such as credit-card. |
transaction.payment_method_brand | Card brand, such as visa or mastercard. |
transaction.amount_with_decimals | Transaction amount in the main currency unit, such as 9.95. |
transaction.refund_of_transaction_id | For a refund: the ID of the original transaction. |
transaction.payment_method_details.truncated_pan | Masked card number. |
transaction.settlement_currency, transaction.settlement_amount | Currency and amount of the settlement. |
transaction.fee_currency, transaction.fee_amount | Currency and amount of the fee. |
customer.merchant_customer_id | Your own customer reference. |
merchant_id, project_id | Your merchant and project. |
A shortened example with a few of the columns:
id,merchant_order_id,created,currency,amount,status,transaction.id,transaction.payment_method,transaction.payment_method_brand,transaction.status,transaction.amount_with_decimals
8bb4c444-66ea-4eba-b7c8-fb7ae32bb4fe,EXAMPLE001,2026-10-09T10:43:13.905092+00:00,GBP,995,completed,e0b704ee-e0de-4aec-9e4c-dc597e54418d,credit-card,visa,accepted,9.95
21c22e76-8d87-4312-a8c0-544e8e9fc09d,EXAMPLE002,2026-10-09T10:46:56.076889+00:00,GBP,975,error,53d4a698-50e2-4325-b036-0cff44062b5b,credit-card,mastercard,declined,9.75