Skip to content

EasyPay Integration

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

Overview

EasyPay is DaxPay's built-in payment module compatible with mainstream EasyPay protocols, suitable for small merchants and individual developers.

DaxPay provides two API versions:

VersionPath PrefixSignatureCapabilities
V1 (legacy)/epay/api/v1/*Fixed MD5Only create (submit/mapi) + query (api); no refund/close
V2 (recommended)/epay/api/v2/api/pay/*Fixed RSA (SHA256withRSA)Create, query, refund, refund query, close

Signatures are not interchangeable across versions

  • V2's sign_type is fixed to RSA and does not accept MD5
  • V1's sign_type is fixed to MD5 and does not accept RSA
  • There is no "V2 chooses MD5 or RSA" — that's a misconception

Amount unit differs from standard API

EasyPay uses money (String, in yuan) for the amount field, not the standard API's amount (Long, in cents). E.g., "1.00" means 1 yuan.

V2 Endpoints

EndpointPathMethodDescription
Create/epay/api/v2/api/pay/createGET/POSTCreate EasyPay order
Query/epay/api/v2/api/pay/queryGET/POSTQuery order status
Refund/epay/api/v2/api/pay/refundGET/POSTInitiate refund
Refund Query/epay/api/v2/api/pay/refund_queryGET/POSTQuery refund status
Close/epay/api/v2/api/pay/closeGET/POSTClose order

refund_query alias

Refund query accepts both /api/pay/refund_query (underscore) and /api/pay/refundquery (no underscore) for compatibility with different EasyPay implementations.

V2 Create

Request

GET/POST /epay/api/v2/api/pay/create

Field names follow EasyPay protocol's snake_case style:

ParameterTypeRequiredDescription
pidstringYesEasyPay merchant number (maps to mchNo)
typestringYesInterface type: web (redirect) / jump (direct to channel) / jsapi
methodstringNoPayment method: alipay / wxpay, etc.
out_trade_nostringYesMerchant order number (maps to bizOrderNo)
namestringYesProduct name (maps to title)
moneystringYesAmount, in yuan (e.g., "1.00")
timestampstringYesCurrent timestamp (seconds)
notify_urlstringNoAsync notification URL
return_urlstringNoSync redirect URL
signstringYesRSA signature (Base64)
sign_typestringYesFixed RSA

Example Response

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "orderId": 1853123456789012345,
    "orderNo": "P2024120112345700001",
    "payBody": "weixin://wxpay/bizpayurl?pr=xxxxx",
    "payBodyType": "qr_code"
  }
}

V2 Query

Request

GET/POST /epay/api/v2/api/pay/query

ParameterTypeRequiredDescription
pidstringYesEasyPay merchant number
out_trade_nostringYesMerchant order number
signstringYesRSA signature
sign_typestringYesFixed RSA

Example Response

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "orderNo": "P2024120112345700001",
    "status": "success",
    "realAmount": 100,
    "payTime": "2024-12-01 12:00:00"
  }
}

V2 Refund

Request

GET/POST /epay/api/v2/api/pay/refund

ParameterTypeRequiredDescription
pidstringYesEasyPay merchant number
out_trade_nostringYesOriginal merchant order number
moneystringYesRefund amount, in yuan
out_refund_nostringNoMerchant refund number (auto-generated if omitted)
signstringYesRSA signature
sign_typestringYesFixed RSA

V2 Signature Rule (RSA)

  1. Collect all non-empty params, excluding sign and sign_type.
  2. Sort by key in ASCII order.
  3. Join as key1=value1&key2=value2 (no separator, no &key= suffix).
  4. Sign with merchant private key using SHA256withRSA, Base64-encode, fill into sign.
Differences from standard Payment API signature
  • Standard API (/unipay/*): camelCase param names (bizOrderNo), includes reqTime/nonceStr in signature
  • EasyPay V2: snake_case param names (out_trade_no), includes timestamp, and excludes sign_type

Verification uses the platform public key, same as Signature.

V1 Endpoints (Legacy)

V1 endpoints are compatible with traditional EasyPay protocol paths. MD5 signature only:

EndpointPathMethod
Submit (redirect)/epay/api/v1/submit.phpGET/POST
Create (API)/epay/api/v1/mapi.phpGET/POST
Query/epay/api/v1/api.phpGET/POST

V1 Limitations

  • Create & query only: V1 does not provide refund, refund query, or close endpoints. For refunds use V2 or the merchant Management API.
  • MD5 signature fixed: sign_type=MD5; uses merchant MD5 key appended at the end, then MD5 hash (lowercase hex).
  • Weak query auth: V1 query uses direct key=md5Key comparison (query param), entirely different from V2's RSA verification — use only in low-risk scenarios.

V1 MD5 Signature Rule

  1. Collect all non-empty params, excluding sign and sign_type.
  2. Sort by key in ASCII order, join as key1=value1&key2=value2.
  3. Append merchant key at end: ...&key={md5Key} (or directly appended per implementation).
  4. MD5 the entire string, output lowercase hex.

Async Callback

EasyPay orders use protocol=easy_pay (GET + URL query params), different from the standard system protocol (POST JSON). See Async Callback - Two Notification Protocols.

Released under the GNU LGPL v3.0