ZenithPay iconZenithPay
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

  1. Agent requests POST /pay with serviceUrl, maxAmount, and intent.
  2. ZenithPay checks spend policy first (SpendPolicy.sol).
  3. If required, ZenithPay performs exact-amount swap (OKB -> USDG).
  4. ZenithPay calls seller route and receives x402 payment requirement (402).
  5. ZenithPay builds payment payload and calls OKX /verify.
  6. ZenithPay calls OKX /settle.
  7. Seller route returns paid data.
  8. 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/verify and /settle

On this page