Skip to content

API Overview

Updated: 7/26/26, 9:23:52 PM

API Style

  • RESTful with kebab-case naming (e.g., pay-order not payOrder)
  • HTTP-based, JSON request and response bodies

Two-Tier API Architecture

DaxPay exposes two API tiers with different authentication and response formats:

TierPath PrefixAuthenticationResponse ClassUse Case
Payment API/unipay/*RSA signatureDaxResultServer-to-server calls (pay, query, close)
Management API/mch/*Sa-Token sessionResultMerchant web panel operations (refund, list, sync)

Key distinction

Payment API is for merchant backend systems using RSA signature auth (no login session needed). Management API is for the merchant web panel using Accesstoken header (Sa-Token session).

Three Categories under Payment API

/unipay/* is further divided by scenario:

CategoryPath PrefixScenarioDocs
Direct Pay/unipay/pay, /unipay/close, /unipay/query/*, /unipay/sync/*Channel & method already determined by merchant backendPay
Gateway Pay/unipay/gateway/*Platform cashier / aggregate QR selects the methodGateway Pre-pay
Channel Auth/unipay/assist/channel/auth/*Fetch user openId/userId via OAuthGenerate Auth URL

Base URL

http://{your-domain}:{port}

Example: https://your-domain.com (production), local dev default port 9999.

Integration Flow

  1. Register merchant: Get merchant number (mchNo) and application ID (appId).
  2. Configure keys: Generate an RSA key pair; register the merchant public key with the platform; obtain the platform public key for response verification.
  3. Call APIs: Construct requests with signature as defined in this documentation.
  4. Receive callbacks: Configure notifyUrl to receive payment/refund result notifications.

Common Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AccesstokenManagement API onlySa-Token session token (only for /mch/* endpoints; not needed for Payment API /unipay/*)

Signature Mechanism

Payment API (/unipay/*) uses RSA signature authentication. Signature fields are in the request body, not in headers:

FieldLocationDescription
signRequest bodyRSA signature value (Base64)
reqTimeRequest bodyRequest time (yyyy-MM-dd HH:mm:ss, GMT+8)
reqIdRequest bodyUnique request identifier
nonceStrRequest bodyRandom string

See Signature for details.

Response Body (Payment API)

DaxResult structure:

json
{
  "code": 0,
  "msg": "success",
  "data": {},
  "sign": "Base64Signature",
  "resTime": "2024-12-01T12:00:00Z",
  "reqId": "REQ20241201001"
}
FieldTypeDescription
codeintStatus code, 0 = success
msgstringMessage
dataobjectBusiness data
signstringRSA signature of the response (verifiable with platform public key)
resTimestringResponse time (UTC, ISO 8601)
reqIdstringRequest ID (echoed from request)

Field name note

Payment API uses msg field. Management API (Result) uses message.

Conventions

HTTP Method

Payment API endpoints use POST with JSON body. Management API query endpoints use GET, operation endpoints use POST.

Currency

All amount fields are Long in cents (fen), avoiding floating-point precision loss. Example: ¥1.00 → 100.

Status Values

Status fields are String (not numeric), using lowercase semantic codes:

  • Pay status (PayStatusEnum): wait / progress / success / close / cancel / fail / timeout
  • Refund order status (RefundOrderStatusEnum): progress / success / fail / close
  • Refund flag (PayRefundStatusEnum): no_refund / refunding / partial_refund / refunded

Glossary

TermDescription
mchNoMerchant Number
appIdApplication ID
RSA Key PairMerchant generates RSA key pair; public key registered with platform, private key used for signing
methodPayment method, e.g., wechat_qr, alipay_pc (see PayMethodEnum)
productPayment product (see Channel Reference)
orderNoSystem order number
bizOrderNoMerchant business order number
tradeNoTrade number (one order may have multiple trade attempts)

Released under the GNU LGPL v3.0