> For the complete documentation index, see [llms.txt](https://intella.gitbook.io/scan2pay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://intella.gitbook.io/scan2pay/api-specification/multi-order-query.md).

# 多筆交易查詢

## 說明

多筆交易查詢

## Request

### Header

| 欄位          | 必填  | 型別          | 範例             | 說明                                          |
| ----------- | --- | ----------- | -------------- | ------------------------------------------- |
| Method      | YES | String(5)   | 00000          | 請填入固定值00000                                 |
| ServiceType | YES | String(32)  | **OrderQuery** | 所選用的Scan2Pay服務代碼                            |
| MchId       | YES | String(32)  | Account0001    | 由intella所提供的特店帳號                            |
| TradeKey    | YES | String(128) | sha256...hash  | 由intella所提供的交易密碼, 此密碼須先經過SHA256加密，再進行Hex編碼。 |
| CreateTime  | YES | String(14)  | 20180101120000 | Request建立時間, 格式為yyyyMMddHHmmss              |

### Data

| 欄位           | 必填  | 型別         | 範例       | 說明                         |
| ------------ | --- | ---------- | -------- | -------------------------- |
| StartDate    | YES | String(16) | 20180101 | 起始日期, 格式為yyyyMMddHHmmss    |
| EndDate      | YES | String(16) | 20180102 | 結束日期, 格式為yyyyMMddHHmmss    |
| OrderStatus  | YES | String(16) | 1        | 0: 處理中 / 1: 交易成功 / 2: 交易失敗 |
| StoreOrderNo | NO  | String(32) | PO1801   | 關鍵字, 必須大於3字元               |

## Response

### Header

| 欄位           | 型別        | 範例             | 說明                                                   |
| ------------ | --------- | -------------- | ---------------------------------------------------- |
| StatusCode   | String(4) | 0000           | [交易結果代碼](/scan2pay/appendix/scan2pay-error-codes.md) |
| StatusDesc   | String    | 交易成功           | 交易結果代碼說明                                             |
| Method       | String(5) | 10100          | 支付方式代碼                                               |
| ServiceType  | String    | **OrderQuery** | 所選用的Scan2Pay服務代碼                                     |
| MchId        | String    | Account0001    | 特店帳號                                                 |
| ResponseTime | String    | 20180101120000 | 時間, 格式為yyyyMMddHHmmss                                |

### Data

{% hint style="info" %}
Data資料是以多筆陣列(Array)的方式回覆
{% endhint %}

| 欄位           | 型別          | 範例                  | 說明                                           |
| ------------ | ----------- | ------------------- | -------------------------------------------- |
| SysOrderNo   | String(32)  | 2018010110074205610 | 系統訂單編號                                       |
| StoreOrderNo | PO180101001 | PO180101001         | 特店訂單編號                                       |
| TotalFee     | Integer     | 75                  | 交易金額                                         |
| FeeType      | String(4)   | TWD                 | 交易幣別                                         |
| Description  | String      | 大雞排                 | 商品描述                                         |
| Status       | String(16)  | Trade success       | 訂單狀態                                         |
| RefundStatus | String(16)  | Refund success      | 退款狀態 (Refund success / Refund fail)          |
| Method       | String(5)   | 11500               | [支付平台代碼](/scan2pay/appendix/payment-type.md) |

{% hint style="info" %}
若該筆交易沒有進行退款，則不會有RefundStatus欄位回傳
{% endhint %}

## API Example

### Request

```
{
  "Header": {
    "Method": "00000",
    "ServiceType": "OrderQuery",
    "MchId": "myMchId",
    "TradeKey": "9af15b336e6a9619928537df30b2e6a2376569fcf9d7e773eccede65606529a0",
    "CreateTime": "20180715105349"
  },
  "Data": "{\"StartDate\":\"20180715\",\"EndDate\":\"20180716\",\"OrderStatus\":\"1\"}"
}
```

### Response

```
{
  "Header": {
    "StatusCode": "0000",
    "StatusDesc": "執行成功",
    "Method": "00000",
    "ServiceType": "OrderQuery",
    "MchId": "myMchId"
  },
  "Data": {
    "DataValue": [
      {
        "StoreOrderNo": "PO-20180715-004",
        "SysOrderNo": "104605",
        "TotalFee": 10,
        "FeeType": "TWD",
        "Status": "Trade success",
        "Description": "-7082",
        "Method": "11500"
      },
      {
        "StoreOrderNo": "PO-20180715-005",
        "SysOrderNo": "104644",
        "TotalFee": 10,
        "FeeType": "TWD",
        "Status": "Trade success",
        "RefundStatus": "Refund success",
        "Description": "Chicken Rice-0247",
        "Method": "31800"
      },
      {
        "StoreOrderNo": "PO-20180715-001",
        "SysOrderNo": "2018071544571196210",
        "TotalFee": 1,
        "FeeType": "TWD",
        "Status": "Trade success",
        "RefundStatus": "Refund success",
        "Description": "Chicken Rice-6485",
        "Method": "11500"
      },
      {
        "StoreOrderNo": "PO-20180715-002",
        "SysOrderNo": "J006536011807150001",
        "TotalFee": 1,
        "FeeType": "TWD",
        "Status": "Trade success",
        "Description": "Chicken Rice-1413",
        "Method": "11500"
      }
    ]
  }
}
```


---

# 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://intella.gitbook.io/scan2pay/api-specification/multi-order-query.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.
