处理要求
对于每一笔收到的回调,你都必须:- Verify the signature first — See 认证与安全 for signature verification details
- 解析业务数据 并进行幂等处理
- 返回约定的成功响应
触发与重试机制
Trigger 当订单状态发生变化(如支付成功、超时、取消、关闭或异常)时,GatePay 会向你配置的回调地址发送通知。 Retry 如果你未返回约定的成功响应,或请求超时,GatePay 会按规则重试回调。 Signature Verification You must verify all 回调 signatures before processing. See 认证与安全 for details.回调 Message Structure
All 回调 contain the following top-level fields:| 字段 | 类型 | 说明 |
|---|---|---|
| biz类型 | string | 通知 category (see biz类型 Enumeration) |
| bizId | string | Order ID or business ID |
| biz状态 | string | Business status (varies by biz类型) |
| client_id | string | 商户 client_id |
| data | string | Business payload as a JSON string; structure varies by biz类型 |
回调 Acknowledgement 响应
Return the following JSON response with HTTP 200:biz类型 Enumeration
| Value | 说明 |
|---|---|
| PAY | 状态 change for non-address payment 订单s |
| PAY_REFUND | 状态 change for re资金 订单s |
| PAY_BATCH | 状态 change for batch reward 订单s |
| PAY_GIFT_BATCH | 状态 change for batch gift-card payments |
| PAY_ADDRESS | 状态 change for address payment 订单s |
| TRANSFER_ADDRESS | Funds-flow 通知 for address payments |
| PAY_FIXED_ADDRESS | Static-address collection 通知 |
| WITHDRAW | Withdrawal / 出款 status change |
| INSTITUTION | 机构 API account-related 通知 |
托管收银台 Payment 通知
Hosted checkout payments follow the generalPAY 回调 model. For non-address payments, interpret the payment amount using orderAmount. For more details on payment integrations, see 支付.
Address Payment 通知
PAY_ADDRESS 状态 Enumeration
| 状态 | Applicable Mode | 说明 |
|---|---|---|
| PAY_SUCCESS | Non-convert / Convert | Payment succeeded |
| PAY_ERROR | Non-convert / Convert | Payment failed |
| PAY_CLOSE | Non-convert / Convert | Order closed |
| PAY_EXPIRED_IN_PROCESS | Non-convert / Convert | Target amount reached within validity period, but still unconfirmed on-chain records |
| PENDING | Convert | Pending |
| PROCESS | Convert | Processing |
| PAID | Convert | Paid |
| EXPIRED | Convert | Expired |
PAY_ADDRESS data 字段
| 字段 | Applicable Mode | 说明 |
|---|---|---|
| 商户TradeNo | Non-convert / Convert | 商户 订单 number |
| product类型 | Non-convert / Convert | Product type |
| productName | Non-convert / Convert | Product name |
| goodsName | Non-convert / Convert | Goods name |
| trade类型 | Non-convert / Convert | Transaction type |
| terminal类型 | Non-convert / Convert | Terminal type |
| currency | Non-convert / Convert | Pricing currency |
| 订单Amount | Non-convert / Convert | Order amount |
| payerId | Non-convert / Convert | Payer identifier |
| createTime | Non-convert / Convert | Creation time |
| 交易Id | Non-convert / Convert | Platform 交易 ID |
| waitAmountOnChain | Non-convert / Convert | On-chain amount detected but not yet finally credited |
| doneAmountOnChain | Non-convert / Convert | On-chain amount already confirmed and credited |
| channelId | Non-convert / Convert | Channel identifier |
| chain | Non-convert / Convert | Chain name |
| address | Non-convert / Convert | 收款 address |
| fromAddress | Non-convert / Convert | Payer address |
| pay币种 | Convert | Payment currency used for conversion |
| payAmount | Convert | Payment amount used for conversion |
| rate | Convert | Exchange rate |
| overPay | Convert | Overpayment amount |
TRANSFER_ADDRESS 状态 Enumeration
| 状态 | 说明 |
|---|---|
| TRANSFERRED_ADDRESS_IN_TERM | Credited within the validity period |
| TRANSFERRED_ADDRESS_DELAY | Credited after the validity period |
| CONVERT_ADDRESS_PAY_DELAY | Convert delayed-payment 通知 only; no credit |
| TRANSFERRED_ADDRESS_BLOCK | Risk-controlled 资金; not credited |
TRANSFER_ADDRESS data 字段
| 字段 | 说明 |
|---|---|
| 商户TradeNo | 商户 订单 number |
| currency | 币种 |
| 订单Amount | Order amount |
| createTime | Creation time |
| 交易Id | Platform 交易 ID |
| transferAmount | On-chain transfer amount |
| txHash | Blockchain 交易 hash |
| chain | Chain name |
| address | Address |
| channelId | Channel identifier |
Static Address 收款 通知
biz类型:PAY_FIXED_ADDRESS
biz状态: PAY_SUCCESS (credit succeeded) or PAY_BLOCK (risk 资金, not credited)
data 字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| channelId | string | Yes | Channel identifier |
| currency | string | Yes | 币种 |
| 订单Amount | string | No | Order amount |
| amount | string | Yes | Actual credited amount |
| createTime | number | Yes | Creation time (milliseconds) |
| 交易Id | string | Yes | Platform 交易 ID |
| 交易Time | number | Yes | Transaction time (milliseconds) |
| chain | string | Yes | Chain name |
| address | string | Yes | 收款 address |
Withdrawal / 出款 回调
For 提现 and 出款 operations, see 出款 for detailed 回调 structures and field descriptions. biz类型:WITHDRAW
Main Order 字段
| 字段 | 必填 | 说明 |
|---|---|---|
| batch_id | Yes | Batch ID |
| 商户_id | Yes | 商户 ID |
| status | Yes | INIT / PROCESSING / PARTIAL / FAIL / SUCCESS |
| client_id | Yes | client_id used to create the batch |
| pay_back_status | Yes | Rollback status |
| channel_id | Yes | Channel identifier |
Sub-订单 字段
| 字段 | 必填 | 说明 |
|---|---|---|
| sub订单_id | Yes | Sub-订单 ID |
| chain | Yes | Chain |
| address | Yes | Address |
| currency | Yes | 币种 |
| amount | Yes | Amount |
| fee | Yes | Fee |
| txHash | Yes | Transaction hash |
| status | Yes | DONE / FAIL |
| 商户_withdraw_id | Yes | 商户 提现 ID |
| fee_type | Yes | 0=internal deduction; 1=external deduction |
| finish_time | Yes | Completion time |
| sub_amount | Yes | Total sub-订单 amount |
| done_amount | Yes | Actually completed amount |
机构 API 回调
biz类型:INSTITUTION
biz状态: INSTITUTION_ACCOUNT_SUCCESS or INSTITUTION_ACCOUNT_FAIL
For institution account-related 通知, see Institutional API.
data 字段 (JSON string)
| 字段 | 说明 |
|---|---|
| request_id | 请求 identifier |
| account_id | Account ID |
| customer_id | Customer ID |
| display_name | Account display name |
| status | ACTIVE or FAIL |
| created | Timestamp in milliseconds |
回调 Integration Guide
Integration Requirements
| Item | Recommendation |
|---|---|
| 接口 | Use a dedicated path such as /webhook/gatepay |
| Protocol | HTTPS with TLS 1.2+ |
| Processing Strategy | Verify signature → store idempotently → process business 异步ly → return SUCCESS |
| Signature Verification | Never return SUCCESS if signature verification fails |
| data Parsing | The data field is a JSON string and requires secondary parsing |
| Duplicate 处理方式 | Support duplicate 通知 using idempotent processing |
Recommended Processing Flow
- Receive the 回调 request
- Verify the signature using the 商户 secret key (see 认证与安全)
- Extract and parse the
datafield (JSON string → object) - Check 幂等性 key (e.g., 交易Id or 商户TradeNo)
- Store the 通知 durably before processing
- Process the business logic 异步ly
- Return
{"returnCode": "SUCCESS", "returnMessage": ""}with HTTP 200
Related Documentation
- 认证与安全 — Signature verification and security practices
- 支付 — Payment 回调 details
- 出款 — 出款 回调 details
- Institutional API — Institution 回调 details

