Vývojářský portál

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.

ItemDetails
Base URLhttps://web3.okx.com
Path prefix/api/v6/pay/onchainos-payment
Request methodPOST with a JSON body
AuthenticationAPI key
Supported networkX Layer, with the string "196" as the chain ID
Supported tokensNative USDC, USD₮0, and USDG, subject to service availability
Payment authorizationThe buyer signs an EIP-3009 authorization. Tokens transfer directly to the to address specified when the merchant creates the order.
Amount and feesThe 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#

  1. Prepare your integration details. Get your API key, recipient address, payment token, and amount.
  2. Create a payment order. Call the create endpoint and save paymentIntentId and checkoutUrl.
  3. Send the buyer to checkout. Open checkoutUrl so the buyer can connect a wallet and authorize payment.
  4. Confirm the payment result. Query the order using the same API key and confirm that status is settled.
Confirm payment from your server. Use the final order status returned by the query endpoint. A checkout redirect, wallet signature, or transaction hash can occur before settlement.

Create an Order#

The example creates a 10 USDC order. Replace the recipient address and generate the signature for your actual request.

bash
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
  }'

Next#