Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gate.com/llms.txt

Use this file to discover all available pages before exploring further.

Processing Requirements

For every callback received, you must:
  1. Verify the signature first — See Authentication and Security for signature verification details
  2. Parse the business data and perform idempotent processing
  3. Return the agreed success response
Since the same business event may be delivered more than once, you must implement idempotency using a business-unique identifier. To reduce the risk of duplicate processing, premature final-state decisions, or incorrect fund posting, process callbacks in the following order:
  1. Validate headers and verify the signature
  2. Parse bizType, bizId, and bizStatus
  3. Run idempotency checks on the business-unique identifier
  4. Update local business state
  5. Return the success response
  6. Use query APIs for final confirmation on critical fund events
For payment, OTC, payout, and other fund-related flows, callbacks should usually be treated as the primary event source, while final confirmation for critical outcomes should still be verified through the relevant query APIs.

Trigger and Retry Mechanism

Trigger When the order status changes (payment success, timeout, cancellation, closure, or exception), GatePay sends a notification to your configured callback URL. Retry If you do not return the agreed success response or the request times out, GatePay will retry the callback. Signature Verification You must verify all callback signatures before processing. See Authentication and Security for details.

Callback Message Structure

All callbacks contain the following top-level fields:
FieldTypeDescription
bizTypestringNotification category (see bizType Enumeration)
bizIdstringOrder ID or business ID
bizStatusstringBusiness status (varies by bizType)
client_idstringMerchant client_id
datastringBusiness payload as a JSON string; structure varies by bizType
Example Callback:
{
  "bizType": "PAY",
  "bizId": "6948484859590",
  "bizStatus": "PAY_SUCCESS",
  "client_id": "cdhu-fgrfg44-5ggd-cdvsa",
  "data": "{\"merchantTradeNo\":\"M202603120001\",\"orderAmount\":\"100.00\"}"
}

Callback Acknowledgement Response

Return the following JSON response with HTTP 200:
{
  "returnCode": "SUCCESS",
  "returnMessage": ""
}
HTTP 200 status is recommended to indicate successful receipt.

bizType Enumeration

ValueDescription
PAYStatus change for non-address payment orders
PAY_REFUNDStatus change for refund orders
PAY_BATCHStatus change for batch reward orders
PAY_GIFT_BATCHStatus change for batch gift-card payments
PAY_ADDRESSStatus change for address payment orders
TRANSFER_ADDRESSFunds-flow notification for address payments
PAY_FIXED_ADDRESSStatic-address collection notification
WITHDRAWWithdrawal / payout status change
INSTITUTIONInstitution API account-related notification

General Notes

  • This notification chapter explains the shared rules for payment, refund, address collection, static-address collection, payout, and institution-related callbacks.
  • Detailed callback interpretation for each business flow should still be read together with the corresponding product guide and API Reference.
  • If your integration uses multiple payment methods, route processing by bizType rather than assuming all callbacks share the same field set.
  • Do not rely on a single callback alone to finalize financial state changes in critical flows; combine callbacks with the appropriate query or detail endpoint when needed.

Payment Product to bizType Mapping

If your integration covers multiple payment products, define the internal routing model from product flow to bizType first:
Product or ScenarioPrimary bizTypeNotes
Hosted checkout, web launch, and ordinary non-address paymentPAYUsed for non-address payment order status changes
RefundPAY_REFUNDUsed for refund-state progression
Address paymentPAY_ADDRESSUsed for address payment order state changes
Address-payment fund creditTRANSFER_ADDRESSUsed for credit, delayed-credit, or risk-control outcomes
Static-address collectionPAY_FIXED_ADDRESSUsed for static-address collection results
Payout / withdrawalWITHDRAWUsed for batch and sub-order status changes
Institution sub-account related eventsINSTITUTIONUsed for institution account-opening results
This page already includes the event catalog summary and terminal-state handling guidance, so you can continue reading the business-specific sections below.

Hosted Checkout Payment Notification

Hosted checkout payments follow the general PAY callback model. For non-address payments, interpret the payment amount using orderAmount. For more details on payment integrations, see Payments.

Refund Notifications

Refund orders use the PAY_REFUND callback type.
  • Use the merchant-side unique identifier refundRequestId as the primary key for refund query and reconciliation.
  • API-initiated refunds and refunds triggered manually in the merchant console are different operational entry points; the callback description in this documentation applies to API integrations.
  • For reliable refund status handling, combine callbacks with the refund query endpoints.

Address Payment Notifications

PAY_ADDRESS Status Enumeration

StatusApplicable ModeDescription
PAY_SUCCESSNon-convert / ConvertPayment succeeded
PAY_ERRORNon-convert / ConvertPayment failed
PAY_CLOSENon-convert / ConvertOrder closed
PAY_EXPIRED_IN_PROCESSNon-convert / ConvertTarget amount reached within validity period, but still unconfirmed on-chain records
PENDINGConvertPending
PROCESSConvertProcessing
PAIDConvertPaid
EXPIREDConvertExpired

PAY_ADDRESS data Fields

FieldApplicable ModeDescription
merchantTradeNoNon-convert / ConvertMerchant order number
productTypeNon-convert / ConvertProduct type
productNameNon-convert / ConvertProduct name
goodsNameNon-convert / ConvertGoods name
tradeTypeNon-convert / ConvertTransaction type
terminalTypeNon-convert / ConvertTerminal type
currencyNon-convert / ConvertPricing currency
orderAmountNon-convert / ConvertOrder amount
payerIdNon-convert / ConvertPayer identifier
createTimeNon-convert / ConvertCreation time
transactionIdNon-convert / ConvertPlatform transaction ID
waitAmountOnChainNon-convert / ConvertOn-chain amount detected but not yet finally credited
doneAmountOnChainNon-convert / ConvertOn-chain amount already confirmed and credited
channelIdNon-convert / ConvertChannel identifier
chainNon-convert / ConvertChain name
addressNon-convert / ConvertCollection address
fromAddressNon-convert / ConvertPayer address
payCurrencyConvertPayment currency used for conversion
payAmountConvertPayment amount used for conversion
rateConvertExchange rate
overPayConvertOverpayment amount

TRANSFER_ADDRESS Status Enumeration

StatusDescription
TRANSFERRED_ADDRESS_IN_TERMCredited within the validity period
TRANSFERRED_ADDRESS_DELAYCredited after the validity period
CONVERT_ADDRESS_PAY_DELAYConvert delayed-payment notification only; no credit
TRANSFERRED_ADDRESS_BLOCKRisk-controlled funds; not credited

TRANSFER_ADDRESS data Fields

FieldDescription
merchantTradeNoMerchant order number
currencyCurrency
orderAmountOrder amount
createTimeCreation time
transactionIdPlatform transaction ID
transferAmountOn-chain transfer amount
txHashBlockchain transaction hash
chainChain name
addressAddress
channelIdChannel identifier
Note: In historical payloads or different business flows, the transaction hash field may appear as txHash, tx_hash, or hash, so parsers should handle these variants compatibly.

Static Address Collection Notification

bizType: PAY_FIXED_ADDRESS bizStatus: PAY_SUCCESS (credit succeeded) or PAY_BLOCK (risk funds, not credited)

data Fields

FieldTypeRequiredDescription
channelIdstringYesChannel identifier
currencystringYesCurrency
orderAmountstringNoOrder amount
amountstringYesActual credited amount
createTimenumberYesCreation time (milliseconds)
transactionIdstringYesPlatform transaction ID
transactionTimenumberYesTransaction time (milliseconds)
chainstringYesChain name
addressstringYesCollection address
Success Response:
{
  "returnCode": "SUCCESS",
  "returnMessage": ""
}

Withdrawal / Payout Callbacks

For withdrawal and payout operations, see Payout for detailed callback structures and field descriptions. bizType: WITHDRAW

Main Order Fields

FieldRequiredDescription
batch_idYesBatch ID
merchant_idYesMerchant ID
statusYesINIT / PROCESSING / PARTIAL / FAIL / SUCCESS
client_idYesclient_id used to create the batch
pay_back_statusYesRollback status
channel_idYesChannel identifier

Sub-order Fields

FieldRequiredDescription
suborder_idYesSub-order ID
chainYesChain
addressYesAddress
currencyYesCurrency
amountYesAmount
feeYesFee
txHashYesTransaction hash
statusYesDONE / FAIL
merchant_withdraw_idYesMerchant withdrawal ID
fee_typeYes0=internal deduction; 1=external deduction
finish_timeYesCompletion time
sub_amountYesTotal sub-order amount
done_amountYesActually completed amount

Institution API Callbacks

bizType: INSTITUTION bizStatus: INSTITUTION_ACCOUNT_SUCCESS or INSTITUTION_ACCOUNT_FAIL For institution account-related notifications, see Institutional API.

data Fields (JSON string)

FieldDescription
request_idRequest identifier
account_idAccount ID
customer_idCustomer ID
display_nameAccount display name
statusACTIVE or FAIL
createdTimestamp in milliseconds

Callback Integration Guide

Integration Requirements

ItemRecommendation
EndpointUse a dedicated path such as /webhook/gatepay
ProtocolHTTPS with TLS 1.2+
Processing StrategyVerify signature → store idempotently → process business asynchronously → return SUCCESS
Signature VerificationNever return SUCCESS if signature verification fails
data ParsingThe data field is a JSON string and requires secondary parsing
Duplicate HandlingSupport duplicate notifications using idempotent processing
  1. Receive the callback request
  2. Verify the signature using the merchant secret key (see Authentication and Security)
  3. Extract and parse the data field (JSON string → object)
  4. Check idempotency key (e.g., transactionId or merchantTradeNo)
  5. Store the notification durably before processing
  6. Process the business logic asynchronously
  7. Return {"returnCode": "SUCCESS", "returnMessage": ""} with HTTP 200
This design ensures reliability and prevents duplicate processing.

Event Catalog Summary

Processing Model

  • Route processing by bizType first instead of assuming every callback shares the same field set
  • Then evaluate bizStatus to determine whether the event is intermediate or terminal
  • Finally apply idempotent updates keyed by business identifiers such as merchantTradeNo, refundRequestId, or batch_id

Event Catalog

bizTypebizStatusBusiness MeaningTerminalRecommended Action
PAYPAY_SUCCESSNon-address payment succeededYesMark the order successful and continue fulfillment
PAYPAY_ERRORNon-address payment failedYesMark the order failed and allow retry or manual handling
PAYPAY_CLOSEOrder closedYesEnd the flow and stop polling
PAY_REFUNDREFUND_PROCESSRefund is processingNoMark refund as processing and continue waiting for callback or query
PAY_REFUNDREFUND_SUCCESSRefund succeededYesMark refund as complete and reconcile funds
PAY_REFUNDREFUND_REJECTEDRefund rejectedYesMark refund failed and route to manual review
PAY_ADDRESSPAY_SUCCESSAddress payment succeededYesMark the order successful and persist chain-side payment details
PAY_ADDRESSPAY_EXPIRED_IN_PROCESSTarget amount reached during validity period but on-chain records are still unconfirmedNoContinue confirmation handling and avoid prematurely finalizing the order
TRANSFER_ADDRESSTRANSFERRED_ADDRESS_IN_TERMFunds credited within the valid periodYesMark funds as credited
TRANSFER_ADDRESSTRANSFERRED_ADDRESS_DELAYDelayed creditYesMark delayed settlement and apply business-specific handling
TRANSFER_ADDRESSCONVERT_ADDRESS_PAY_DELAYDelayed convert-address payment noticeNoContinue handling together with query results and order mode
TRANSFER_ADDRESSTRANSFERRED_ADDRESS_BLOCKRisk-controlled fundsYesMark the order as exceptional and route to manual review
PAY_FIXED_ADDRESSPAY_SUCCESSStatic-address collection succeededYesMark the collection as credited
PAY_FIXED_ADDRESSPAY_BLOCKStatic-address risk-controlled fundsYesMark the event exceptional and route to manual review
WITHDRAWINIT / PROCESSINGPayout batch is processingNoUpdate the batch to processing and wait for subsequent callbacks
WITHDRAWSUCCESSPayout batch fully succeededYesMark the batch successful and finalize reconciliation
WITHDRAWPARTIALPayout batch partially succeededYesSplit handling between successful and failed sub-orders
WITHDRAWFAILPayout batch failedYesMark failed and route to retry or manual review
INSTITUTIONINSTITUTION_ACCOUNT_SUCCESSSub-account creation succeededYesRecord successful account creation
INSTITUTIONINSTITUTION_ACCOUNT_FAILSub-account creation failedYesRecord the failure and route for manual review

Terminal-State Handling Rules

For terminal events, it is best to advance downstream business only after all of the following are true:
  1. the signature has been verified
  2. idempotency validation has passed
  3. the event has been persisted
  4. the local business record is updated consistently with the callback result