Overview
The convert service supports the following scenarios:- Post-collection conversion: Convert received payments to settlement currency
- Unified settlement currency: Maintain accounts in a single currency
- Balance rebalancing: Optimize currency distribution across accounts
Integration Flow
The standard convert workflow follows these steps:Step 1: Query Tradable Currency Scope (Optional)
Endpoint:GET /v1/pay/convert/currency
Retrieves the list of currencies available for conversion. This step is optional but recommended for user interface initialization and validation.
Query Parameters
Response Fields
The response includes available currencies with precision and amount constraints:minBuyAmount: Minimum buy amount (field precision rules apply)maxBuyAmount: Maximum buy amount (field precision rules apply)minSellAmount: Minimum sell amount (field precision rules apply)maxSellAmount: Maximum sell amount (field precision rules apply)
Step 2: Query Available Currency Pairs (Optional)
Endpoint:GET /v1/pay/convert/pair
Retrieves supported trading pairs and exchange rate information.
Query Parameters
Step 3: Get Quote
Endpoint:POST /v1/pay/convert/preview
Generates a quote for currency conversion. The quote includes an expiration timestamp; expired quotes cannot be used for order creation.
Request Parameters
Note: Provide either
buyAmount or sellAmount, but not both.
Response Fields
Step 4: Create Convert Order
Endpoint:POST /v1/pay/convert
Creates a currency conversion order using a valid quote. This endpoint is idempotent: submitting the same clientReqId multiple times will return the same business result.
Request Parameters
Response Fields
Example Request
Step 5: Query Convert Order
Endpoint:GET /v1/pay/convert/order
Queries the status and details of a swap order. Supports multiple query keys for flexibility.
Query Parameters
Note: Provide either
orderId or clientReqId (not both required, but at least one).
Response Fields
Convert Order Status Enumeration
Retry and Error Handling
Handling Uncertain Responses
If a network timeout or uncertain response occurs:- Query first: Use
GET /v1/pay/convert/orderwithclientReqIdororderIdto determine final status - Only retry if necessary: Only reuse the same
clientReqIdfor order creation if the query result remains uncertain - Preserve idempotency: Keep
clientReqIdunchanged to ensure the same business result
Common Failure Scenarios
Callback Behavior
The convert capability does not provide asynchronous callbacks. Final order confirmation must be obtained through the query API (GET /v1/pay/convert/order).
For information on callbacks for other products, see Notification & Callbacks.
Error Handling
For comprehensive error codes and resolution steps, refer to Error Codes & Best Practices.Integration Checklist
- Retrieve available currency pairs from
GET /v1/pay/convert/pair - Implement quote retrieval with expiration handling
- Generate unique
clientReqIdfor each swap request - Create swap orders with valid quotes
- Implement query fallback for order confirmation
- Handle all failure scenarios gracefully
- Store order IDs for reconciliation
- Monitor conversion rates and limits

