All FX API calls require a valid
accessToken in the request header, obtained after merchant onboarding is approved. Include it as: Authorization: Bearer <accessToken>.Overview
Query supported currency pairs (sp2202)
Discover which sell/buy currency combinations are available for your account.
Receive the FX result webhook (sp3201)
Gcashier Pay posts the final settlement status to your callback URL.
Step 1 — Query Supported Currency Pairs
Before requesting a quote, call POST /api/sp2202 to retrieve the currency pairs available on your account. This list can change as new corridors are activated, so query it dynamically rather than hard-coding pairs.data represents a tradeable pair. sellCurrency is the currency you spend; buyCurrency is the currency you receive.
Step 2 — Request an FX Quote
Call POST /api/sp1201 to obtain a rate-locked quote. You specify either the sell amount or the buy amount — setlockDirection accordingly.
| Field | Required | Description |
|---|---|---|
merOrderNo | M | Your unique reference for this quote request |
sellCurrency | O | Currency you are selling (optional if implied by buyCurrency) |
buyCurrency | M | Currency you want to receive |
lockDirection | M | SELL = you specify how much to sell; BUY = you specify how much to buy |
amount | M | The amount to lock, in the currency implied by lockDirection |
Request / Response Example — Selling USD, Buying CNY
Step 3 — Execute the FX Trade
Once you have a validquoteId, confirm the trade by calling POST /api/sp1202. Pass the quoteId and your webhook URL for async result delivery.
Step 4 — Receive the FX Result Webhook (sp3201)
Gcashier Pay posts the settlement outcome to yourcallbackUrl after the exchange is processed. Respond with HTTP 200 to acknowledge receipt.
| Status | Meaning |
|---|---|
SUCC | Exchange completed — CNY balance credited |
FAIL | Exchange failed — USD balance not debited |
PROCESS | Settlement in progress — wait for final webhook |
Step 5 — Query FX History
Use POST /api/sp2201 to look up past FX transactions. You can search byquoteId for a specific trade, or by a time range to retrieve all trades within a window.
Time range queries are limited to a maximum window of 24 hours. For historical reporting over longer periods, paginate by shifting the 24-hour window back in increments.
Sandbox Testing
In the Gcashier Pay sandbox environment, the settlement outcome of an FX trade is determined by the last digit of theamount in your sp1201 quote request:
Last digit of amount | Simulated result |
|---|---|
0 – 3 | SUCC — exchange completes successfully |
4 – 6 | FAIL — exchange fails |
7 – 9 | PROCESS — exchange remains in processing state |
sellAmount of 10000.00 (last digit 0) will trigger a successful settlement webhook in the sandbox.