Skip to main content

Data Models

Every resource in the Payrail API returns a consistent object structure. Use these definitions as a reference when building your integration.


Customer object

{
"_id": "69b5330a4314418540e8676e",
"name": "John Doe",
"email": "john@example.com",
"phone": "555-1234",
"createdAt": "2026-03-14T10:06:02.079Z"
}
FieldTypeDescription
_idstringUnique identifier for the customer
namestringCustomer's full name
emailstringCustomer's email address. Must be unique.
phonestringCustomer's phone number
createdAtstringISO 8601 timestamp of when the customer was created

Note: Password fields are never returned in any customer response.


Payment Method object

{
"_id": "69b53559c707c55a4e351409",
"customer": "69b5330a4314418540e8676e",
"type": "card",
"last4": "4242",
"expiryDate": "12/28",
"isDefault": true,
"createdAt": "2026-03-14T10:15:53.050Z"
}
FieldTypeDescription
_idstringUnique identifier for the payment method
customerstringID of the customer this payment method belongs to
typestringPayment type — card or bank_account
last4stringLast 4 digits of the card or account. Display purposes only — full card numbers are never stored.
expiryDatestringCard expiry date in MM/YY format
isDefaultbooleanWhether this is the customer's default payment method
createdAtstringISO 8601 timestamp of when the payment method was added

Transaction object

{
"_id": "69b536d0bcfe7db4d09c1403",
"customer": "69b5330a4314418540e8676e",
"paymentMethod": "69b53559c707c55a4e351409",
"amount": 15000,
"currency": "USD",
"status": "completed",
"description": "Payment for services",
"createdAt": "2026-03-14T10:22:08.804Z"
}
FieldTypeDescription
_idstringUnique identifier for the transaction
customerstringID of the customer being charged
paymentMethodstringID of the payment method used
amountintegerAmount in minor units (e.g. 15000 = $150.00)
currencystring3-letter ISO 4217 currency code
statusstringTransaction status — pending, completed, failed, or refunded
descriptionstringDescription of the transaction
createdAtstringISO 8601 timestamp of when the transaction was created

Refund object

{
"_id": "69b537548386681aea83bfd2",
"customer": "69b5330a4314418540e8676e",
"transaction": "69b536d0bcfe7db4d09c1403",
"amount": 15000,
"reason": "Customer requested refund",
"status": "pending",
"createdAt": "2026-03-14T10:24:20.638Z"
}
FieldTypeDescription
_idstringUnique identifier for the refund
customerstringID of the customer receiving the refund
transactionstringID of the transaction being refunded
amountintegerRefund amount in minor units (e.g. 15000 = $150.00)
reasonstringReason for the refund
statusstringRefund status — pending, processed, or rejected
createdAtstringISO 8601 timestamp of when the refund was created