Skip to main content

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
For request headers, signature rules, and callback verification, refer to Authentication & Security.

Integration Flow

The standard convert workflow follows these steps:
Each step is described in detail below.

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:
  1. Query first: Use GET /v1/pay/convert/order with clientReqId or orderId to determine final status
  2. Only retry if necessary: Only reuse the same clientReqId for order creation if the query result remains uncertain
  3. Preserve idempotency: Keep clientReqId unchanged 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 clientReqId for 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