> ## 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.

# Consumer Present Mode (CPM)

> API guide for Consumer Present Mode (CPM) in-store barcode payments.

Consumer Present Mode (CPM) is used for **in-person barcode payments**.<br />The customer presents a dynamic barcode from their wallet app, and the merchant scans it to initiate payment.

This mode is designed exclusively for **offline, face-to-face transactions** (e.g. retail stores, restaurants, physical POS terminals).

<Frame>
  <img src="https://mintcdn.com/qfpay-8e347952/nhPCT07_mu66i7Fi/images/in-store/cpm_flow_en.jpeg?fit=max&auto=format&n=nhPCT07_mu66i7Fi&q=85&s=c638d2c07d67ec4aff968aa24f300ebf" alt="CPM process-flow" width="1159" height="987" data-path="images/in-store/cpm_flow_en.jpeg" />
</Frame>

***

## When to Use CPM

Use CPM when:

* The customer is physically present
* The customer displays a wallet barcode
* The merchant scans the barcode using a POS device or scanner
* Immediate payment confirmation is required

***

## API Endpoint

**Endpoint** : `/trade/v1/payment`<br />**Method** : `POST`

***

## Supported PayTypes

| PayType | Description |
| - | - |
| 800008 | WeChat, Alipay, PayMe, Unionpay Quickpass CPM |
| 800108 | Alipay CPM (Overseas & HK Merchants) |
| 800208 | WeChat CPM (Overseas & HK Merchants) |
| 805808 | PayMe CPM (HK Merchants) |
| 800708 | UNIONPAY Quick Pass CPM |

<Tip>
  Refer to [Signature Generation](/integration/preparation/authentication-and-signature) for request signing instructions.
</Tip>

***

## Request Parameters

| Field | Required | Type | Description |
| - | - | - | - |
| [Common Parameters](/integration/api-reference/request-format#common-payment-request-parameters) | — | — | Includes `mchid`, `txamt`, `txdtm`, etc. |
| `auth_code` | Yes (CPM only) | String(128) | Authorisation code scanned from the customer's wallet barcode. This value is unique per transaction and must be captured in real-time. |

***

## Example Request

```http 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
```

***

## Example Response

```json 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"
}
```

***

## Response Behaviour

`respcd` indicates transaction result:

* `0000` → Payment successful
* `1143` or `1145` → Transaction is still processing

When `1143` or `1145` is returned:

* The customer may still be entering their password
* The wallet provider may still be confirming the payment
* The transaction is **not final**

Merchants should call the [Transaction Enquiry API](/integration/common-api/transaction-enquiry) to retrieve the final status.

***

## Integration Notes

* CPM is synchronous but may return a **processing state** (`1143` / `1145`).
* Always treat `1143` / `1145` as pending, not failure.
* Do not immediately retry a payment if processing is returned.
* Use **Transaction Enquiry** to confirm final status.
* Store the QFPay Transaction ID (`syssn`) for reconciliation.
* Implement idempotency using your `out_trade_no`.

***

## Response Parameters

| Field | Type | Description |
| - | - | - |
| `syssn` | String | QFPay Transaction ID (Payment ID for this transaction) |
| `out_trade_no` | String | Merchant Order Number |
| `respcd` | String | Return Code (`0000` = success) |
| `sysdtm` | String | QFPay system processing time |
| `txdtm` | String | Merchant transaction time |
| `paydtm` | String | Actual payment completion time |
| `chnlsn` | String | Wallet-side transaction reference |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.