Transactions
Transactions provide essential information on individual payment activities, such as successful payments, refunds, failed attempts, and cancelled transactions. Each transaction includes detailed data on the payment’s origin, method, customer, and status, making it a powerful tool for tracking and managing financial activity within Modem Pay.
Transaction Attributes
Every transaction contains the following key attributes:
-
Basic Details
id
: Unique identifier for the transaction.payment_intent_id
: ID of the associated payment intent.amount
: Total transaction amount.currency
: Currency in which the transaction was processed.status
: Indicates transaction status; options arepending
,completed
,failed
,refunded
, andcancelled
.type
: Type of transaction, such aspayment
,subscription
, orinvoice
.transaction_reference
: Unique identifier for tracking the transaction.
-
Payment and Customer Information
payment_account
: Account used for processing.payment_method
: Method used by the customer.customer_name
,customer_phone
,customer_email
: Basic contact details for the customer.account_id
: ID of the account processing the transaction.business_id
: Associated business ID for the transaction.
-
Timestamps and Metadata
createdAt
andupdatedAt
: Creation and last update timestamps.custom_fields_values
: Additional information collected for the transaction.metadata
: Any developer-provided metadata.- Associated Objects
PaymentGateway
: The gateway used for processing.Customer
: Associated customer object, if available.
Retrieve a Transaction
Use retrieve
to get the complete details of a specific transaction by its ID. This is useful for checking the outcome, reviewing customer details, or troubleshooting any issues tied to a specific transaction.
List All Transactions
The list
function returns all transactions, helping you monitor overall payment activity. This method is ideal for generating reports, reconciling payments, and tracking transaction volume over a given period.
Additional pagination options let you control the number of transactions returned and navigate larger datasets.
List All Transactions with Filtering Options
This flexibility is especially useful for generating tailored reports, narrowing down search results, or reviewing specific timeframes.
List Options
The TransactionListOption
allows the following filtering and pagination options:
limit
(optional): Specifies the maximum number of transactions to return in a single call, enabling pagination of results.search
(optional): A search term that filters results based on:- Currency: Matches transactions processed in the specified currency.
- Reference: Filters by transaction reference for easy tracking.
- Payment Method: Filters by the payment method used, such as credit card or bank transfer.
- Customer: Filters based on customer details.
timeframe
(optional): Defines a duration in minutes to limit transactions to those created within the specified timeframe. This is helpful for retrieving recent activity or analyzing transactions over short intervals.
Example Usage
This example would retrieve up to 20 transactions processed in GMD over the past 24 hours.