Skip to main content
GET
/
v1
/
payments
/
{id}
Get payment
curl --request GET \
  --url https://api.moflay.com/v1/payments/{id} \
  --header 'Authorization: Bearer <token>'
{
  "id": "pay_ABC123DEF456GHI",
  "transactionId": "trxn_ABC123DEF456GHI",
  "customerId": "cus_GqfKXLmg61LURZhB",
  "merchantRequestId": "29115-34620561-1",
  "checkoutRequestId": "ws_CO_191220241030123456789",
  "status": "completed",
  "statusDetail": "The service request is processed successfully.",
  "failureReason": null,
  "amount": 1000,
  "currency": "KES",
  "description": "Premium plan",
  "accountReference": "ORDER123",
  "receiptNumber": "QMF7MBB5ED",
  "environment": "sandbox",
  "createdAt": "2024-12-19T10:25:00.000Z",
  "updatedAt": "2024-12-19T10:32:00.000Z",
  "processedAt": "2024-12-19T10:32:00.000Z",
  "completedAt": "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

Payment lookup identifier. Use a paymentId prefixed with 'pay_' or the related transactionId prefixed with 'trxn_'.

Example:

"pay_ABC123DEF456GHI"

Response

Payment Status

Payment Status

id
string
required

Unique identifier for the payment, prefixed with 'pay_'

Example:

"pay_ABC123DEF456GHI"

transactionId
string
required

Unique identifier for the related transaction, prefixed with 'trxn_'

Example:

"trxn_ABC123DEF456GHI"

customerId
string | null
required

Unique identifier for the customer attached to the payment, prefixed with 'cus_'

Example:

"cus_GqfKXLmg61LURZhB"

merchantRequestId
string | null
required

M-Pesa MerchantRequestID returned by Safaricom

Example:

"29115-34620561-1"

checkoutRequestId
string | null
required

M-Pesa CheckoutRequestID used to reconcile the STK push

Example:

"ws_CO_191220241030123456789"

status
enum<string>
required

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

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

"completed"

statusDetail
string | null
required

Provider detail explaining the current payment status, when available

Example:

"The service request is processed successfully."

failureReason
string | null
required

Developer-readable explanation when the payment failed, was canceled, or moved to an unknown state. Null for successful or in-progress payments.

Example:

"The customer cancelled the STK prompt."

amount
number
required

Payment amount in the smallest currency unit

Example:

1000

currency
string
required

Three-letter ISO currency code for the payment

Example:

"KES"

description
string
required

Short customer-facing payment description

Example:

"Premium plan"

accountReference
string
required

Short alphanumeric reference that was sent to M-Pesa and stored with this payment, such as an order or invoice number.

Example:

"ORDER123"

receiptNumber
string | null
required

M-Pesa receipt number for a completed payment

Example:

"QMF7MBB5ED"

environment
enum<string>
required

Environment where the payment was created. Either 'sandbox' or 'production'

Available options:
sandbox,
production
Example:

"sandbox"

createdAt
string<date-time>
required

Timestamp when the payment was created (ISO 8601 format)

Example:

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

updatedAt
string<date-time>
required

Timestamp when the payment was last updated (ISO 8601 format)

Example:

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

processedAt
string<date-time> | null
required

Timestamp when the payment reached a terminal completed, failed, canceled, or unknown state (ISO 8601 format)

Example:

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

completedAt
string<date-time> | null
required

Timestamp when the payment completed successfully (ISO 8601 format)

Example:

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

failedAt
string<date-time> | null
required

Timestamp when the payment failed (ISO 8601 format)

Example:

null

unknownAt
string<date-time> | null
required

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

Example:

null