Use this method to fetch a single transaction by its ID, including its stage breakdown. Call it after a payment flow completes (for example, whenDocumentation Index
Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
Use this file to discover all available pages before exploring further.
client.setupApplePay(), client.setupGooglePay(), or client.setupBuy() emits complete) to poll for the final transaction status.
For request and response details, see the Get a transaction API.
Get a transaction
Parameters
client.getTransaction() takes a single positional argument.
| Argument | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | The MoonPay ID of the transaction. |
Result
client.getTransaction() returns a Result<{ data: TransactionWithStages }, GetTransactionsError>.
Result envelope
Result<{ data: TransactionWithStages }, GetTransactionsError>
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | ✅ | Whether the operation succeeded. |
value | { data: TransactionWithStages } | Present when ok is true. | |
error | GetTransactionsError | Present when ok is false. |
TransactionWithStages
A transaction with its stage breakdown. See the Transaction object for every field, and the Get a transaction API for the response shape.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | The MoonPay ID of the transaction. |
status | TransactionStatus | ✅ | The current transaction status. See the Transaction object for the full list of statuses. |
source | object | ✅ | The source amount and asset (fiat currency). |
destination | object | ✅ | The destination amount and asset (cryptocurrency). |
createdAt | string | ✅ | An ISO 8601 timestamp of when the transaction was created. |
stages | Stage[] | ✅ | The transaction’s pipeline stages, each with a kind and status. |
GetTransactionsError
GetTransactionsError is the standard MoonPay Platform API error shape, DevPlatformApiError.
| Field | Type | Required | Description |
|---|---|---|---|
code | DevPlatformApiErrorCode | ✅ | A machine-readable error code (for example, "not_found", "unauthorized"). See the error reference for the full list. |
message | string | ✅ | A developer-friendly message. |
errors | DevPlatformApiErrorDetail[] | Optional list of field-level errors. |
Example: poll until terminal status
After a payment flow emitscomplete, poll client.getTransaction() until the transaction reaches a terminal status. The set of terminal statuses depends on the flow — check the Transaction object reference for the values that apply.
Poll for final status
Webhook support is coming soon. Until then, use polling to track transaction
status.