Overview and Quickstart#
Accept stablecoin payments for business orders through checkout.
Integration#
Your server creates an order and sends the buyer to checkout to connect a wallet and sign the payment authorization. Your server then queries the order to confirm the payment result.
| Item | Details |
|---|---|
| Base URL | https://web3.okx.com |
| Path prefix | /api/v6/pay/onchainos-payment |
| Request method | POST with a JSON body |
| Authentication | API key |
| Supported network | X Layer, with the string "196" as the chain ID |
| Supported tokens | Native USDC, USD₮0, and USDG, subject to service availability |
| Payment authorization | The buyer signs an EIP-3009 authorization. Tokens transfer directly to the to address specified when the merchant creates the order. |
| Amount and fees | The merchant receives the full token amount for the order. The platform covers on-chain gas. |
Each order uses one network, one token, and a fixed amount. The recipient, token, and amount are set when the order is created. The buyer uses the specified network and token at checkout.
Your server manages orders through the create and query endpoints. Checkout handles wallet connection and signing. Merchant webhooks, cancellation, refunds, a separate settlement endpoint, Permit2, split payments, and cross-chain payments are unavailable.
Complete a Payment#
- Prepare your integration details. Get your API key, recipient address, payment token, and amount.
- Create a payment order. Call the create endpoint and save
paymentIntentIdandcheckoutUrl. - Send the buyer to checkout. Open
checkoutUrlso the buyer can connect a wallet and authorize payment. - Confirm the payment result. Query the order using the same API key and confirm that
statusissettled.
Create an Order#
The example creates a 10 USDC order. Replace the recipient address and generate the signature for your actual request.
curl --request POST 'https://web3.okx.com/api/v6/pay/onchainos-payment/create' \
--header "OK-ACCESS-KEY: ${OK_ACCESS_KEY}" \
--header "OK-ACCESS-SIGN: ${OK_ACCESS_SIGN}" \
--header "OK-ACCESS-PASSPHRASE: ${OK_ACCESS_PASSPHRASE}" \
--header "OK-ACCESS-TIMESTAMP: ${OK_ACCESS_TIMESTAMP}" \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantPaymentId": "order_20261106_0001",
"to": "0x1111111111111111111111111111111111111111",
"fiatAmount": "10.00",
"fiatCurrency": "USD",
"quotes": [
{
"paymentToken": {
"chainId": "196",
"tokenAddress": "0xb6ceceab302e2e4948951ee7843fc24e92933061",
"tokenAmount": "10000000"
}
}
],
"merchantDisplayName": "Example Store",
"productDesc": "Example product",
"returnUrl": "https://merchant.example.com/payment/result",
"expireSeconds": 1800
}'
