Skip to content

Getting Started

Updated: 7/26/26, 6:55:04 PM

Steps

1. Register Merchant

Contact DaxPay operator to register and obtain:

ParameterDescription
mchNoMerchant number
appIdApplication ID

2. Generate RSA Key Pair

DaxPay Payment API uses RSA asymmetric encryption for signing. Generate an RSA key pair (2048-bit recommended):

  • Merchant private key: Stored on merchant server, used to sign requests
  • Merchant public key: Registered with DaxPay platform for request verification
  • Platform public key: Obtained from platform, used to verify responses/callbacks

Key Security

The private key is sensitive — never commit it to version control. Use environment variables or a secure config center.

3. Environment

EnvironmentBase URL
Sandboxhttps://sandbox.daxpay.cn (no real funds)
Productionhttps://your-domain.com

Test in sandbox first, then switch to production.

4. First Call

1) Construct request

json
{
  "mchNo": "M200000001",
  "appId": "APP001",
  "reqId": "REQ20241201001",
  "nonceStr": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS",
  "reqTime": "2024-12-01 12:00:00",
  "bizOrderNo": "ORDER20241201001",
  "title": "Test Product",
  "amount": 100,
  "method": "wechat_qr",
  "notifyUrl": "https://your-domain.com/notify",
  "returnUrl": "https://your-domain.com/return"
}

2) Sign the request

Sort fields (excluding sign) by key in ASCII order, join as key=value&key=value, sign with merchant private key using SHA256withRSA, Base64-encode, and set the sign field.

See Signature for details.

3) Send request

http
POST /unipay/pay HTTP/1.1
Host: your-domain.com
Content-Type: application/json

{
  "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"
}

4) Handle response

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "orderId": 1853123456789012345,
    "bizOrderNo": "ORDER20241201001",
    "orderNo": "P2024120112345700001",
    "tradeNo": "T2024120112345700001",
    "status": "progress",
    "payBody": "weixin://wxpay/bizpayurl?pr=xxxxx",
    "payBodyType": "code_url"
  },
  "sign": "Base64Signature",
  "resTime": "2024-12-01T04:00:00Z",
  "reqId": "REQ20241201001"
}
  • data.payBody: Payment payload (QR code URL, SDK invocation params, or redirect URL)
  • data.payBodyType: Payload type (code_url, pay_info, redirect_url)
  • sign: RSA signature verifiable with platform public key

Security

  • HTTPS: Required in production
  • Key management: Store private key securely, never commit to repos
  • Sign & verify: Sign requests, verify responses/callbacks
  • Callback verification: Always verify signature before processing business logic
  • Replay protection: Use unique reqId and nonceStr for each request

FAQ

Q: Signature verification failed?

Check parameter sorting (ASCII order), string format (key=value&key=value), and that the correct key is used (merchant private key for signing, platform public key for verification).

Q: Request rejected?

Ensure all required fields are present: mchNo, appId, reqId, reqTime, sign, plus business parameters.

Released under the GNU LGPL v3.0