产品概述
通过机构 API,接入机构可以:- 创建和管理客户子账户
- 代表客户发起交易
- 管理多币种业务
- 对账余额和账本
- 构建集成化支付方案
支持能力
| 能力 | 说明 | 典型 API / 模块 |
|---|---|---|
| 收单 / 收款 | 代表子账户创建订单 | 托管收银台、地址订单、Web/二维码订单、订单查询 / 关闭 |
| 换汇 / 兑换 | 代表子账户完成币种兑换 | 币种查询、交易对查询、预览、创建、订单查询 |
| 出款 / 提现 | 代表子账户执行对外付款 | 出款创建、出款详情 |
| 查询 | 查询子账户余额、账本记录、订单列表 | 余额、账单、订单查询 |
| 系统内资金划转 | 使用 charge / transfer 进行内部资金划拨 | Transfer、Charge |
Core Concepts
Key Definitions
| Concept | Definition |
|---|---|
| Institution Account | The institution’s master account in GatePay |
| Sub-account | An account created by the institution for its customer (account_id) |
| Customer ID | The customer’s unique identifier on the institution platform (customer_id) |
| Display Name | Human-readable display name of the 子账户 (display_name) |
| Account Holder | Identity information of the 子账户 holder (account_holder) |
| 请求 ID | Institution request unique ID for 幂等性 and 对账 (request_id) |
Charge vs. Transfer
| 类型 | Direction | Typical Scenario | API |
|---|---|---|---|
| transfer | Institution → 子账户 | Subsidy, settlement distribution, platform rebate | POST /transfer/open/institution/v1/pay/transfer |
| charge | Sub-account → institution | Platform commission, service-fee deduction, 资金 sweep | POST /transfer/open/institution/v1/pay/charge |
merchantBatchNo identifiers.
Delegated 请求s and Proxy Headers
X-GatePay-On-Behalf-Of Header
For APIs that require delegated calls (operations on behalf of a 子账户), the request must include theX-GatePay-On-Behalf-Of header with the value being the account ID of the delegated subject.
When to use:
- Creating 订单s on behalf of a 子账户
- Querying a 子账户’s balances
- Executing transfers or charges involving a 子账户
- Managing 出款s for a 子账户
General Integration Requirements
Common 请求 Headers
All 机构 API requests must include the following headers. For signing and signature verification details, see 认证与安全.| Header | 必填 | 说明 |
|---|---|---|
X-GatePay-Certificate-ClientId | Yes | ClientId assigned after the institution registers an app |
X-GatePay-Timestamp | Yes | UTC timestamp in milliseconds; requests with time drift exceeding 10 seconds will be rejected |
X-GatePay-Nonce | Yes | Random string; recommended length within 32 characters |
X-GatePay-Signature | Yes | HMAC-SHA256 request signature (see authentication guide) |
X-GatePay-On-Behalf-Of | Conditional | 必填 for delegated calls; value is the 子账户 ID or institution master ID |
Idempotency and Retry Strategy
Implement request deduplication based on the appropriate unique identifier for each operation type.| Scenario | Idempotency Key | 字段 Name | Purpose |
|---|---|---|---|
| Create 子账户 | request_id | request_id | Prevent duplicate account creation |
| Transfer / Charge | 商户BatchNo | merchantBatchNo | Prevent duplicate 资金 movements |
| 出款 batch | batch_id | batch_id | Prevent duplicate 出款 batches |
| 出款 sub-订单 | 商户_withdraw_id | merchant_withdraw_id | Prevent duplicate 出款 entries |
| Re资金 | re资金请求Id | refundRequestId | Prevent duplicate re资金 |
| Swap | clientReqId | clientReqId | Prevent duplicate conversions |
Typical Interaction Flows
Create Sub-account with 回调
- Initial response indicates request acceptance, not final status
- Final status arrives via 回调 通知
- Use
request_idto ensure 幂等性 across retries
Sub-account 收款 with Query Fallback
Implementation Guide
Pre-integration Checklist
Complete these items before beginning integration:| Item | 说明 | Deliverable |
|---|---|---|
| Register app and obtain ClientId | 必填 for request authentication | ClientId credential |
| Implement signing algorithm | 必填 to generate request signatures | HMAC-SHA256 implementation |
| Timestamp and nonce handling | Timestamp in UTC milliseconds; nonce within 32 characters | 请求 header generation logic |
| Define delegated-subject routing | Plan which requests use institution master vs. On-Behalf-Of | Integration routing table |
| Implement 回调 verification | All 回调s follow signature verification | 回调 validation logic |
| Idempotency and 重试 strategy | Persist request_id, 商户BatchNo, etc. | Deduplication layer |
Account Management Module
Create Sub-account
接口:POST /merchant/open/institution/v1/accounts/create
Creates a new 子账户 for a customer under the institution’s master account.
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
request_id | string | Yes | Unique institution request ID for 幂等性 |
customer_id | string | Yes | Customer’s unique identifier on the institution platform |
display_name | string | Yes | Human-readable display name for the 子账户 |
account_holder | object | Yes | Identity and compliance information (see below) |
Account Holder Object
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
entity_country | string | Yes | ISO 3166-1 alpha-2 country code |
entity_type | string | Yes | INDIVIDUAL or BUSINESS |
entity_id_type | string | Conditional | ID type (e.g., passport, driver’s license) |
entity_id_number | string | Conditional | ID number |
entity_id_expiry | date | Conditional | ID expiration date (YYYY-MM-DD) |
dob | date | Conditional | Date of birth (YYYY-MM-DD); required when entity_type=INDIVIDUAL |
merchant_category | string | Yes | 商户 category enumeration |
user_agreement | boolean | Yes | Whether the user accepted the service agreement |
address | object | Yes | Subject’s address with street, city, state, zip, country |
响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
account_id | string | Unique 子账户 ID (used in X-GatePay-On-Behalf-Of for delegation) |
status | string | Account status: INIT, PENDING, ACTIVE, or FAILED |
request_id | string | Echoed from request |
Sub-account 状态 Lifecycle
| 状态 | Meaning |
|---|---|
INIT | Account initialized; awaiting compliance review |
PENDING | Under review by GatePay compliance team |
ACTIVE | Account approved and ready for use |
FAILED | Account approval rejected; see 回调 for failure reason |
Update Sub-account
接口:POST /merchant/open/institution/v1/accounts/update
Updates 子账户 information. This operation performs an overwrite update.
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
account_id | string | Yes | Sub-account ID to update (also in X-GatePay-On-Behalf-Of header) |
display_name | string | No | Updated display name |
account_holder | object | No | Updated account holder information |
请求 Headers
| Header | Value | 说明 |
|---|---|---|
X-GatePay-On-Behalf-Of | account_id | Sub-account ID being updated |
Query Sub-account
接口:GET /merchant/open/institution/v1/accounts/query
Queries a single 子账户 by ID or request ID.
Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
request_id | string | Conditional | Institution request ID from creation |
account_id | string | Conditional | Sub-account ID |
响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
account_id | string | Sub-account ID |
customer_id | string | Customer ID |
display_name | string | Display name |
status | string | Current account status |
account_holder | object | Account holder information |
created_at | timestamp | Account creation timestamp |
List Sub-accounts
接口:GET /merchant/open/institution/v1/accounts/list
Lists 子账户s with pagination support.
Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
cursor | string | No | Pagination cursor (start from 1) |
limit | integer | No | Number of results per page (default 20, max 100) |
status | string | No | Filter by account status |
Finance Module
Query Balance
接口:POST /payment/open/institution/v1/balance
Retrieves current balance for the institution or a delegated 子账户 by currency.
请求 Body
Provide an array of currency codes:响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
currency | string | 币种 code |
available | string | Available balance |
hold | string | Held amount (in pending 订单s/出款s) |
total | string | Total balance (available + hold) |
Query Funds Ledger
接口:GET /payment/open/institution/v1/pay/bill/orderlist
Queries 资金 movement records (账本 entries) for 对账 and audit purposes.
Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
start_time | timestamp | No | Start of time range (milliseconds) |
end_time | timestamp | No | End of time range (milliseconds) |
page | integer | No | Page number (1-indexed) |
limit | integer | No | Records per page |
currency | string | No | Filter by currency |
type | string | No | Filter by 交易 type |
响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
ledger_id | string | Unique 账本 identifier |
type | string | Transaction type (deposit, 出款, transfer, etc.) |
currency | string | 币种 of the 交易 |
amount | string | Transaction amount |
balance_after | string | Balance after 交易 |
business_id | string | Related 订单/batch ID |
created_at | timestamp | Transaction timestamp |
Order Management Module
托管收银台 Order
接口:POST /payment/open/institution/v1/pay/checkout/order
Creates a hosted checkout 订单 on behalf of a 子账户. Customers are redirected to a GatePay-hosted payment page.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
merchant_order_no | string | Yes | 商户-generated unique 订单 number |
amount | string | Yes | Order amount in smallest unit (satoshis, cents, etc.) |
currency | string | Yes | Settlement currency |
pay_currency | string | No | 币种 customer pays in (if different from settlement) |
description | string | No | Order description |
return_url | string | No | URL to redirect after payment completion |
notify_url | string | No | Webhook URL for payment 通知s |
响应 字段
| 字段 | 类型 | 说明 |
|---|---|---|
prepayId | string | Unique payment request ID |
location | string | Redirect URL to GatePay checkout page |
qrContent | string | QR code content for mobile payment |
payCurrency | string | 币种 customer will pay in |
payAmount | string | Amount customer will pay |
chain | string | Blockchain chain (if cryptocurrency) |
address | string | Payment address for direct transfer |
fullCurrType | string | Full currency type identifier |
Address Order
接口:POST /payment/open/institution/v1/pay/address/create
Creates a static address payment 订单.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
merchant_order_no | string | Yes | Unique 订单 number |
currency | string | Yes | Payment currency |
amount | string | Yes | Payment amount |
orderExpireTime | timestamp | Yes | Order expiration time (Unix seconds) |
notify_url | string | No | Webhook URL |
Web & QR Order
接口:POST /payment/open/institution/v1/pay/transactions/native
Creates a Web or QR code pending 订单 for native wallet payments.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
Query Order
接口:POST /payment/open/institution/v1/pay/order/query
Queries the status and details of an existing 订单.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
orderId | string | Conditional | GatePay 订单 ID |
merchant_order_no | string | Conditional | 商户 订单 number |
Close Order
接口:POST /payment/open/institution/v1/pay/order/close
Closes an open 订单 to prevent further payments.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
Static 收款 Address Management
For direct cryptocurrency payments, manage static collection addresses:| Capability | 接口 | Method |
|---|---|---|
| Query supported chains | GET /merchant/open/institution/v1/pay/fixedaddress/chains | GET |
| Create / update address | POST /merchant/open/institution/v1/pay/fixedaddress/save | POST |
| List addresses | GET /merchant/open/institution/v1/pay/fixedaddress/list | GET |
| Get address details | GET /merchant/open/institution/v1/pay/fixedaddress/detail | GET |
| Delete address | DELETE /merchant/open/institution/v1/pay/fixedaddress/delete | DELETE |
| Query collection 账本 | GET /payment/open/institution/v1/pay/fixedaddress/order/query | GET |
出款 & Withdrawal Module
Create and manage outbound settlements for 子账户s.Create 出款
接口:POST /withdraw/open/institution/v1/pay/create/payouts
Creates a 出款 request on behalf of a 子账户.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
batch_id | string | Yes | Batch identifier for 幂等性 |
merchant_withdraw_id | string | Yes | Unique 提现 ID |
currency | string | Yes | 出款 currency |
amount | string | Yes | 出款 amount |
address | string | Yes | Recipient blockchain address |
network | string | Yes | Blockchain network |
出款 Detail
接口:POST /withdraw/open/institution/v1/pay/payouts/detail
Queries detailed information about a 出款.
Transfer & Charge Module
Transfer (Institution → Sub-account)
接口:POST /transfer/open/institution/v1/pay/transfer
Transfers 资金 from the institution account to a 子账户.
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
merchantBatchNo | string | Yes | Unique batch number for 幂等性 |
currency | string | Yes | Transfer currency |
amount | string | Yes | Transfer amount |
account_id | string | Yes | Recipient 子账户 ID |
Query Transfer
接口:GET /transfer/open/institution/v1/pay/transfer/detail
Charge (Sub-account → Institution)
接口:POST /transfer/open/institution/v1/pay/charge
Deducts 资金 from a 子账户 (e.g., commission or service fees).
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
merchantBatchNo | string | Yes | Unique batch number for 幂等性 |
currency | string | Yes | Charge currency |
amount | string | Yes | Charge amount |
Query Charge
接口:GET /transfer/open/institution/v1/pay/charges/detail
Re资金 Module
Create Re资金
接口:POST /payment/open/institution/v2/standard/order/refund
Re资金 a previous payment 订单.
请求 Headers
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
请求 参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
refundRequestId | string | Yes | Unique re资金 ID for 幂等性 |
orderId | string | Conditional | GatePay 订单 ID |
merchant_order_no | string | Conditional | 商户 订单 number |
amount | string | No | Partial re资金 amount (full if omitted) |
Query Re资金 Detail
接口:GET /payment/open/institution/v2/pay/refund/details
Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
refundRequestId | string | Yes | Re资金 ID from creation |
币种 Conversion Module
Convert currencies on behalf of a 子账户. For detailed swap procedures, see 币种 Conversion & Swap.| 步骤 | 接口 | Method |
|---|---|---|
| Query available currencies | GET /transfer/open/institution/v1/pay/convert/currency?side=buy/sell | GET |
| Query available pairs | GET /transfer/open/institution/v1/pay/convert/pair?currency=...&side=... | GET |
| Get 报价 preview | POST /transfer/open/institution/v1/pay/convert/preview | POST |
| Create swap 订单 | POST /transfer/open/institution/v1/pay/convert | POST |
| Query swap 订单 | GET /transfer/open/institution/v1/pay/convert/order?orderId=... | GET |
请求 Headers (for swap operations)
| Header | Value |
|---|---|
X-GatePay-On-Behalf-Of | 子账户_id |
Common 错误码
Account Management
| 错误码 | 说明 | Resolution |
|---|---|---|
400001 | Invalid request parameters | Verify all required fields and data types |
400002 | Invalid signature | Check signing algorithm and secret key |
400003 | 请求 timestamp expired | Ensure system clock is synchronized; time drift must be < 10 seconds |
550226 | request_id already used to create 子账户 | Idempotency: return previous result or handle gracefully |
550227 | No matching 子账户 found | Verify account_id or request_id is correct |
Orders & Delegation
| 错误码 | 说明 | Resolution |
|---|---|---|
550142 | Missing X-GatePay-On-Behalf-Of header | Verify delegated subject header is present and correct |
550200 | Master account has no delegation permission | Enable delegation permission in GatePay settings |
550201 | Asset balance currency not found | Use correct currency code; verify account has balance in that currency |
Integration 最佳实践s
Recommended Architecture
| Layer | Recommendation | Details |
|---|---|---|
| API Client | Encapsulate common headers | Build middleware for timestamp, nonce, signature, on-behalf-of |
| Idempotency | Persist 幂等性 keys | Store request_id, 商户BatchNo, re资金请求Id, clientReqId in database |
| 回调 Processing | Unified 回调 entry | Verify signature, check 幂等性, advance state machine, return SUCCESS |
| Query Fallback | Build query APIs | Implement fallback for 订单s, re资金, transfers, 出款s, 账本 |
| Observability | Monitor critical paths | Alert on 回调 failures, signature errors, timestamp expiry, PENDING timeouts |
回调 Implementation
- Implement a single 回调 receiver endpoint
- Verify request signature against
X-GatePay-Signature - Check 幂等性 using relevant IDs (request_id, account_id, batch_id, etc.)
- Update database state machine
- Return HTTP 200 with body
{"code": "SUCCESS"}to confirm receipt

