Skip to main content
GET
/
v1
/
transactions
/
{id}
Get Transaction
curl --request GET \
  --url https://api.moflay.com/v1/transactions/{id} \
  --header 'Authorization: Bearer <token>'
{
  "id": "trxn_ABC123DEF456GHI",
  "customerId": "cus_MNO345PQR678STU",
  "object": "transaction",
  "environment": "development",
  "type": "payment",
  "amount": 1000,
  "description": "Payment for Order #12345 - Premium Subscription",
  "currency": "KES",
  "status": "completed",
  "phoneNumber": "254712345678",
  "receiptNumber": "QMF7MBB5ED",
  "fee": 100,
  "netAmount": 900,
  "failureReason": null,
  "metadata": {},
  "source": "api",
  "processedAt": "2024-12-19T10:30:00.000Z",
  "createdAt": "2024-12-19T10:25:00.000Z",
  "paidAt": "2024-12-19T10:32:00.000Z",
  "failedAt": null
}

Authorizations

Authorization
string
header
required

The API key to use for authentication

Path Parameters

id
string
required

Unique identifier for the transaction, prefixed with 'trxn_'

Required string length: 4 - 255
Example:

"trxn_ABC123DEF456GHI"

Response

Get One Transaction

id
string
required

Unique identifier for the transaction, prefixed with 'trxn_'

Maximum length: 255
Example:

"trxn_YGZBY32PBBavYbhL"

customerId
string
required

Unique identifier for the customer, prefixed with 'cus_'.

Required string length: 4 - 255
Example:

"cus_GqfKXLmg61LURZhB"

object
string
required
Example:

"transaction"

environment
enum<string>
required

The environment of the customer. Either 'sandbox' or 'production' The environment of the transaction. Either 'sandbox' or 'production'

Available options:
sandbox,
production
Example:

"sandbox"

currency
string
required

The transaction currency

Example:

"KES"

amount
number
required

Transaction amount in cents (e.g., 1000 = KES 10.00)

Example:

1000

fee
number
required

The transaction fee

Example:

100

netAmount
number
required

The transaction net amount

Example:

900

description
string | null
required

Human-readable description of the transaction purpose

Example:

"Payment for Order #12345 - Premium Subscription"

phoneNumber
string
required

Safaricom phone number in local (e.g., 0712345678, 0110123456) or international (e.g., 254712345678, 254110123456) format, transformed to 254XXXXXXXXX for M-PESA STK Push. Only Safaricom numbers are supported.

Example:

"254712345678"

status
enum<string>
required

Current status of the transaction. Possible values: pending, completed, failed, refunded

Available options:
pending,
completed,
failed,
refunded
Example:

"completed"

receiptNumber
string | null
required

The M-Pesa receipt number

Maximum length: 50
Example:

"QMF7MBB5ED"

processedAt
string | null
required

Timestamp when the transaction was processed (ISO 8601 format)

Example:

"2024-12-19T10:30:00.000Z"

paidAt
string | null
required

Timestamp when the transaction was successfully paid (ISO 8601 format)

Example:

"2024-12-19T10:32:00.000Z"

failedAt
string | null
required

Timestamp when the transaction failed (ISO 8601 format)

Example:

"2024-12-19T10:33:00.000Z"

failureReason
string | null
required

The transaction decline reason

Example:

"Insufficient balance"

metadata
object
required

Key-value object allowing you to store additional information.

Key Requirements:

  • Must be a string
  • Maximum length of 40 characters

Value Types:

  • String (maximum 500 characters)
  • Integer
  • Floating-point number
  • Boolean

Limits:

  • Maximum of 50 key-value pairs
Example:
{
"user_preference": "dark_mode",
"last_login": 1640995200,
"is_premium": true,
"account_balance": 1250.75,
"notifications_enabled": false
}
createdAt
string
required

Timestamp when the transaction was created (ISO 8601 format)

Example:

"2024-12-19T10:25:00.000Z"

source
string | null
required

The source of the transaction. Either 'api' or 'dashboard'

Maximum length: 50
Example:

"api"

type
enum<string>
default:payment

The type of transaction

Available options:
payment,
donation
Example:

"payment"

I