> 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/merchant-scan.md).

# 消費者被掃

## 說明

由消費者出示之各支付平台所產生之 QR Code，取得 QR Code 中之授權碼進行交易。

## Request

### Header

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

### Data

| 欄位              | 必填  | 型別          | 範例                   | 說明                                                 |
| --------------- | --- | ----------- | -------------------- | -------------------------------------------------- |
| StoreOrderNo    | YES | String(20)  | PO180101001          | 訂單編號, 全英數不超過20字元                                   |
| DeviceInfo      | YES | String      | skb0001              | 終端機編號, 固定為skb0001                                  |
| Body            | YES | String(128) | 雞排                   | 商品描述                                               |
| TotalFee        | YES | Integer     | 75                   | 訂單總金額, 正整數                                         |
| Detail          | NO  | String(200) | 香酥大雞排                | 商品詳情                                               |
| StoreInfo       | NO  | String      | 0001                 | 門市代號                                               |
| Cashier         | NO  | String      | 王小明                  | 收銀員                                                |
| AuthCode        | YES | String      | 13000011423          | 授權碼, 由消費者出示的QR Code取得                              |
| StoreName       | NO  | String      | 忠孝店                  | 分店名稱                                               |
| StoreType       | NO  | String      | 直營店                  | 分店類型                                               |
| DeviceOS        | NO  | String      | 2                    | 裝置類型(1: iOS / 2: Android / 3: Windows / 4: Others) |
| NotDiscountable | NO  | Integer     | 357                  | 非促銷商品金額, 如菸酒等法定不得折扣促銷之商品總金額, 正整數                   |
| Discount        | NO  | Integer     | 85                   | 折價金額                                               |
| Pcode           | NO  | String      | 202205010050TW123456 | 依合作支付所提供的折扣代碼(目前一組訂單僅支援一組折扣代碼)                     |
| Pamt            | NO  | String      | 60                   | <p>定率合作：帶入此指定品項組合所符合的銷售金額 </p><p>定額合作：不可填入</p>     |
| Pqty            | NO  | String      |                      | <p>定率合作：不可填入 </p><p>定額合作：帶入此指定品項組合所符合的組合數量</p>     |

{% hint style="danger" %}
訂單編碼(StoreOrderNo)不可超過20字元，且只能使用英文字母和數字，不能使用符號或是特殊字元，以免導致部分支付交易失敗
{% endhint %}

## Response

### Header

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

### Data

<table data-header-hidden><thead><tr><th>欄位</th><th width="150">型別</th><th>範例</th><th>說明</th></tr></thead><tbody><tr><td>欄位</td><td>型別</td><td>範例</td><td>說明</td></tr><tr><td>SysOrderNo</td><td>String</td><td>2018010110074205610</td><td>系統訂單編號</td></tr><tr><td>StoreOrderNo</td><td>String</td><td>PO180101001</td><td>特店訂單編號</td></tr><tr><td>TotalFee</td><td>Integer</td><td>75</td><td>訂單總金額</td></tr><tr><td>AuthCode</td><td>String</td><td>13000011423</td><td> 支付授權碼, 設備讀取消費者出示的條碼或QR Code</td></tr><tr><td>MemberId</td><td>String</td><td>M35812649</td><td>商家會員卡{類別名稱需與LINE Pay洽談確認}</td></tr><tr><td>CarrierNum</td><td>String</td><td>/RRJFVKQ</td><td>電子發票載具</td></tr></tbody></table>

## API Example

### Request

```
{
  "Header": {
    "Method": "00000",
    "ServiceType": "Micropay",
    "MchId": "myMchId",
    "TradeKey": "9af15b336e6a9619928537df30b2e6a2376569fcf9d7e773eccede65606529a0",
    "CreateTime": "20180715101650"
  },
 "Data": "{
    "DeviceInfo":"skb0001",
    "StoreOrderNo":"PO20180715002",
    "Body":"Chicken Rice",
    "TotalFee":"1",
    "AuthCode":"3K21111111301",
    "Pcode":"202205010050TW123456",
    "Pamt":"60",
  }"
}
```

### Response

```
{
  "Header": {
    "StatusCode": "0000",
    "StatusDesc": "執行成功",
    "Method": "10900",
    "ServiceType": "Micropay",
    "MchId": "myMchId",
    "ResponseTime": "20180715101723"
  },
  "Data": {
    "SysOrderNo": "J006536011807150001",
    "StoreOrderNo": "PO-20180715-002",
    "TotalFee": "1",
    "AuthCode": "",
    "MemberId":"M35812649",
    "CarrierNum":"/RRJFVKQ":
 }
}
```


---

# 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/merchant-scan.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.
