Skip to content

回调通知商户

支付回调

通知方式

POST 请求

请求头

字段名类型必传描述
content-typestringapplication/json
x-api-keystringPaydify提供,跟appId相同
x-api-timestampstring时间戳,单位毫秒
x-api-signaturestring签名,具体参看签名算法

请求体

字段名类型描述
appIdstringPaydify提供
txnIdstringPaydify侧的支付订单 ID
mchTxnIdstring商户侧的订单 ID
txnHashstring链上的交易 hash
txnAmountstring支付订单金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT
paidAmountstring实际支付金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT
mchReceivedAmountstring商户应该收到的金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT
mchFeestringPaydify收取的手续费,假如币种 currency 是 USDT,则 0.23 表示 0.23USDT
currencystring支付币种
statestring支付状态,枚举值参看支付状态
notifyTypestring通知类型,固定值 payment
fromAddressstring付款地址
paidTimeint支付成功的时间戳,单位毫秒,只有支付成功才有值
failedTimeint支付失败的时间戳,单位毫秒,只有支付失败/超时才有值

返回值

Paydify只能识别以下两种纯文本的返回值

  • success
  • fail

    如果返回其他值,则会发起最多 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-typestringapplication/json
x-api-keystringPaydify提供,跟appId相同
x-api-timestampstring时间戳,单位毫秒
x-api-signaturestring签名,具体参看签名算法

请求体

字段名类型描述
appIdstringPaydify提供
txnIdstringPaydify侧的退款订单 ID
mchTxnIdstring商户侧的退款订单 ID
txnHashstring链上的交易 hash
txnAmountstring退款金额,假如币种 currency 是 USDT,则 1.23 表示 1.23USDT
currencystring退款币种
statestring退款状态,枚举值: refunded(成功), failed(失败)
notifyTypestring通知类型,固定值 refund
refundedTimeint退款成功的时间戳,单位毫秒,只有退款成功才有值
failedTimeint退款失败的时间戳,单位毫秒,只有退款失败才有值

返回值

Paydify只能识别以下两种纯文本的返回值

  • success
  • fail

    如果返回其他值,则会发起最多 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 重试。

请求序号时间延迟说明
00第 1 次正常回调,立即执行,无延迟
115 秒后第 1 次重试
245 秒后第 2 次重试
390 秒后第 3 次重试
43 分钟后第 4 次重试
510 分钟后第 5 次重试
630 分钟后第 6 次重试
760 分钟后第 7 次重试
83 小时后第 8 次重试
96 小时后第 9 次重试
1012 小时后第 10 次重试