Pay
Description
Create a payment order. The system returns a payment payload (payBody) that the merchant frontend uses to invoke payment or display a QR code.
Use this endpoint when the merchant backend has already determined the channel and payment method. For platform-hosted cashier or aggregate QR scenarios, use Gateway Pre-pay instead.
Request
POST /unipay/pay
- Auth: RSA signature (
@PaymentVerify) - Response:
DaxResult<NormalPayResult>
Parameters
Common Parameters (shared by all /unipay/* endpoints)
Inherited from PaymentCommonParam / MerchantPaymentCommonParam:
| Parameter | Type | Required | Max | Description |
|---|---|---|---|---|
| mchNo | string | Yes | 32 | Merchant number |
| appId | string | No | 32 | Application ID |
| channelMchNo | string | No | 32 | Channel merchant number (for debugging or direct channel routing; leave empty for normal routing) |
| reqId | string | Yes | 64 | Unique request ID |
| nonceStr | string | No | 32 | Random string |
| sign | string | Yes | 1024 | RSA signature (Base64) |
| reqTime | string | Yes | — | Request time (yyyy-MM-dd HH:mm:ss, GMT+8) |
| clientIp | string | No | 64 | Client IP |
Business Parameters
| Parameter | Type | Required | Max | Description |
|---|---|---|---|---|
| bizOrderNo | string | Yes | 100 | Merchant order number (unique in merchant system) |
| title | string | Yes | 100 | Order title |
| description | string | No | 50 | Order description |
| amount | long | Yes | — | Amount in cents (min 1, max 9999999999) |
| product | string | No | 32 | Payment product code (auto-routed when empty) |
| method | string | No | 32 | Payment method, e.g., wechat_qr, alipay_pc (see table below) |
| capability | string | No | 32 | Payment capability code (used as input when channel is directly specified) |
| openId | string | No | 128 | User identifier (required for WeChat jsapi/mini) |
| channelAppId | string | No | 128 | Channel App ID (forces use if non-empty, must be pre-configured) |
| authCode | string | No | 128 | Authorization code (required for barcode/merchant-scan) |
| limitPay | string[] | No | 10 | Restrict payment methods (e.g., no_credit to disable credit cards) |
| extraParam | string | No | 2048 | Channel-specific extra params (JSON) |
| goodsDetail | object[] | No | 50 | Order goods detail list (for item-level marketing, e-invoice, etc.) |
| notifyUrl | string | No | 200 | Async notification URL |
| returnUrl | string | No | 200 | Sync redirect URL |
| attach | string | No | 500 | Custom data (returned as-is in callback) |
| expiredTime | string | No | — | Order expiry time (yyyy-MM-dd HH:mm:ss, GMT+8; defaults to 30 min) |
| terminal | object | No | — | Terminal info (offline POS/cashier scenarios) |
When is method required?
Generally required when routing via channel. For merchant-scan (barcode) it can be omitted — pass only authCode and the platform identifies the wallet by prefix. When channelMchNo + capability are directly specified, it can be inferred from capability.
Example
{
"mchNo": "M200000001",
"appId": "APP001",
"reqId": "REQ20241201001",
"nonceStr": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
"reqTime": "2024-12-01 12:00:00",
"sign": "Base64Signature",
"bizOrderNo": "ORDER20241201001",
"title": "Test Product",
"amount": 100,
"method": "wechat_qr",
"notifyUrl": "https://your-domain.com/notify",
"returnUrl": "https://your-domain.com/return"
}Response
DaxResult<NormalPayResult>, data fields:
| Field | Type | Description |
|---|---|---|
| orderId | long | Order ID |
| bizOrderNo | string | Merchant order number |
| orderNo | string | Platform order number |
| tradeNo | string | Fund trade number |
| status | string | Payment status (PayStatusEnum) |
| payBody | string | Payment payload (QR content, SDK params, or redirect URL) |
| payBodyType | string | Payload type (PayBodyTypeEnum) |
payBodyType Values
Maps to backend enum PayBodyTypeEnum:
| Type | Description | payBody Example |
|---|---|---|
link | Payment link (redirect) | https://open.weixin.qq.com/... |
jsapi | JSAPI invocation params | JSON string for frontend SDK |
from | Form data (auto-submit HTML) | <form action="...">...</form> |
identifier | Identifier code (barcode scenarios) | Plain identifier string from channel |
qr_code | QR code content (frontend renders to image) | weixin://wxpay/bizpayurl?pr=xxxxx |
json | JSON object (channel-specific structure) | Channel-defined JSON string |
Difference from old docs
Old documentation used code_url / pay_info / redirect_url — these are not real enum values. Refer to the table above.
Example
{
"code": 0,
"msg": "success",
"data": {
"orderId": 1853123456789012345,
"bizOrderNo": "ORDER20241201001",
"orderNo": "P2024120112345700001",
"tradeNo": "T2024120112345700001",
"status": "progress",
"payBody": "weixin://wxpay/bizpayurl?pr=xxxxx",
"payBodyType": "qr_code"
},
"sign": "Base64Signature",
"resTime": "2024-12-01T04:00:00Z",
"reqId": "REQ20241201001"
}Payment Methods (method)
method maps to PayMethodEnum, grouped by wallet:
WeChat Pay
| method | Description |
|---|---|
| wechat_qr | WeChat Native (QR scan) |
| wechat_jsapi | WeChat JSAPI (Official Account) |
| wechat_mini | WeChat Mini Program |
| wechat_h5 | WeChat H5 |
| wechat_app | WeChat App |
| wechat_barcode | WeChat Barcode (merchant scan) |
| wechat_cashier | WeChat Cashier |
Alipay
| method | Description |
|---|---|
| alipay_qr | Alipay QR scan |
| alipay_jsapi | Alipay JSAPI (incl. Mini Program) |
| alipay_pc | Alipay PC Web |
| alipay_h5 | Alipay H5 |
| alipay_app | Alipay App |
| alipay_barcode | Alipay Barcode (merchant scan) |
UnionPay
| method | Description |
|---|---|
| union_qr | UnionPay QR scan |
| union_jsapi | UnionPay JSAPI |
| union_h5 | UnionPay H5 |
| union_barcode | UnionPay Barcode (merchant scan) |
Douyin Pay
| method | Description |
|---|---|
| douyin_qr | Douyin QR scan |
| douyin_jsapi | Douyin JSAPI |
| douyin_h5 | Douyin H5 |
| douyin_app | Douyin App |
Aggregate
| method | Description |
|---|---|
| aggregate_pay_qrcode | Aggregate QR payment (native one-code-multi-pay) |
International Cards (reserved)
| method | Description |
|---|---|
| visa_card_gateway | Visa gateway |
| visa_card_present | Visa present |
| mastercard_card_gateway | Mastercard gateway |
| mastercard_card_present | Mastercard present |
Pay Status (PayStatusEnum)
| status | Description |
|---|---|
| wait | Waiting (no channel/method assigned) |
| progress | Processing (channel call initiated) |
| success | Payment successful |
| close | Closed |
| cancel | Cancelled |
| fail | Failed |
| timeout | Timed out |