Skip to content

Putting it all together

Typical end‑to‑end flow:

  • Call a third‑party API. If it responds with HTTP 402 / X‑402 metadata, extract amount, host, resource URL, etc.
  • Look up the jwt for the calling user/agent.
  • Call POST /api/payment/x402V1Payment with the correct body and Authorization header.
  • On success, attach the returned xPaymentB64 as X-Payment and retry the original API call.
  • For withdrawals or revenue splits, call POST /api/payouts and track with GET /api/payouts/{payoutId} until terminal.

Released under the MIT License.