PayAgency Logo
Transactions

Transactions API

This document provides a comprehensive guide to fetch your transaction data from Pay Agency's API. The API allows you to retrieve both live and test transaction data.

API Endpoints

GET https://backend.pay.agency/api/v1/live-transactions

Authentication

All API requests require authentication using your secret key in the Authorization header.

Authorization: Bearer YOUR_SECRET_KEY

Query Parameters

The API supports the following query parameters to filter and paginate transaction data:

ParameterTypeDescriptionRequired
transaction_start_dateStringStart date for filtering transactions (YYYY-MM-DD format)No
transaction_end_dateStringEnd date for filtering transactions (YYYY-MM-DD format)No
nextCursorStringCursor for next page of resultsNo
prevCursorStringCursor for previous page of resultsNo

Example Request

curl --location 'https://backend.pay.agency/api/v1/live-transactions?transaction_start_date=2023-05-01&transaction_end_date=2023-05-15' \
--header 'Authorization: Bearer YOUR_SECRET_KEY'

Response Structure

The API response contains transaction data along with metadata for pagination.

{
  "message": "Transactions fetched successfully",
  "data": [ ... array of transaction objects ... ],
  "meta": {
    "hasNextPage": true,
    "hasPreviousPage": false,
    "nextCursor": "NTQ1",
    "prevCursor": "NTY0",
    "totalCount": 144
  }
}

Transaction Object Properties

Each transaction object in the response contains the following properties:

PropertyTypeDescription
first_nameStringFirst name of the customer
last_nameStringLast name of the customer
converted_amountStringTransaction amount converted to display currency
converted_currencyStringCurrency code for the converted amount
transaction_idStringUnique identifier for the transaction
amountStringOriginal transaction amount
currencyStringOriginal currency code
statusStringStatus of the transaction (SUCCESS, FAILED, etc.)
card_typeStringType of card used (VISA, MASTERCARD, etc.)
card_numberStringMasked card number
transaction_typeStringType of transaction (CARD, APM, etc.)
order_idStringUnique order ID (if provided)
countryStringCountry code of the transaction origin
emailStringCustomer email address
created_atStringTransaction creation timestamp
transaction_dateStringTransaction processing timestamp
chargeback_dateStringChargeback date (if applicable)
refund_dateStringRefund date (if applicable)
suspicious_dateStringDate when transaction was marked suspicious (if any)
merchant_connectorObjectInformation about the payment processor
userObjectMerchant user information

Example Response

{
  "message": "Transactions fetched successfully",
  "data": [
    {
      "first_name": "James",
      "last_name": "Karlo",
      "converted_amount": "200",
      "converted_currency": "USD",
      "transaction_id": "PA3060287394219373",
      "amount": "200",
      "currency": "USD",
      "status": "SUCCESS",
      "card_type": null,
      "card_number": null,
      "transaction_type": "APM",
      "order_id": null,
      "country": "IN",
      "email": "james.karlo@gmail.com",
      "created_at": "2025-05-13T10:03:22.878Z",
      "transaction_date": "2025-05-13T10:03:22.886Z",
      "chargeback_date": null,
      "refund_date": null,
      "suspicious_date": null,
      "merchant_connector": {
        "name": "test MID"
      },
      "user": {
        "name": "James dean",
        "user_kyc": {
          "name": "James dean"
        }
      }
    },
     // ...more transactions...
  ],
  "meta": {
    "hasNextPage": true,
    "hasPreviousPage": false,
    "nextCursor": "NTQ1",
    "prevCursor": "NTY0",
    "totalCount": 144
  }
}

Pagination

The API response includes pagination metadata that can be used to fetch additional pages of transaction data:

  • hasNextPage: Boolean indicating if there are more transactions available after this page
  • hasPreviousPage: Boolean indicating if there are transactions available before this page
  • nextCursor: Cursor string to fetch the next page of results (use with nextCursor parameter)
  • prevCursor: Cursor string to fetch the previous page of results (use with prevCursor parameter)
  • totalCount: Total number of transactions matching the current filter criteria

Example: Fetching the Next Page

const nextPageUrl = 'https://backend.pay.agency/api/v1/live-transactions?nextCursor=NTQ1';
 
fetch(nextPageUrl, {
  headers: {
    'Authorization': 'Bearer YOUR_SECRET_KEY'
  }
})
.then(response => response.json())
.then(data => console.log(data));

Error Responses

The API may return the following error responses:

{
  "message": "Authentication token is missing or invalid."
}
{
  "message": "Authentication Secret Key is missing."
}
{
  "message": "Invalid Live Secret Key."
}

On this page