> For the complete documentation index, see [llms.txt](https://docs.fonbnk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fonbnk.com/server-to-server/api-endpoints/get-order.md).

# Get order

## <mark style="color:$success;">\[GET]</mark> /api/v2/order

Reads one order, by its ID or by the `orderParams` reference you set when you created it.

Request query params type:

```typescript
type QueryParams = {
    orderId?: string,// the order's _id
    orderParams?: string,// your own reference, from create order
}
```

Send **exactly one** of the two. Neither is `400 Either orderId or orderParams is required`; both is `400 Only one of orderId or orderParams should be provided`. There is no precedence rule.

Request URL example:

{% code overflow="wrap" %}

```
GET /api/v2/order?orderId=69281d944a1db009177f0198
```

{% endcode %}

{% hint style="info" %}
An order that belongs to another merchant answers `404` with the code `ORDER_NOT_AVAILABLE`, the same as an order that does not exist.
{% endhint %}

### Response

This is the canonical `Order` object. [Create order](/server-to-server/api-endpoints/create-order.md), [Confirm order](/server-to-server/api-endpoints/confirm-order.md), [Cancel order](/server-to-server/api-endpoints/cancel-order.md), [Trigger order intermediate action](/server-to-server/api-endpoints/trigger-order-intermediate-action.md) and [Get orders](/server-to-server/api-endpoints/get-orders.md) all return the same shape.

{% code overflow="wrap" expandable="true" %}

```typescript
type Response = {
  _id: string;
  countryIsoCode: string;
  userId: string;
  userEmail: string;
  merchantOrderParams?: string; // the orderParams you sent on create
  status: OrderStatus;
  deposit: {
    paymentChannel: PaymentChannel;
    currencyType: CurrencyType;
    currencyCode: string;
    currencyDetails: OrderCurrencyDetails;
    cashout: Cashout;
    providedFieldsToCreateOrder: Record<string, string>;
    providedFieldsToConfirmOrder?: Record<string, string>;
    formattedUserFieldsToCreateOrder?: FormattedUserField[]; // the same values, labelled and typed for display
    transferInstructions: TransferInstructions;
    transaction?: {
      meta?: {
        transactionHash?: string;
        fromAddress?: string;
        toAddress?: string;
      }
    }
  },
  payout: {
    paymentChannel: PaymentChannel;
    currencyType: CurrencyType;
    currencyCode: string;
    currencyDetails: OrderCurrencyDetails;
    cashout: Cashout;
    providedFieldsToCreateOrder: Record<string, string>;
    providedFieldsToConfirmOrder?: Record<string, string>;
    formattedUserFieldsToCreateOrder?: FormattedUserField[];
    transaction?: {
      meta?: {
        // crypto payout
        transactionHash?: string;
        fromAddress?: string;
        toAddress?: string;
        // fiat payout
        paymentChannelAdditionalInfo?: string;
      }
    }
  },
  refund?: {
    paymentChannel: PaymentChannel;
    currencyType: CurrencyType;
    currencyCode: string;
    currencyDetails: OrderCurrencyDetails;
    cashout: Cashout;
    providedFieldsToCreateOrder: Record<string, string>;
    providedFieldsToConfirmOrder?: Record<string, string>;
    transaction?: { meta?: { transactionHash?: string } }
  },
  statusChangeLogs: { oldStatus?: OrderStatus; newStatus: OrderStatus; date: Date; }[];
  signature?: string; // signed token the Pay Widget decodes; ignore it in a server integration
  createdAt: Date;
  updatedAt: Date;
  expiresAt: Date;
}
```

{% endcode %}

Things worth knowing:

* Optional fields are **omitted, not null**, until they have a value. A fresh order has no `transaction` on either leg and an empty `statusChangeLogs`.
* `deposit.transaction` is only present on a crypto deposit — that is, on an off-ramp.
* `payout.transaction.meta` carries `transactionHash` for a crypto payout and `paymentChannelAdditionalInfo` for a fiat one.
* `refund` appears only once a refund exists. See [Order statuses](/server-to-server/order-statuses.md).
* **`statusChangeLogs` records transitions, not creation.** It is empty on a fresh order and every entry carries both `oldStatus` and `newStatus` — with one exception: a `deposit_canceled` entry is written without an `oldStatus`. Treat the field as optional and do not assume the first entry is the one missing it.
* `expiresAt` is when an unpaid order goes to `deposit_expired`.

Response example (sandbox, a completed KES mobile money on-ramp):

{% code overflow="wrap" expandable="true" %}

```json
{
    "_id": "69283d079061f4031ad1ba03",
    "countryIsoCode": "KE",
    "userId": "69283c0518613bc9de730cb4",
    "userEmail": "sandbox-user@example.com",
    "status": "payout_successful",
    "deposit": {
        "paymentChannel": "mobile_money",
        "currencyType": "fiat",
        "currencyCode": "KES",
        "currencyDetails": {
            "countryIsoCode": "KE",
            "carrier": {
                "code": "ke_safaricom",
                "name": "Safaricom Kenya",
                "_id": "618e43914f57e07d255ff353"
            }
        },
        "cashout": {
            "amountBeforeFees": 135,
            "amountAfterFees": 130,
            "amountBeforeFeesUsd": 1.037823,
            "amountAfterFeesUsd": 0.999385,
            "chargedFees": [
                { "id": "service_fee", "type": "percentage", "recipient": "platform", "amount": 3.38 },
                { "id": "merchant_fee", "type": "percentage", "recipient": "merchant", "amount": 1.35 }
            ],
            "chargedFeesUsd": [
                { "id": "service_fee", "type": "percentage", "recipient": "platform", "amount": 0.025984 },
                { "id": "merchant_fee", "type": "percentage", "recipient": "merchant", "amount": 0.010378 }
            ],
            "totalChargedFees": 4.73,
            "totalChargedFeesUsd": 0.036362,
            "exchangeRate": 130.08,
            "exchangeRateAfterFees": 135.0831,
            "chargedFeesPerRecipient": { "platform": 3.38, "merchant": 1.35 },
            "chargedFeesPerRecipientUsd": { "platform": 0.025984, "merchant": 0.010378 },
            "feeSettings": [
                { "id": "service_fee", "recipient": "platform", "type": "percentage", "value": 2.5, "min": 0, "max": "Infinity" },
                { "id": "merchant_fee", "recipient": "merchant", "type": "percentage", "value": 1, "min": 0, "max": "Infinity" }
            ]
        },
        "providedFieldsToCreateOrder": {
            "phoneNumber": "254712345678",
            "carrierCode": "ke_safaricom"
        },
        "providedFieldsToConfirmOrder": {},
        "transferInstructions": {
            "type": "otp_stk_push",
            "intermediateActionAttempts": 2,
            "intermediateActionMaxAttempts": 3,
            "intermediateActionButtonText": "Verify OTP code",
            "intermediateActionNextAttemptAvailableAt": "2025-11-27T12:00:14.390Z",
            "intermediateActionTimeoutMs": 30000,
            "isIntermediateActionAvailable": true,
            "fieldsForIntermediateAction": [
                { "key": "otpCode", "label": "OTP code", "type": "number", "required": true }
            ],
            "instructionsText": "It is a sandbox offer. Use 123456 as OTP code and confirm the transfer from your side and system will automatically confirm the transfer within 1 minute.",
            "warningText": "Non-confirmed orders will be automatically canceled after 5 minutes.",
            "transferDetails": [
                { "id": "amountToSend", "label": "Amount to send", "value": "135" }
            ],
            "fieldsToConfirmOrder": [],
            "intermediateActionRequired": true,
            "intermediateActionExecuted": true,
            "otpChannel": "sms"
        }
    },
    "payout": {
        "paymentChannel": "crypto",
        "currencyType": "crypto",
        "currencyCode": "POLYGON_USDT",
        "currencyDetails": {
            "network": "POLYGON",
            "asset": "USDT",
            "contractAddress": "0x3b3a06b48119c035a2e86afdb69d9ad930643b3d"
        },
        "cashout": {
            "amountBeforeFees": 1.000645,
            "amountAfterFees": 1,
            "amountBeforeFeesUsd": 1.000645,
            "amountAfterFeesUsd": 1,
            "chargedFees": [
                { "id": "gas", "type": "flat_amount", "recipient": "blockchain", "amount": 0.000645 }
            ],
            "chargedFeesUsd": [
                { "id": "gas", "type": "flat_amount", "recipient": "blockchain", "amount": 0.000645 }
            ],
            "totalChargedFees": 0.000645,
            "totalChargedFeesUsd": 0.000645,
            "exchangeRate": 1,
            "exchangeRateAfterFees": 1.0006,
            "chargedFeesPerRecipient": { "blockchain": 0.000645 },
            "chargedFeesPerRecipientUsd": { "blockchain": 0.000645 },
            "feeSettings": [
                { "id": "gas", "recipient": "blockchain", "type": "flat_amount", "value": 0.000645, "min": 0, "max": "Infinity" }
            ]
        },
        "providedFieldsToCreateOrder": {
            "blockchainWalletAddress": "0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20"
        },
        "transaction": {
            "meta": {
                "transactionHash": "0xe168c39bf7165c0eaa88e4df1e21e987666e44f11f2bea6f9be1c145f382dade",
                "fromAddress": "0xdc9cbad0c43f912a66cd44cd22a15c04368e659f",
                "toAddress": "0x5b7ae3c6c87f4a3f94b35c77233b13191ebfad20"
            }
        }
    },
    "statusChangeLogs": [
        { "oldStatus": "deposit_awaiting", "newStatus": "deposit_validating", "date": "2025-11-27T12:01:43.660Z" },
        { "oldStatus": "deposit_validating", "newStatus": "deposit_successful", "date": "2025-11-27T12:02:00.770Z" },
        { "oldStatus": "deposit_successful", "newStatus": "payout_pending", "date": "2025-11-27T12:02:01.306Z" },
        { "oldStatus": "payout_pending", "newStatus": "payout_successful", "date": "2025-11-27T12:02:19.053Z" }
    ],
    "createdAt": "2025-11-27T11:59:03.754Z",
    "updatedAt": "2025-11-27T12:02:19.124Z",
    "expiresAt": "2025-11-27T12:04:03.673Z"
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fonbnk.com/server-to-server/api-endpoints/get-order.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
