EasyPay Integration
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:
| Version | Path Prefix | Signature | Capabilities |
|---|---|---|---|
| V1 (legacy) | /epay/api/v1/* | Fixed MD5 | Only 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_typeis fixed toRSAand does not acceptMD5 - V1's
sign_typeis fixed toMD5and does not acceptRSA - 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
| Endpoint | Path | Method | Description |
|---|---|---|---|
| Create | /epay/api/v2/api/pay/create | GET/POST | Create EasyPay order |
| Query | /epay/api/v2/api/pay/query | GET/POST | Query order status |
| Refund | /epay/api/v2/api/pay/refund | GET/POST | Initiate refund |
| Refund Query | /epay/api/v2/api/pay/refund_query | GET/POST | Query refund status |
| Close | /epay/api/v2/api/pay/close | GET/POST | Close 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
| pid | string | Yes | EasyPay merchant number (maps to mchNo) |
| type | string | Yes | Interface type: web (redirect) / jump (direct to channel) / jsapi |
| method | string | No | Payment method: alipay / wxpay, etc. |
| out_trade_no | string | Yes | Merchant order number (maps to bizOrderNo) |
| name | string | Yes | Product name (maps to title) |
| money | string | Yes | Amount, in yuan (e.g., "1.00") |
| timestamp | string | Yes | Current timestamp (seconds) |
| notify_url | string | No | Async notification URL |
| return_url | string | No | Sync redirect URL |
| sign | string | Yes | RSA signature (Base64) |
| sign_type | string | Yes | Fixed RSA |
Example Response
{
"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
| Parameter | Type | Required | Description |
|---|---|---|---|
| pid | string | Yes | EasyPay merchant number |
| out_trade_no | string | Yes | Merchant order number |
| sign | string | Yes | RSA signature |
| sign_type | string | Yes | Fixed RSA |
Example Response
{
"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
| Parameter | Type | Required | Description |
|---|---|---|---|
| pid | string | Yes | EasyPay merchant number |
| out_trade_no | string | Yes | Original merchant order number |
| money | string | Yes | Refund amount, in yuan |
| out_refund_no | string | No | Merchant refund number (auto-generated if omitted) |
| sign | string | Yes | RSA signature |
| sign_type | string | Yes | Fixed RSA |
V2 Signature Rule (RSA)
- Collect all non-empty params, excluding
signandsign_type. - Sort by key in ASCII order.
- Join as
key1=value1&key2=value2(no separator, no&key=suffix). - Sign with merchant private key using
SHA256withRSA, Base64-encode, fill intosign.
Differences from standard Payment API signature
- Standard API (
/unipay/*): camelCase param names (bizOrderNo), includesreqTime/nonceStrin signature - EasyPay V2: snake_case param names (
out_trade_no), includestimestamp, and excludessign_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:
| Endpoint | Path | Method |
|---|---|---|
| Submit (redirect) | /epay/api/v1/submit.php | GET/POST |
| Create (API) | /epay/api/v1/mapi.php | GET/POST |
| Query | /epay/api/v1/api.php | GET/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=md5Keycomparison (query param), entirely different from V2's RSA verification — use only in low-risk scenarios.
V1 MD5 Signature Rule
- Collect all non-empty params, excluding
signandsign_type. - Sort by key in ASCII order, join as
key1=value1&key2=value2. - Append merchant key at end:
...&key={md5Key}(or directly appended per implementation). - 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.