概述
GatePay 提供多种收款方式,以适配不同的商户和用户场景:- 托管收银台支付:由 GatePay 托管支付界面,支持二维码支付和链上动态地址支付
- 地址支付:直接向动态生成或静态收款地址发起付款
- 支付拉起:适用于移动端和客户端的应用内支付拉起场景
托管收银台支付
产品概述
托管收银台支付是由 GatePay 提供的完整收款能力。商户无需自行建设支付页面,GatePay 会统一处理以下方式:- 二维码支付
- 链上动态地址支付(Web3)
支付流程
The hosted checkout payment flow consists of three main steps:- Pre-订单 Creation: The 商户 creates a pre-订单 and receives redirect information from the API.
- User Redirection: The 商户 redirects the user to the GatePay hosted checkout page using the provided
locationURL. - Asynchronous 通知: After the user completes payment, GatePay 异步ly notifies the 商户 backend of the 订单 status via 回调.
location value returned by the API.
Query Supported Chains
请求:Create 托管收银台 Order
请求:location field that you must use to redirect the user. This URL is the only valid entry point to the GatePay hosted checkout page.
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
merchantTradeNo | string | Yes | Unique 商户 订单 number for this 交易 |
currency | string | Yes | Order currency code (e.g., USDT, USD) |
orderAmount | string | Yes | Order amount in the specified currency |
callbackUrl | string | Yes | 商户 endpoint URL to receive 订单 status 回调. See 通知 回调 for details. |
orderExpireTime | number | No | Order expiration time (Unix timestamp in seconds). Default: 1 hour from creation. |
响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
prepayId | string | GatePay pre-订单 ID for tracking and queries |
location | string | Hosted checkout redirect URL. Redirect the user to this URL. |
qrContent | string | QR code content for QR-based payment (if applicable) |
Query Order Result
请求:Payment Amount 处理方式
The interpretation of payment amounts differs based on 订单 type:- Gate 支付 (non-address): The final paid amount is represented by
orderAmount. - Address 支付: Both
waitAmountOnChainanddoneAmountOnChainmust be considered:waitAmountOnChain: On-chain amount already detected but not yet finally confirmeddoneAmountOnChain: On-chain amount already confirmed and credited to the 商户 account
Signed 请求 and 回调
For security details on request signing and 回调 verification, see 认证与安全.Address 支付
Address payments enable direct collection to blockchain addresses. The system dynamically generates payment addresses based on 订单 parameters or uses pre-configured static addresses.Typical Integration Flow
- Chain Query: Query supported chains for your 订单 currency.
- Order Creation: Create an 订单; the system generates and returns a unique collection address.
- User Payment: User transfers 资金 to the collection address.
- Payment Detection: GatePay detects the on-chain 交易 and notifies your backend via 回调.
- Result Confirmation: Confirm payment via 回调 or use the query API as a fallback.
Address Payment Credit Modes
GatePay supports two crediting modes for address payments:- Asynchronous Crediting: Funds are credited to the 商户 account after on-chain confirmation.
- Immediate Crediting: Funds are credited immediately upon 订单 creation (for supported scenarios).
Order 状态
CommonPAY_ADDRESS 订单 statuses:
| 状态 | 说明 |
|---|---|
PAY_SUCCESS | Payment succeeded and 资金 are credited |
PAY_ERROR | Payment failed; 资金 were not credited |
PAY_CLOSE | Order was closed by the 商户 or system |
PAY_EXPIRED_IN_PROCESS | Order validity period expired, but some on-chain 交易s remain unconfirmed. Funds may still be credited after confirmation. |
Payment Mode Selection: Non-Convert vs. Convert
Non-Convert Mode: Funds are credited in the original payment currency. Convert Mode: Funds are converted to a different currency before crediting. For convert mode 订单s, you may need to query supported conversion currencies.Query Supported Conversion 币种 (Convert Mode Only)
请求:Create Address Payment Order
请求:Query Address Payment Order
请求:Static Address 支付
Static address payment enables 商户s to configure a fixed collection address for long-term or recurring payment scenarios. This is ideal for:- Subscription or recurring billing
- Tip jars or 资金raising pages
- 商户 settlement accounts
- Commission distribution
How It Works
- Configure Static Address: Use the save endpoint to configure a fixed collection address for a specific channel and blockchain.
- Reuse Address: Use the same address across multiple 订单s without creating a new address each time.
- Automatic Detection: GatePay detects payments to the static address and sends 通知.
channelId and chain, the API updates it.
Save or Update Static Address Configuration
请求:channelId and blockchain network (chain).
Payment Launch
Payment launch enables in-app payment experiences for mobile 应用s or 客户端 web 应用s. This flow allows users to initiate payments directly from your 应用 without leaving the app.Integration 步骤
- Server-Side Pre-订单: Create a pre-订单 on your backend using the checkout 订单 endpoint.
- Client Launch: Pass the
prepayIdto your client 应用. - Client Query: The client can optionally query the 订单 status for UI updates.
- 参数 Validation: Validate payment parameters before launching the payment flow.
- Final Confirmation: After the user returns, confirm payment status via server-side query.
Client SDK 参数 Validation
请求:prepayId and other parameters before initiating the client payment flow.
Server-Side Pre-订单 响应 字段
When you create a pre-订单 for payment launch, the response includes:| 字段 | 类型 | 说明 |
|---|---|---|
prepayId | string | Pre-订单 ID to pass to the client SDK |
location | string | Redirect URL (used for web-based payment launch) |
qrContent | string | QR code content (optional, for QR-based flows) |
Client Return and Payment Confirmation
Critical: After the client 应用 returns to your 商户 page, the redirect result or client status must NOT be treated as the final payment result. Always confirm payment status through a server-side query toGET /v2/pay/order/query. This ensures:
- Accurate payment state in your system
- Proper handling of pending or delayed payments
- Fraud detection and 对账
Payment Validity and Expiration
Default Validity Period
By default, an 订单 remains valid for 1 hour from creation time. This is configurable via theorderExpireTime parameter.
Delayed Payment 处理方式
If a blockchain 交易 is submitted after the 订单’s expiration time, the payment is classified as a delayed payment. GatePay supports two handling modes:- Non-Convert Delayed Payment: Funds are still credited to the 商户 account after on-chain confirmation, even though the 订单 is expired.
- Convert Delayed Payment: User 资金 do not enter the 商户 支付账户. The 订单 is treated as failed.
Re资金
GatePay provides two re资金 APIs for backward compatibility:Standard Re资金 (Recommended)
请求:Compatibility Re资金 (Legacy)
请求:回调 and Asynchronous 通知
All payment methods support 异步 回调 to notify your backend of 订单 status changes. For complete 回调 details, payload schemas, signing, and verification, see 通知 回调. GatePay guarantees:- 回调 are sent to the
callbackUrlprovided at 订单 creation - 回调 include signed payloads for security verification
- Multiple 回调 attempts if the initial delivery fails
最佳实践
- Always Verify 回调: Use the signature provided with each 回调 for verification. See 认证与安全.
- Use Query as Fallback: If 回调 delivery is delayed or missed, use the query endpoints for 对账.
- Handle Delayed 支付: Implement logic to handle payments that arrive after 订单 expiration.
- Monitor Amount 字段: For address payments, always check both
waitAmountOnChainanddoneAmountOnChainto get the complete payment picture. - Store prepayId: Keep the
prepayIdreturned from 订单 creation for tracking and support purposes. - Implement Idempotency: Use unique
merchantTradeNovalues to prevent duplicate 订单.

