Concepts
x402 Payment Flow
Buyer and seller lifecycle for ZenithPay x402 payments on X Layer
This page explains the end-to-end x402 lifecycle implemented by ZenithPay.
Roles
- Buyer route:
POST /pay(agent/operator entry point) - Seller route:
GET|POST /sell/agent-intel(x402 challenge + paid resource) - Facilitator: OKX Payments API (
/verify,/settle)
Sequence
- Agent requests
POST /paywithserviceUrl,maxAmount, andintent. - ZenithPay checks spend policy first (
SpendPolicy.sol). - If required, ZenithPay performs exact-amount swap (
OKB -> USDG). - ZenithPay calls seller route and receives x402 payment requirement (
402). - ZenithPay builds payment payload and calls OKX
/verify. - ZenithPay calls OKX
/settle. - Seller route returns paid data.
- ZenithPay writes ledger + returns transaction result.
Why this model
- policy gate is enforced before value movement
- settlement uses a standardized HTTP-native payment protocol
- buyer and seller concerns are clearly separated
Production endpoints
- Buyer:
https://api.usezenithpay.xyz/pay - Seller:
https://api.usezenithpay.xyz/sell/agent-intel - Facilitator:
https://web3.okx.com/api/v6/x402/verifyand/settle