HTTP API - One-time Payment
The Buyer signs a fresh EIP-3009 authorization on every protected-resource request, and the Facilitator settles each one on-chain individually. Aligned with the Coinbase x402 V2 protocol, with OKX extensions.
- Base URL:
https://web3.okx.com
- Path prefix:
/api/v6/pay/x402
- Scheme:
exact
- Network: X Layer (CAIP-2 identifier
eip155:196)
Authentication
All endpoints require API Key authentication. Include the following headers:
| Header | Required | Description |
|---|
OK-ACCESS-KEY | Yes | API Key |
OK-ACCESS-SIGN | Yes | Request signature |
OK-ACCESS-PASSPHRASE | Yes | API passphrase |
OK-ACCESS-TIMESTAMP | Yes | ISO 8601 timestamp |
Content-Type | Yes | Set to application/json for POST requests |
All responses use a uniform business envelope:
On business errors, code is non-"0" and data is null. See the Error codes section at the bottom for the full list.
1. /api/v6/pay/x402/supported
GET
/api/v6/pay/x402/supported
Returns the schemes, networks, and signers supported by the Facilitator. Seller SDKs use this to build the accepts array of a 402 response.
Request parameters
None.
Response parameters
| Parameter | Type | Description |
|---|
kinds | Array<SupportedKind> | List of supported payment kinds |
kinds[].x402Version | Integer | x402 protocol version, e.g. 2 |
kinds[].scheme | String | Settlement scheme: exact / aggr_deferred |
kinds[].network | String | CAIP-2 chain identifier, e.g. eip155:196 |
kinds[].extra | Object | Scheme-specific extra config |
extensions | Array<String> | List of supported extension identifiers |
signers | Object | Map from CAIP-2 wildcard to an array of signer addresses |
Request example
Response example
2. /api/v6/pay/x402/verify
POST
/api/v6/pay/x402/verify
Verifies the validity of the Buyer's signed payment authorization. Does not execute any on-chain transaction.
Request parameters
| Parameter | Type | Required | Description |
|---|
x402Version | Integer | Yes | x402 protocol version, e.g. 2 |
paymentPayload | Object | Yes | The x402 payment payload the client carries with the protected request. See PaymentPayload |
paymentRequirements | Object | Yes | Payment requirements declared by the Seller. See PaymentRequirements |
Constraint: paymentPayload.accepted.scheme and paymentRequirements.scheme must both be "exact".
Response parameters
| Parameter | Type | Description |
|---|
isValid | Boolean | true if verification passed, false otherwise |
invalidReason | String | Machine-readable reason (returned on failure) |
invalidMessage | String | Human-readable explanation (returned on failure) |
payer | String | Payer wallet address |
Request example
Response example — verification passed
Response example — verification failed
3. /api/v6/pay/x402/settle
POST
/api/v6/pay/x402/settle
After verification passes, submit the payment for on-chain settlement. In exact mode, every call kicks off an independent transferWithAuthorization on-chain transaction.
Request parameters
| Parameter | Type | Required | Description |
|---|
x402Version | Integer | Yes | x402 protocol version, e.g. 2 |
paymentPayload | Object | Yes | Same as verify |
paymentRequirements | Object | Yes | Same as verify |
syncSettle | Boolean | No | OKX extension. true = wait synchronously for on-chain confirmation; false (default) = async broadcast |
Response parameters
| Parameter | Type | Description |
|---|
success | Boolean | Whether settlement succeeded |
errorReason | String | Machine-readable failure reason (returned on failure) |
errorMessage | String | Human-readable failure explanation (returned on failure) |
payer | String | Payer wallet address |
transaction | String | On-chain transaction hash |
network | String | CAIP-2 chain identifier |
status | String | OKX extension. Settlement status, see table below |
status values:
syncSettle | Outcome | status | transaction |
|---|
false (default) | Broadcast | pending | txHash |
true | On-chain confirmed | success | txHash |
true | Wait timed out | timeout | txHash |
| — | Signature / simulation / on-chain failure | "" | "" |
Request example
Response example — sync settle success (syncSettle=true)
Response example — async settle (syncSettle=false)
Response example — settle failure
4. /api/v6/pay/x402/settle/status
GET
/api/v6/pay/x402/settle/status
Query settlement status by on-chain transaction hash. Suitable for polling under syncSettle=false async settlement.
Request parameters
| Parameter | Location | Type | Required | Description |
|---|
txHash | query | String | Yes | On-chain transaction hash |
Response parameters
| Parameter | Type | Description |
|---|
success | Boolean | Whether the query succeeded (false if txHash not found) |
errorReason | String | Machine-readable failure reason |
errorMessage | String | Human-readable failure explanation |
payer | String | Payer wallet address |
transaction | String | On-chain transaction hash |
network | String | CAIP-2 chain identifier |
status | String | Current settlement status: pending / success / failed |
Request example
Response example — query success
Response example — transaction not found
Shared data structures
PaymentPayload
After signing, the Buyer passes the payload to the Seller through the X-PAYMENT header (base64-encoded), and the Seller forwards it verbatim to the Facilitator.
| Parameter | Type | Required | Description |
|---|
x402Version | Integer | Yes | Protocol version, e.g. 2 |
resource | Object | No | Description of the protected resource |
resource.url | String | Yes | URL of the protected resource |
resource.description | String | No | Resource description |
resource.mimeType | String | No | Expected MIME type of the response |
accepted | Object | Yes | The payment option the Buyer chose (selected from the accepts array); same shape as PaymentRequirements |
payload | Object | Yes | Signature data |
payload.signature | String | Yes | EIP-712 signature (EOA signature) |
payload.authorization | Object | Yes | EIP-3009 authorization parameters. See Authorization |
PaymentRequirements
Used both as elements of the accepts array in the 402 response and as paymentPayload.accepted.
| Parameter | Type | Required | Description |
|---|
scheme | String | Yes | Fixed "exact" |
network | String | Yes | CAIP-2 chain identifier, e.g. eip155:196 |
amount | String | Yes | Payment amount (atomic-unit string) |
asset | String | Yes | Token contract address |
payTo | String | Yes | Recipient wallet address |
maxTimeoutSeconds | Integer | No | Maximum timeout for completing payment (seconds) |
extra | Object | No | Scheme-specific extras (e.g. name / version) |
Authorization
| Parameter | Type | Required | Description |
|---|
from | String | Yes | Payer wallet address (EOA) |
to | String | Yes | Recipient wallet address (must equal payTo) |
value | String | Yes | Payment amount (atomic units, must equal amount) |
validAfter | String | Yes | Unix timestamp when the authorization becomes valid |
validBefore | String | Yes | Unix timestamp when the authorization expires |
nonce | String | Yes | 32-byte random nonce (0x hex, replay protection) |
Supported networks and tokens
| Network | Chain Index | Status |
|---|
| X Layer | 196 | Supported |
Stablecoins supported on X Layer:
| Token | Contract address |
|---|
| USDG | 0x4ae46a509f6b1d9056937ba4500cb143933d2dc8 |
| USD₮0 | 0x779ded0c9e1022225f8e0630b35a9b54be713736 |
| USDC | 0x74b7f16337b8972027f6196a17a631ac6de26d22 |
Error codes
Error responses use the uniform envelope {"code": "<code>", "msg": "<message>", "data": null}.
1. Authentication errors (HTTP 401)
| Code | Description |
|---|
| 50103 | Header OK-ACCESS-KEY cannot be empty |
| 50104 | Header OK-ACCESS-PASSPHRASE cannot be empty |
| 50105 | Header OK-ACCESS-PASSPHRASE is incorrect |
| 50106 | Header OK-ACCESS-SIGN cannot be empty |
| 50107 | Header OK-ACCESS-TIMESTAMP cannot be empty |
| 50111 | Invalid OK-ACCESS-KEY |
| 50112 | Invalid OK-ACCESS-TIMESTAMP |
| 50113 | Invalid signature |
2. Request errors
| Code | HTTP status | Description |
|---|
| 50011 | 429 | Request rate exceeds the limit allowed for this endpoint |
| 50014 | 400 | Required parameter {param} cannot be empty |
3. Business errors
| Code | HTTP status | Description |
|---|
| 50026 | 500 | System error, please retry later |
| 81001 | 200 | Invalid {param} parameter |
| 81004 | 200 | Unsupported chain |
| 80007 | 200 | Risky address |
4. verify / settle business fields
x402 endpoints return failure reasons in data via invalidReason (verify) or errorReason (settle / settle/status). Common values:
| Field value | Endpoints | Description |
|---|
insufficient_funds | verify, settle | Payer balance is below required amount |
nonce_already_used | verify, settle | Nonce has already been used |
expired_authorization | verify, settle | Authorization has expired |
signature_invalid | verify, settle | Signature verification failed |
requirements_mismatch | verify, settle | accepted does not match paymentRequirements |
transaction_reverted | settle | On-chain transaction reverted |
chain_unavailable | settle | On-chain RPC unavailable |
not_found | settle/status | txHash not found in Facilitator records |