> ## Documentation Index
> Fetch the complete documentation index at: https://sdk.qfapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 消費者出示碼模式（反掃）（CPM）

<Frame>
  <img src="https://mintcdn.com/qfpay-8e347952/hryuJL3jkOEk3j5C/zh-hant/images/in-store/cpm_flow_chin.jpeg?fit=max&auto=format&n=hryuJL3jkOEk3j5C&q=85&s=2f5587e6ba859ed9cab69c6bf58d8b19" alt="CPM Flow" width="1059" height="876" data-path="zh-hant/images/in-store/cpm_flow_chin.jpeg" />
</Frame>

## 什麼是 CPM？

CPM（Consumer Presented Mode）指**顧客出示付款碼**，由商戶掃描完成付款。

常見流程：

1. 顧客在錢包（WeChat Pay / Alipay / PayMe / 銀聯雲閃付）打開付款碼（動態 QR Code / 條碼）
2. 商戶使用收銀設備掃描顧客付款碼
3. 系統回傳交易結果；若仍處理中，商戶需再查詢狀態確認

***

## CPM API 請求

* **端點**：`/trade/v1/payment`
* **方法**：`POST`

### 支援的支付類型（PayType）

| 編碼     | 說明                      |
| ------ | ----------------------- |
| 800008 | 微信、支付寶、銀聯雲閃付、PayMe 反掃支付 |
| 800108 | 支付寶跨境反掃支付               |
| 800208 | 微信反掃支付                  |
| 801008 | 微信香港反掃支付（適用於向微信香港申請的商戶） |
| 805808 | PayMe 反掃支付              |
| 800708 | 銀聯雲閃付反掃支付               |

<Note>
  若回傳代碼為 `1143` / `1145`，表示交易仍在處理中，或顧客正在輸入密碼。建議使用 [交易查詢 API](/zh-hant/integration/common-api/transaction-enquiry) 再次確認最終狀態。
</Note>

<Tip>
  簽名生成方式請參考 [簽名生成](/zh-hant/integration/preparation/authentication-and-signature)。
</Tip>

***

## 請求示例

```http theme={null}
POST /trade/v1/payment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
X-QF-APPCODE: A6A49A66B4C********94EA95032
X-QF-SIGN: 3b020a6349646684ebeeb0ec2cd3d1fb

auth_code=13485790*******88557&goods_name=qfpay&mchid=R1zQrTdJnn&out_trade_no=Native201907221520536a25477909&pay_type=800208&txamt=10&txcurrcd=HKD&txdtm=2019-07-22 15:20:54&udid=AA
```

***

## 回應示例

```json theme={null}
{
  "pay_type": "800108",
  "sysdtm": "2019-07-22 15:20:54",
  "paydtm": "2019-07-22 15:20:56",
  "txdtm": "2019-07-22 15:20:54",
  "udid": "AA",
  "txcurrcd": "EUR",
  "txamt": 10,
  "resperr": "交易成功",
  "respmsg": "OK",
  "out_trade_no": "201907221520536a25477909",
  "syssn": "20190722000300020081074842",
  "respcd": "0000",
  "chnlsn": "4200000384201907223585006133"
}
```

***

## 請求參數

| 欄位                                                            | 必填        | 類型          | 說明                                                  |
| ------------------------------------------------------------- | --------- | ----------- | --------------------------------------------------- |
| [通用支付請求參數](/zh-hant/integration/api-reference/request-format) | —         | —           | 通用欄位，例如 `mchid`、`txamt`、`txcurrcd`、`out_trade_no` 等 |
| `auth_code`                                                   | 是（僅限 CPM） | String(128) | 顧客錢包付款碼（條碼 / 二維碼）的授權碼；每筆交易唯一（通常可在付款碼下方看到）           |

***

## 回應參數

| 欄位                                                           | 類型 | 說明                                    |
| ------------------------------------------------------------ | -- | ------------------------------------- |
| [通用回應格式](/zh-hant/integration/api-reference/response-format) | —  | 回應結構包含 `respcd`、`syssn`、`respmsg` 等欄位 |
