Overview
GatePay provides multiple payment collection methods to accommodate different merchant and user scenarios:- Hosted Checkout Payments: GatePay-managed payment UI supporting QR-code and on-chain dynamic address payments
- Address Payments: Direct payment to dynamically generated or static collection addresses
- Payment Launch: Mobile and client-side integration for in-app payment flows
Hosted Checkout Payments
Product Overview
Hosted checkout payment is a full-featured, GatePay-hosted collection capability. Merchants do not need to build their own payment user interface. GatePay handles both:- QR-code payments
- On-chain dynamic address payments (Web3)
Payment Flow
The hosted checkout payment flow consists of three main steps:- Pre-order Creation: The merchant creates a pre-order and receives redirect information from the API.
- User Redirection: The merchant redirects the user to the GatePay hosted checkout page using the provided
locationURL. - Asynchronous Notification: After the user completes payment, GatePay asynchronously notifies the merchant backend of the order status via callback.
location value returned by the API.
Query Supported Chains
Request:Create Hosted Checkout Order
Request:location field that you must use to redirect the user. This URL is the only valid entry point to the GatePay hosted checkout page.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
merchantTradeNo | string | Yes | Unique merchant order number for this transaction |
currency | string | Yes | Order currency code (e.g., USDT, USD) |
orderAmount | string | Yes | Order amount in the specified currency |
callbackUrl | string | Yes | Merchant endpoint URL to receive order status callbacks. See Notification Callbacks for details. |
orderExpireTime | number | No | Order expiration time (Unix timestamp in seconds). Default: 1 hour from creation. |
Response Fields
| Field | Type | Description |
|---|---|---|
prepayId | string | GatePay pre-order 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
Request:Payment Amount Handling
The interpretation of payment amounts differs based on order type:- Gate Payments (non-address): The final paid amount is represented by
orderAmount. - Address Payments: Both
waitAmountOnChainanddoneAmountOnChainmust be considered:waitAmountOnChain: On-chain amount already detected but not yet finally confirmeddoneAmountOnChain: On-chain amount already confirmed and credited to the merchant account
Signed Requests and Callbacks
For security details on request signing and callback verification, see Authentication and Security.Address Payments
Address payments enable direct collection to blockchain addresses. The system dynamically generates payment addresses based on order parameters or uses pre-configured static addresses.Typical Integration Flow
- Chain Query: Query supported chains for your order currency.
- Order Creation: Create an order; the system generates and returns a unique collection address.
- User Payment: User transfers funds to the collection address.
- Payment Detection: GatePay detects the on-chain transaction and notifies your backend via callback.
- Result Confirmation: Confirm payment via callbacks 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 merchant account after on-chain confirmation.
- Immediate Crediting: Funds are credited immediately upon order creation (for supported scenarios).
Order Statuses
CommonPAY_ADDRESS order statuses:
| Status | Description |
|---|---|
PAY_SUCCESS | Payment succeeded and funds are credited |
PAY_ERROR | Payment failed; funds were not credited |
PAY_CLOSE | Order was closed by the merchant or system |
PAY_EXPIRED_IN_PROCESS | Order validity period expired, but some on-chain transactions 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 orders, you may need to query supported conversion currencies.Query Supported Conversion Currencies (Convert Mode Only)
Request:Create Address Payment Order
Request:Query Address Payment Order
Request:Static Address Payments
Static address payment enables merchants to configure a fixed collection address for long-term or recurring payment scenarios. This is ideal for:- Subscription or recurring billing
- Tip jars or fundraising pages
- Merchant 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 orders without creating a new address each time.
- Automatic Detection: GatePay detects payments to the static address and sends notifications.
channelId and chain, the API updates it.
Save or Update Static Address Configuration
Request:channelId and blockchain network (chain).
Payment Launch
Payment launch enables in-app payment experiences for mobile applications or client-side web applications. This flow allows users to initiate payments directly from your application without leaving the app.Integration Steps
- Server-Side Pre-order: Create a pre-order on your backend using the checkout order endpoint.
- Client Launch: Pass the
prepayIdto your client application. - Client Query: The client can optionally query the order status for UI updates.
- Parameter Validation: Validate payment parameters before launching the payment flow.
- Final Confirmation: After the user returns, confirm payment status via server-side query.
Client SDK Parameter Validation
Request:prepayId and other parameters before initiating the client payment flow.
Server-Side Pre-order Response Fields
When you create a pre-order for payment launch, the response includes:| Field | Type | Description |
|---|---|---|
prepayId | string | Pre-order 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 application returns to your merchant 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 reconciliation
Payment Validity and Expiration
Default Validity Period
By default, an order remains valid for 1 hour from creation time. This is configurable via theorderExpireTime parameter.
Delayed Payment Handling
If a blockchain transaction is submitted after the order’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 merchant account after on-chain confirmation, even though the order is expired.
- Convert Delayed Payment: User funds do not enter the merchant payment account. The order is treated as failed.
Refunds
GatePay provides two refund APIs for backward compatibility:Standard Refund (Recommended)
Request:Compatibility Refund (Legacy)
Request:Callbacks and Asynchronous Notifications
All payment methods support asynchronous callbacks to notify your backend of order status changes. For complete callback details, payload schemas, signing, and verification, see Notification Callbacks. GatePay guarantees:- Callbacks are sent to the
callbackUrlprovided at order creation - Callbacks include signed payloads for security verification
- Multiple callback attempts if the initial delivery fails
Best Practices
- Always Verify Callbacks: Use the signature provided with each callback for verification. See Authentication and Security.
- Use Query as Fallback: If callback delivery is delayed or missed, use the query endpoints for reconciliation.
- Handle Delayed Payments: Implement logic to handle payments that arrive after order expiration.
- Monitor Amount Fields: For address payments, always check both
waitAmountOnChainanddoneAmountOnChainto get the complete payment picture. - Store prepayId: Keep the
prepayIdreturned from order creation for tracking and support purposes. - Implement Idempotency: Use unique
merchantTradeNovalues to prevent duplicate orders.

