Pagination

When interacting with FlexPay's API to retrieve transaction data, it's common to encounter a substantial number of items. By default, FlexPay returns 20 items per request, but you can specify a higher count using the count parameter, with 100 being the maximum allowable in a single call. To efficiently navigate through this data, FlexPay employs pagination, which is accomplished through the usage of a continuation token.

  1. Initial request

Begin the initial request without a token, providing a start date as shown in the example below:

https://api.flexpay.io/v1/transactions?count=100&responseType=simplified&startDate=2023-11-8

The response will include up to 100 transactions (possibly fewer). Examine the details of the last transaction returned, as this information is crucial for the next requests.

...,
{
    "transactionId": "06624FYXD80000F1002EHGHJG6TZ4",
    "transactionDate": "2023-11-30T22:01:00.01Z",
    "transactionStatus": 2,
    "message": "The card has been declined due to insufficient funds.",
    "transactionType": "Charge",
    "retryDate": "2023-12-01T21:00:00Z",
    "amount": 75,
    "initialMerchantTransactionId": "11/07/2023 14:44:45",
    "paymentMethodStorageState": "Stored",
    "completionStatus": null
}]}
  1. Subsequent requests

For subsequent requests, use the continuation token instead of a date range. In FlexPay, this is the TransactionId field. Extract the value from the last transaction returned in the previous call. From the response illustrated above, you would take 06624FYXD80000F1002EHGHJG6TZ4 and use it on the next call as the sinceTransactionId parameter. Something like this:

https://api.flexpay.io/v1/transactions?count=100responseType=simplified&sinceTransactionId=06624FYXD80000F1002EHGHJG6TZ4

The response will include all transactions that occurred after the specified ID, ensuring you stay up-to-date and don't miss any data between calls. Continue sending requests until you receive an empty list.

By following this approach, you can effectively manage and retrieve transaction data in a systematic and up-to-date manner.

πŸ“˜

Note

Regardless of whether you invoke our List endpoint every hour or once a day, it's important to consistently retain the continuation token for your subsequent calls.

For more details on how to build your request, please see our List