> 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-general-rules/api-request-format.md).

# API Request資料格式

## 基本格式

資料以JSON格式填寫, 基本JSON內容為

```
{
    "Header":
    {
        "Method":"00000",
        "ServiceType":"OLPay",
        "MchId":"Account001",
        "TradeKey":"sha256encodedpassword...",
        "CreateTime":"20180101121100"
    },
    "Data":"...."
}
```

### Header

"Header"內為固定的必要欄位, 說明如下

| 欄位名稱        | 型別          | 範例             | 說明                                                                     |
| ----------- | ----------- | -------------- | ---------------------------------------------------------------------- |
| Method      | String(5)   | 00000          | 請填入00000(不指定支付方式) 各代碼所對應的支付方式[請查表](/scan2pay/appendix/payment-type.md) |
| ServiceType | String(32)  | OLPay          | 所選用的Scan2Pay[服務代碼](/scan2pay/api-specification.md#api-gong-neng)       |
| MchId       | String(32)  | Account0001    | 由intella所提供的特店帳號                                                       |
| TradeKey    | String(128) | sha256...hash  | 由intella所提供的特店密碼, 此密碼須先經過SHA256編碼後再填入                                  |
| CreateTime  | String(14)  | 20180101120100 | Request建立時間, 格式為yyyyMMddHHmmss                                         |

{% hint style="warning" %}
Header欄位內的資料都是必須的, 每次呼叫API都需要帶入
{% endhint %}

{% hint style="danger" %}
交易密碼(TradeKey)傳入時，不以明碼傳輸，必須先使用SHA256編碼後再帶入為參數, 且必須使用小寫字元
{% endhint %}

### Data

"Data"欄位內容為根據各API所定義而不同, 內容為一字串, 字串內容為JSON格式的資料.


---

# 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-general-rules/api-request-format.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.
