> For the complete documentation index, see [llms.txt](https://docs.pagsmile.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagsmile.com/reference/remittance-api/business/exchange/query-exchange-orders.md).

# Query Exchange Orders

Retrieves exchange orders for a merchant within a specified time range, with optional filters and pagination.

**Endpoint**

`POST /remittance/exchange/query-orders`

**Sandbox base URL:** `https://rem-api-sandbox.pagsmile.com`\
**Content-Type:** `application/json; charset=UTF-8`

The request uses the standard [Remittance API request envelope](https://docs.pagsmile.com/remittance-api/common). The fields below describe the decrypted `biz_data` object.

{% hint style="info" %}
**Requirement:** `M` = Mandatory, `O` = Optional, and `C` = Conditional. A conditional field is mandatory only when the condition stated in its description applies.
{% endhint %}

{% hint style="warning" %}
Encrypt `biz_data`, encrypt the AES key into `random_key`, and sign the request according to the Common request specification.
{% endhint %}

**Request body**

**Decrypted `biz_data` fields**

| Field          | Type    | Requirement | Description                                                                                                                                                                                 |
| -------------- | ------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `merchant_id`  | long    | O           | Pagsmile-assigned unique identifier of the merchant.                                                                                                                                        |
| `order_no`     | string  | O           | Merchant-defined order number used to submit, query, and reconcile the foreign-exchange order.                                                                                              |
| `order_status` | integer | O           | <p>Current processing status of the order.<br>See <a href="https://docs.pagsmile.com/reference/remittance-api/data/dictionary-item/order-status">Order Status</a> for supported values.</p> |
| `start_date`   | string  | M           | <p>Start of the query period, inclusive.<br>Format: <code>yyyy-MM-dd HH:</code>​<code>mm:ss</code>.</p>                                                                                     |
| `end_date`     | string  | M           | <p>End of the query period, inclusive.<br>Format: <code>yyyy-MM-dd HH:</code>​<code>mm:ss</code>.</p>                                                                                       |
| `page_num`     | integer | O           | <p>One-based page number of the result set.<br>Default: <code>1</code>.</p>                                                                                                                 |
| `page_size`    | integer | O           | <p>Maximum number of records returned on each page.<br>Default: <code>10</code>.<br>Maximum: <code>30</code>.</p>                                                                           |

{% hint style="info" %}
max query time range : 7 days
{% endhint %}

**Plaintext `biz_data` example**

{% hint style="info" %}
This example includes mandatory fields and representative optional or conditional fields. Submit fields marked `C` only when the condition in the field description applies.
{% endhint %}

```json
{
  "merchant_id": 100398,
  "order_no": "ORDER_202607200001",
  "order_status": 1,
  "start_date": "2026-07-20 00:00:00",
  "end_date": "2026-07-20 23:59:59",
  "page_num": 1,
  "page_size": 10
}
```

**Request example**

```bash
curl --request POST \
  --url https://rem-api-sandbox.pagsmile.com/remittance/exchange/query-orders \
  --header 'Content-Type: application/json; charset=UTF-8' \
  --data '{
    "partner_id": "<your_partner_id>",
    "app_id": "<your_app_id>",
    "timestamp": "2026-07-20 10:30:00",
    "version": "2.0",
    "language": "en",
    "random_key": "<RSA-encrypted AES key>",
    "request_id": "<globally_unique_request_id>",
    "sign_type": "RSA",
    "biz_data": "<AES-encrypted biz_data>"
  }'
```

{% hint style="info" %}
Use the `partner_id` and `app_id` assigned to your integration. The values above are placeholders.
{% endhint %}

**Response**

{% tabs %}
{% tab title="Success" %}
The `data` field in the response envelope is AES-encrypted. Decrypt `random_key` with your RSA private key, then use the resulting AES key to decrypt `data`. See [Security](https://docs.pagsmile.com/remittance-api/security) for implementation details.

**Encrypted response example**

```json
{
  "code": "10000",
  "msg": "Success",
  "data": "<AES-encrypted response data>",
  "total": 6,
  "random_key": "<RSA-encrypted AES key>",
  "sign_type": "RSA",
  "app_id": "2017051914172236111"
}
```

**Decrypted `data` example**

```json
[
  {
    "order_id": 200001,
    "merchant_id": 100398,
    "order_no": "ORDER_202607200001",
    "order_status": 1,
    "quote_id": 100001,
    "sell_currency": "USD",
    "sell_amount": "100.00",
    "buy_currency": "USD",
    "buy_amount": "100.00",
    "fixed_side": "sell",
    "conversion_rate": "1.000000",
    "transaction_ids": [
      300001
    ],
    "error_message": "",
    "created_at": "2026-07-20 10:30:00"
  }
]
```

{% endtab %}

{% tab title="Invalid signature" %}

```json
{
  "code": "40002",
  "msg": "Business Failed",
  "sub_code": "invalid-signature",
  "sub_msg": "invalid signature"
}
```

{% endtab %}

{% tab title="403" %}

{% endtab %}
{% endtabs %}

**Response data fields**

| Field             | Type    | Requirement | Description                                                                                                                                                                                                                          |
| ----------------- | ------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `order_id`        | long    | M           | Pagsmile-assigned unique identifier of the order.                                                                                                                                                                                    |
| `merchant_id`     | long    | M           | Pagsmile-assigned unique identifier of the merchant associated with the returned record.                                                                                                                                             |
| `order_no`        | string  | M           | Merchant-defined order number used to submit, query, and reconcile the foreign-exchange order.                                                                                                                                       |
| `order_status`    | integer | M           | <p>Current processing status of the order.<br>See <a href="https://docs.pagsmile.com/reference/remittance-api/data/dictionary-item/order-status">Order Status</a> for supported values.</p>                                          |
| `quote_id`        | long    | M           | Pagsmile-assigned unique identifier of the foreign-exchange quote.                                                                                                                                                                   |
| `sell_currency`   | string  | O           | Three-letter ISO 4217 code of the currency being sold.                                                                                                                                                                               |
| `sell_amount`     | string  | O           | Amount of the sell currency in the foreign-exchange transaction.                                                                                                                                                                     |
| `buy_currency`    | string  | O           | Three-letter ISO 4217 code of the currency being purchased.                                                                                                                                                                          |
| `buy_amount`      | string  | O           | Amount of the buy currency in the foreign-exchange transaction.                                                                                                                                                                      |
| `fixed_side`      | string  | O           | <p>Specifies whether the sell amount or buy amount is fixed when calculating the quote.<br>See <a href="https://docs.pagsmile.com/reference/remittance-api/data/dictionary-item/fixed-side">Fixed Side</a> for supported values.</p> |
| `conversion_rate` | string  | O           | Conversion rate applied between the sell and buy currencies.                                                                                                                                                                         |
| `transaction_ids` | list\\  | O           | List of Pagsmile-assigned unique identifiers of the related transactions.                                                                                                                                                            |
| `error_message`   | string  | O           | Human-readable explanation provided when processing fails.                                                                                                                                                                           |
| `created_at`      | string  | O           | <p>Date and time when the foreign-exchange order was created.<br>Format: <code>yyyy-MM-dd HH:</code>​<code>mm:ss</code>.</p>                                                                                                         |

**Related APIs**

* [Create Exchange Order](https://docs.pagsmile.com/remittance-api/business/exchange/create-exchange-order)
* [Query Quote](https://docs.pagsmile.com/remittance-api/business/exchange/query-quote)
* [Query Support Currency Pairs](https://docs.pagsmile.com/remittance-api/business/exchange/query-support-currency-pairs)
