> 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資料格式

Scan2Pay 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格式的資料.
