# 交易結果通知

## 說明

通知特店交易結果，特店須自行撰寫接收 api，並提供符合以下規範之網址

{% hint style="info" %}
接收網址必須支援https協議, 不支援http協議, 使用HTTP POST發送
{% endhint %}

{% hint style="info" %}
接收通知的URL由客戶自訂, 並無限制必須使用notifyMerchant為URL
{% endhint %}

`例如 https://<domain>/notifyMerchant`

## Request

| 欄位           | 型別     | 範例                         | 說明                               |
| ------------ | ------ | -------------------------- | -------------------------------- |
| MchId        | String | Account0001                | 特店帳號                             |
| Result       | String | 0000                       | <p>0000:交易成功</p><p>9999:交易失敗</p> |
| StoreOrderNo | String | PO0101001                  | 特店訂單編號                           |
| TotalFee     | String | 100                        | 交易金額                             |
| MethodName   | String | 支付寶                        | 支付名稱                             |
| Detail       | String | 大漢堡                        | 交易項目內容                           |
| Sign         | String | jSaVOA.....feQ\u003d\u003d | 簽驗                               |

{% hint style="info" %}
簽驗: 使用intella 提供的public key做簽章驗證 (請注意是測試機或是正式機, 要使用正確的public key)
{% endhint %}

### 簽章驗證方式

1. 將取得的JSON內容中的 "Sign" 欄位資料去除 (此為待驗證的原始JSON資料\[1])
2. 將"Sign"欄位的內容做base64解碼 (Sign欄位內容含有 "\u003d" 字串, 請用 "=" 取代後再進行base64解碼), 此為簽章驗證的比對資料\[2]
3. 使用英特拉提供的公開金鑰(public key) 將待驗證的原始JSON資料\[1], 與簽章驗證的比對資料\[2]做簽章驗證 (簽章驗證使用SHA256 hash 演算法)


---

# Agent Instructions: 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:

```
GET https://intella.gitbook.io/scan2pay/api-callback.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
