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": "sandbox",
  "type": "payment",
  "amount": 1000,
  "description": "Payment for Order #12345 - Premium Subscription",
  "currency": "KES",
  "status": "completed",
  "phoneNumber": "254712345678",
  "receiptNumber": "QMF7MBB5ED",
  "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,
  "unknownAt": null
}

Documentation Index

Fetch the complete documentation index at: https://docs.moflay.com/llms.txt

Use this file to discover all available pages before exploring further.

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

Get One Transaction

id
string
required

Unique identifier for the transaction, prefixed with 'trxn_'

Maximum string length: 255
Example:

"trxn_YGZBY32PBBavYbhL"

customerId
string | null
required

Unique identifier for the customer, prefixed with 'cus_'

Maximum string length: 255
Example:

"cus_GqfKXLmg61LURZhB"

object
string
required
Example:

"transaction"

environment
enum<string>
required

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

description
string
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. Supports all Safaricom prefixes (070X, 074X, 0757–0759, 0768–0769, 079X, 0110–0117).

Example:

"254712345678"

status
enum<string>
required

Current status. Possible values: initiating, pending, completed, failed, canceled, unknown

Available options:
initiating,
pending,
completed,
failed,
canceled,
unknown
Example:

"completed"

type
enum<string>
required

The type of transaction

Available options:
payment
Example:

"payment"

receiptNumber
string | null
required

The M-Pesa receipt number

Maximum string 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"

unknownAt
string | null
required

Timestamp when the transaction moved to an unknown state (ISO 8601 format)

Example:

"2024-12-19T10:40: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
enum<string>
required

The source of the resource. Either 'api', 'dashboard', or 'checkout'

Available options:
api,
dashboard,
checkout
Example:

"api"