回调通知商户
支付回调
通知方式
POST 请求
请求头
| 字段名 | 类型 | 必传 | 描述 |
|---|---|---|---|
| content-type | string | 是 | application/json |
| x-api-key | string | 是 | Paydify提供,跟appId相同 |
| x-api-timestamp | string | 是 | 时间戳,单位毫秒 |
| x-api-signature | string | 是 | 签名,具体参看签名算法 |
请求体
| 字段名 | 类型 | 描述 |
|---|---|---|
| appId | string | Paydify提供 |
| txnId | string | Paydify侧的支付订单 ID |
| mchTxnId | string | 商户侧的订单 ID |
| txnHash | string | 链上的交易 hash |
| txnAmount | string | 支付订单金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT |
| paidAmount | string | 实际支付金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT |
| mchReceivedAmount | string | 商户应该收到的金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT |
| mchFee | string | Paydify收取的手续费,假如币种 currency 是 USDT,则 0.23 表示 0.23USDT |
| currency | string | 支付币种 |
| state | string | 支付状态,枚举值参看支付状态 |
| notifyType | string | 通知类型,固定值 payment |
| fromAddress | string | 付款地址 |
| paidTime | int | 支付成功的时间戳,单位毫秒,只有支付成功才有值 |
| failedTime | int | 支付失败的时间戳,单位毫秒,只有支付失败/超时才有值 |
返回值
Paydify只能识别以下两种纯文本的返回值
successfail如果返回其他值,则会发起最多 10 次重试
请求示例
shell
curl -X POST '{endpoint}' \
-H 'content-type: application/json' \
-H 'x-api-key: xxx' \
-H 'x-api-timestamp: 121212121' \
-H 'x-api-signature: xxxx' \
-d '{
"appId": "A14456006",
"txnId": "P4687529510003120897",
"mchTxnId": "DCS20250905175704ICVAa11111211",
"currency": "USDC",
"state": "paid",
"txnHash": "0xf12b4e7aec3a19e8ccff31421b05f3830f23bf5a666e174542d9659a043b1df1",
"fromAddress": "0xa123Afb8d31503eeee49566F9F77E4d4071B7d5f",
"notifyType": "payment",
"paidAmount": "0.22",
"mchReceivedAmount": "0.22",
"mchFee": "0",
"txnAmount": "0.22",
"paidTime": 1757328167000,
"failedTime": 0
}'curl -X POST '{endpoint}' \
-H 'content-type: application/json' \
-H 'x-api-key: xxx' \
-H 'x-api-timestamp: 121212121' \
-H 'x-api-signature: xxxx' \
-d '{
"appId": "A14456006",
"txnId": "P4687529510003120897",
"mchTxnId": "DCS20250905175704ICVAa11111211",
"currency": "USDC",
"state": "paid",
"txnHash": "0xf12b4e7aec3a19e8ccff31421b05f3830f23bf5a666e174542d9659a043b1df1",
"fromAddress": "0xa123Afb8d31503eeee49566F9F77E4d4071B7d5f",
"notifyType": "payment",
"paidAmount": "0.22",
"mchReceivedAmount": "0.22",
"mchFee": "0",
"txnAmount": "0.22",
"paidTime": 1757328167000,
"failedTime": 0
}'退款回调
通知方式
POST 请求
请求头
| 字段名 | 类型 | 必传 | 描述 |
|---|---|---|---|
| content-type | string | 是 | application/json |
| x-api-key | string | 是 | Paydify提供,跟appId相同 |
| x-api-timestamp | string | 是 | 时间戳,单位毫秒 |
| x-api-signature | string | 是 | 签名,具体参看签名算法 |
请求体
| 字段名 | 类型 | 描述 |
|---|---|---|
| appId | string | Paydify提供 |
| txnId | string | Paydify侧的退款订单 ID |
| mchTxnId | string | 商户侧的退款订单 ID |
| txnHash | string | 链上的交易 hash |
| txnAmount | string | 退款金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT |
| currency | string | 退款币种 |
| state | string | 退款状态,枚举值: refunded(成功), failed(失败) |
| notifyType | string | 通知类型,固定值 refund |
| refundedTime | int | 退款成功的时间戳,单位毫秒,只有退款成功才有值 |
| failedTime | int | 退款失败的时间戳,单位毫秒,只有退款失败才有值 |
返回值
Paydify只能识别以下两种纯文本的返回值
successfail如果返回其他值,则会发起最多 10 次重试
请求示例
shell
curl -X POST '{endpoint}' \
-H 'content-type: application/json' \
-H 'x-api-key: xxx' \
-H 'x-api-timestamp: 121212121' \
-H 'x-api-signature: xxxx' \
-d '{
"appId": "A14456006",
"txnId": "R4687326023007356672",
"mchTxnId": "DCS20250905175704ICVAa1111",
"currency": "USDC",
"state": "refunded",
"txnHash": "0xb2e811b1e6d40f11275378ce55c03427b79e94ea9f9edadb7a6c2e286ce474ad",
"notifyType": "refund",
"txnAmount": "0.11",
"failedTime": 0,
"refundedTime": 1757315967000
}'curl -X POST '{endpoint}' \
-H 'content-type: application/json' \
-H 'x-api-key: xxx' \
-H 'x-api-timestamp: 121212121' \
-H 'x-api-signature: xxxx' \
-d '{
"appId": "A14456006",
"txnId": "R4687326023007356672",
"mchTxnId": "DCS20250905175704ICVAa1111",
"currency": "USDC",
"state": "refunded",
"txnHash": "0xb2e811b1e6d40f11275378ce55c03427b79e94ea9f9edadb7a6c2e286ce474ad",
"notifyType": "refund",
"txnAmount": "0.11",
"failedTime": 0,
"refundedTime": 1757315967000
}'回调重试机制
回调如果拿不到预期的返回值success,则会按照以下策略进行最多 10 重试。
| 请求序号 | 时间延迟 | 说明 |
|---|---|---|
| 0 | 0 | 第 1 次正常回调,立即执行,无延迟 |
| 1 | 15 秒后 | 第 1 次重试 |
| 2 | 45 秒后 | 第 2 次重试 |
| 3 | 90 秒后 | 第 3 次重试 |
| 4 | 3 分钟后 | 第 4 次重试 |
| 5 | 10 分钟后 | 第 5 次重试 |
| 6 | 30 分钟后 | 第 6 次重试 |
| 7 | 60 分钟后 | 第 7 次重试 |
| 8 | 3 小时后 | 第 8 次重试 |
| 9 | 6 小时后 | 第 9 次重试 |
| 10 | 12 小时后 | 第 10 次重试 |