> ## Documentation Index
> Fetch the complete documentation index at: https://exchanger-api.iexexchanger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept payment for an order

> Get payment instructions, record the customer's payment report, and verify provider confirmation. Includes HTTP examples, statuses, and receipt upload.

Once you create an order, get the payment details or checkout link. After the customer pays, record their report and check separately whether the provider confirmed receipt of funds.

Use an API key issued to the order owner. Replace `order-1042` with your order's `tracking_id` or `public_id` and `https://your-exchange` with the exchanger's origin. The `request.mjs` script is in the [quickstart](https://exchanger-api.iexexchanger.com/en/start/quickstart.md). For the HTTP example, calculate an [HMAC v2 signature](https://exchanger-api.iexexchanger.com/en/start/authentication.md).

## 1. Get payment instructions

Reading instructions requires `public-api:exchange:payment-instructions:read`. [Operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/exchange/get-private-exchange-orders-by-order-payment-instructions.md)

```http Request with signature placeholders theme={null}
GET /api/v3/private/exchange/orders/order-1042/payment-instructions HTTP/1.1
Host: your-exchange
Accept: application/json
Authorization: Bearer <token>
X-Api-Signature-Version: v2
X-Api-Timestamp: <timestamp>
X-Api-Nonce: <nonce>
X-Api-Signature: sha256=<hex>
```

GET reads the current payment details without creating a provider invoice. In this example, the details are ready. The excerpt shows fields from `result.payment_instructions`. Read and preparation responses include the `private` and `no-store` directives in `Cache-Control`.

```json 200 OK · response excerpt theme={null}
{
  "status": "ready",
  "mode": "requisites",
  "payment_expires_at": "2026-12-05T09:10:00Z",
  "amount": "100.50",
  "currency": "USD",
  "network": null,
  "details": {
    "account": "fixture-account-001",
    "memo": null,
    "bank": null,
    "fields": []
  }
}
```

| State | What to do |
| - | - |
| `ready` | For `requisites`, show `details.account` and any additional payment details. For `checkout`, open `details.checkout_url`. Show the amount as a decimal string, along with the currency, network, and payment deadline when provided. |
| `not_prepared` | Request preparation of payment details. |
| `awaiting_operator` | Start preparation if you have yet to request it. Repeat the GET until the operator issues the details. |
| `pending` | Wait, then read the instructions again. |
| `verification_required` | Get the requirements with `GET /api/v3/private/exchange/orders/{order}/verifications` and wait for verification. Either `public-api:verifications:read` or `public-api:orders:detail:read` permits the read. |
| `expired` or `unavailable` | Remove the payment details and refresh the order. |

### Start preparation when available

Check `allowed_actions.prepare_payment` with `GET /api/v3/private/exchange/orders/{order}/actions`. Before sending the request, check for `allowed: true` and `authorized: true`. Preparation requires `public-api:exchange:payment-instructions:write`. [Operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/exchange/post-private-exchange-orders-by-order-payment-instructions.md)

```bash Prepare with an empty body theme={null}
node request.mjs POST '/api/v3/private/exchange/orders/order-1042/payment-instructions' \
  --idempotency-key 'payment-instructions-order-1042'
```

The preparation response contains `details: null` even when it returns `status: "ready"`. Send another GET for the payment details. If you receive `503` with `Retry-After`, wait for the indicated interval. Reuse the key and sign the retry again. [Retry rules](https://exchanger-api.iexexchanger.com/en/guides/reliability/idempotency.md)

## Attach a receipt if the route accepts it

Attach a new receipt before confirming payment. The order must still be in `pending_payment` and the route's `result.capabilities.files.receipts_allowed` must be `true`. An archived order or an expired applicable deadline blocks a new upload.

Send one file in the multipart `file` field with the `public-api:files:write` scope. Sign the SHA-256 digest of the file contents. Include an `Idempotency-Key` for safe retries. [Operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/files/post-private-exchange-orders-by-order-receipts.md)

```bash Node.js theme={null}
node request.mjs POST '/api/v3/private/exchange/orders/order-1042/receipts' \
  --file receipt.pdf --file-type application/pdf --idempotency-key 'receipt-order-1042'
```

```bash cURL theme={null}
curl --request POST 'https://your-exchange/api/v3/private/exchange/orders/order-1042/receipts' \
  --header 'Accept: application/json' \
  --header "Authorization: Bearer $EXCHANGER_API_TOKEN" \
  --header 'X-Api-Signature-Version: v2' \
  --header "X-Api-Timestamp: $TIMESTAMP" \
  --header "X-Api-Nonce: $NONCE" \
  --header "X-Api-Signature: sha256=$SIGNATURE" \
  --header "Idempotency-Key: $RECEIPT_KEY" \
  --form 'file=@receipt.pdf;type=application/pdf'
```

In the cURL example, `SIGNATURE` contains the hexadecimal signature without its prefix, and `RECEIPT_KEY` matches the key in the signed string. An HTTP `201` response returns `result.receipt` with `id`, `mime_type`, `size_bytes`, and `created_at`. Retry from the same integration with the original path, key, and file, and sign the new request. The API returns the same receipt with the `Idempotency-Replayed: true` header. If the receipt is deleted or ownership changes, the retry returns `404` and the key stays associated with the operation.

To list receipts, send `GET /api/v3/private/exchange/orders/{order}/receipts` with `public-api:files:read`. Entries in `result.receipts` are sorted by ascending ID. Set `limit` from 1 to 100, with a default of 25. Pass `result.next_after_id` as `after_id` to read the next page. A value of `null` marks the end of the list.

## 2. Record the customer's decision

Read `result.actions.allowed_actions`. `allowed` reflects the order state, while `authorized` reflects the key's permissions. To read actions, the key needs any one of `public-api:exchange:orders:actions:read`, `public-api:orders:detail:read`, or `public-api:orders:read`.

| Action | Request | Scope |
| - | - | - |
| `confirm_paid` | `POST /api/v3/private/exchange/orders/{order}/confirm` with `{"type":"paid"}` | `public-api:exchange:orders:confirm` |
| `confirm_unpaid` | The same operation with `{"type":"unpaid"}` | `public-api:exchange:orders:confirm` |
| `cancel` | `POST /api/v3/private/exchange/orders/{order}/cancel` with an empty body or `DELETE /api/v3/private/exchange/orders/{order}` | `public-api:exchange:orders:cancel` |

```bash Mark the order as paid theme={null}
printf '%s' '{"type":"paid"}' > confirm.json
node request.mjs POST '/api/v3/private/exchange/orders/order-1042/confirm' \
  --json confirm.json --idempotency-key 'confirm-paid-order-1042'
```

A successful response contains the updated order in `result.order`. Paying and waiting for payment details can have separate deadlines in `result.actions.payment_timing` and `result.actions.request_payment_timing`. If the action returns `422`, reload `actions` and check the deadline. [Confirmation operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/exchange/post-private-exchange-orders-by-order-confirm.md)

## 3. Check whether funds arrived

```bash Read payment progress theme={null}
node request.mjs GET '/api/v3/private/exchange/orders/order-1042/payment-status'
```

The key needs `public-api:exchange:payment-instructions:read`. In this example, the transaction has been found and is awaiting confirmation. The excerpt shows fields from `result.payment`. [Operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/exchange/get-private-exchange-orders-by-order-payment-status.md)

```json 200 OK · response excerpt theme={null}
{
  "checking": true,
  "provider_confirmed": false,
  "provider_confirmed_at": null,
  "current_status": {
    "key": "transaction_pending_confirmation",
    "value": 7,
    "updated_at": "2026-12-05T09:03:20Z"
  }
}
```

* For confirmed receipt of funds, use `provider_confirmed: true` and the `provider_confirmed_at` timestamp. `type: "paid"` records the customer's report.
* For `provider_confirmed: false`, use `current_status` to display the current step. An older order may have received funds before confirmation was recorded by the API.
* `timeline` shows the steps from recent verification records. When there are more than 50 records, `timeline_truncated` is `true`.

For the order's own status, poll `GET /api/v3/private/exchange/orders/{order}/status-summary`. Read the saved state in `result.status.key` and use `result.status.is_final` to identify a final state. The key needs either `public-api:orders:detail:read` or `public-api:orders:read`. Get the full order from `GET /api/v3/private/exchange/orders/{order}`. The `/status` operation also returns the full order in `result.order`. [Status summary operation reference](https://exchanger-api.iexexchanger.com/en/api-reference/exchange/get-private-exchange-orders-by-order-status-summary.md)

The `order.payment_received` event reports confirmed receipt of funds. After `order.status_changed`, read the order status again. [Webhook events and delivery](https://exchanger-api.iexexchanger.com/en/guides/reliability/webhooks.md)

Treat the exchange as complete once the order reaches `completed`. For a late or disputed transfer, refresh the order and payment information, then send the details to the exchanger for reconciliation. [Statuses, deadlines, and payment exceptions](https://exchanger-api.iexexchanger.com/en/guides/exchange/statuses.md)

## Next steps

> [card] [Files and verification](https://exchanger-api.iexexchanger.com/en/guides/exchange/files-and-verifications.md)
>
> Read the order requirements and submit verification data.

> [card] [Payment events](https://exchanger-api.iexexchanger.com/en/guides/reliability/webhooks.md)
>
> Update the order after payment is confirmed.

## Prompt for your coding agent

> [accordion] Create an order and reconcile payment
>
> ```text theme={null}
> Implement a server-side order creation and payment reconciliation workflow for Exchanger API v3 in [STACK]. The inputs are form data that passed preflight and the customer's explicit confirmation. Display order status, payment instructions, and confirmed receipt as separate values.
>
> Check the contract against the documentation:
> - https://exchanger-api.iexexchanger.com/en/guides/exchange/create-order
> - https://exchanger-api.iexexchanger.com/en/guides/exchange/payment-and-status
> - https://exchanger-api.iexexchanger.com/en/start/authentication
> - https://exchanger-api.iexexchanger.com/en/guides/reliability/idempotency
> - https://exchanger-api.iexexchanger.com/en/guides/reliability/webhooks
>
> 1. Sign HTTP requests with HMAC v2. Set a timeout and read configuration from the environment. Develop and test with local mocks and synthetic responses. Do not request real secrets or create orders, subscriptions, or payments on a live exchanger.
> 2. Before POST /api/v3/private/exchange/orders, save the exact body and the Idempotency-Key for the operation. Creation requires public-api:exchange:orders:create. After 201, save tracking_id or public_id as a string from result.order. After a timeout, retry with the same body and key and a fresh signature. On idempotency_conflict, surface the error and reconcile the original operation.
> 3. Read payment-instructions and payment-status with public-api:exchange:payment-instructions:read. If preparation is needed, check prepare_payment through GET /api/v3/private/exchange/orders/{order}/actions. That request accepts any of public-api:exchange:orders:actions:read, public-api:orders:detail:read, or public-api:orders:read. Call POST payment-instructions only when allowed and authorized and with public-api:exchange:payment-instructions:write. Display payment details from GET when status is ready. Keep a customer's paid declaration separate from confirmed receipt.
> 4. Read status-summary with public-api:orders:detail:read or public-api:orders:read. Treat result.status.key: completed as a completed exchange. Read confirmed receipt separately in result.payment.provider_confirmed and provider_confirmed_at. On 403 check the scope, and on 404 check that the order belongs to the key owner. If a webhook is connected, verify its v2 signature over the original bytes with the subscription secret, deduplicate by event ID, and reread state after order.status_changed or order.payment_received.
>
> Add local tests for a lost create response and replay, a key conflict, payment instructions that are not ready, and the difference between a paid order status and provider confirmation. If you add webhooks, test duplicate deliveries and a tampered signature. Report the command to run the tests.
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.