m2pfintech
API LibraryTransaction

Fetch Forex Transactions V2 (Cursor-Based Pagination)

Retrieves forex card transaction history including AuthNT failure transactions using cursor-based pagination. Unlike the V1 endpoint (/v1/transactions/fetch/forexAll) which uses pageNo/pageSize offset pagination, this endpoint returns a toDate cursor timestamp that must be passed in the next request's toDate filter to continue fetching older transactions.

Key Differences from V1 (/v1/transactions/fetch/forexAll)

FeatureV1V2
PaginationOffset (pageNo + pageSize)Cursor (toDate in response → next request's toDate filter)
AuthNT failuresNoYes — merged into ledger results
Response wrapperM2PResponse with result + paginationFlat transactions, toDate, currentSize
Page size controlRequest body pageSizepageSize query parameter (default: 10)

Cursor Pagination Flow

  1. Send first request without a toDate filter (or with your desired fromDate).
  2. The response contains toDate — the timestamp of the last transaction in this batch.
  3. Pass this toDate value as the toDate filter in your next request to fetch the preceding page.
  4. Repeat until currentSize is 0 or fewer than pageSize (no more transactions).

AuthNT Failure Merging

This endpoint also fetches failed authorization (AuthNT) transactions and merges them with ledger results. Failures not already present in the ledger are appended to give a complete view of all attempted transactions, including declined ones.

POST
/v2/transactions/fetch

Authorization

bearerAuth tenantId
AuthorizationBearer <token>

JWT Bearer token from the Authentication API

In: header

X-TENANT-ID<token>

Your unique tenant identifier assigned during onboarding

In: header

Query Parameters

pageSize?integer

Number of transactions per page. Use toDate from the previous response to fetch the next page.

Default10

Request Body

application/json

entityId*string

Required. Cardholder's entity identifier

Length1 <= length
mobile?

Filter by mobile number (optional)

kit?string

Filter by card kit number (optional)

fromDate?string

Start date (inclusive). Format: dd-mm-yyyy

toDate?string

End date (inclusive). Format: dd-mm-yyyy

accountId?string

Filter by specific wallet/account ID (optional)

success?boolean

Set to true to return only successful transactions

isOffline?boolean

Set to true to include offline transactions

isDataMart?boolean

Note: serialized as isDataMart in JSON due to boolean getter naming convention.

filters?

Optional list of additional filter criteria

transactionTypes?array<string>

Optional list of transaction type strings to filter on

Response Body

application/json

application/json

application/json

curl -X POST "https://sandbox-api.m2pprepaid.com/prepaid/customer/v2/transactions/fetch" \  -H "Content-Type: application/json" \  -d '{    "entityId": "476843769320000001160925"  }'
{
  "transactions": [
    {
      "parentTxn": {
        "amount": "-500.00",
        "transactionType": "ECOM",
        "transactionStatus": "SUCCESS",
        "exchangeRate": 83.5,
        "transactionCurrencyCode": "840",
        "transactionCurrencyCodeName": "USD"
      },
      "childTxnCount": 1,
      "childTxns": [
        {
          "amount": "-500.00",
          "transactionType": "ECOM",
          "transactionStatus": "SUCCESS"
        }
      ]
    },
    {
      "parentTxn": {
        "amount": "-200.00",
        "transactionType": "ATM",
        "transactionStatus": "FAILURE"
      },
      "childTxnCount": 0,
      "childTxns": []
    }
  ],
  "toDate": "2025-04-15T10:25:00.000Z",
  "currentSize": 2
}
{
  "type": "https://www.m2pfintech.com/problem/problem-with-message",
  "title": "Bad Request",
  "status": 400,
  "detail": "Unable to convert http message",
  "message": "error.http.400"
}

{
  "type": "https://www.m2pfintech.com/problem/problem-with-message",
  "title": "Customer does not exist",
  "status": 409,
  "detail": "Customer does not exists for id",
  "message": "error.business",
  "businessCode": "PPCUST_002"
}