Skip to content

Gateway Pre-pay

Updated: 7/31/26, 7:21:29 PM

Description

Used in "gateway payment" scenarios: the merchant backend does not pre-select a payment method. Instead, it creates a gateway order and gets an H5 landing URL and a mini-program mapping URL, then routes users to the platform-hosted cashier or aggregate QR page based on their device.

Applies to:

  • Cashier (cashier): platform-hosted multi-method selection page
  • Aggregate QR (aggregate): one code, multi-wallet auto-detection

Request

POST /unipay/gateway/pre-pay

  • Auth: RSA signature (@PaymentVerify)
  • Response: DaxResult<GatewayPrePayResult>

Parameters

Common params same as Pay - Common Parameters. Business parameters:

ParameterTypeRequiredMaxDescription
bizOrderNostringYes100Merchant order number
titlestringYes100Order title
descriptionstringNo50Order description
amountlongYesAmount in cents (min 1, max 9999999999)
gatewayPayTypestringYes32Gateway type: cashier (unified cashier) / aggregate (aggregate QR)
notifyUrlstringNo256Async notification URL
returnUrlstringNo256Sync redirect URL
attachstringNo512Merchant custom data (returned as-is)
extraParamstringNo2048Channel-specific extra params (JSON)
expiredTimestringNoExpiry time (yyyy-MM-dd HH:mm:ss, GMT+8)
storeNostringNo64Store number
goodsDetailobject[]NoGoods detail list

Example

json
{
  "mchNo": "M200000001",
  "appId": "APP001",
  "reqId": "REQ20241201010",
  "reqTime": "2024-12-01 12:00:00",
  "sign": "Base64Signature",
  "bizOrderNo": "ORDER20241201001",
  "title": "Test Product",
  "amount": 100,
  "gatewayPayType": "cashier",
  "notifyUrl": "https://your-domain.com/notify",
  "returnUrl": "https://your-domain.com/return"
}

Response

DaxResult<GatewayPrePayResult>, data fields:

FieldTypeDescription
orderNostringPlatform gateway order number (used for subsequent query/sync)
bizOrderNostringMerchant order number
statusstringBusiness status (GatewayOrderStatusEnum; initial wait_pay)
h5UrlstringH5 landing URL (/cashier/{orderNo} for cashier, /aggregate/{orderNo} for aggregate)
miniUrlstringMini-program mapping URL (/cm/{orderNo} for cashier, /am/{orderNo} for aggregate); launched through a platform normal-link QR rule
expiredTimestringExpiry time (UTC)

Example

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "orderNo": "G2024120112345700001",
    "bizOrderNo": "ORDER20241201001",
    "status": "wait_pay",
    "h5Url": "https://your-domain.com/cashier/G2024120112345700001",
    "miniUrl": "https://your-domain.com/cm/G2024120112345700001",
    "expiredTime": "2024-12-01T04:30:00Z"
  },
  "sign": "Base64Signature",
  "resTime": "2024-12-01T04:00:00Z",
  "reqId": "REQ20241201010"
}

Next Steps

  1. Merchant backend returns h5Url and miniUrl to frontend; browsers use h5Url, while mini-program normal-link QR codes use miniUrl.
  2. cashier maps /cm/{orderNo} to the unified cashier mini-program; aggregate maps /am/{orderNo} to the aggregate mini-program.
  3. After the user pays on the gateway page, the platform notifies the merchant via notifyUrl (event pay.success).
  4. Merchant may also actively query order status via Gateway Query.

Configure normal-link QR rules in the WeChat Mini Program backend:

  • /cm/*pages-weixin/gateway-cashier/index (unified cashier mini-program)
  • /am/*pages-weixin/aggregate-pay/index (aggregate payment mini-program)

When entering from a normal-link QR code, WeChat places the complete URL in options.q; the pages extract the platform gateway order number from /cm/{orderNo} or /am/{orderNo}.

Released under the GNU LGPL v3.0