Skip to main content

Pay for an HTTP resource

An x402 client handles a resource server’s payment challenge and submits a payment authorization with its retry. It needs a supported signer, sufficient funds and permission to spend; an ordinary HTTP client does not make payments automatically. If you want to charge for a resource instead, start with the merchant guide. For a first end-to-end example, use the quickstart.

Choose your client

Follow one complete guide for its installation, signer setup and supported payment schemes. Do not combine snippets from different SDK generations.

Understand the payment flow

x402 sequence diagram For an ordinary exact-payment flow, the server returns a 402 challenge, the client selects acceptable payment terms and retries with a payment authorization, and the server coordinates verification, settlement and resource delivery. See the x402 reference for the v2 headers and message shapes. Check that the client and server support the same network, token and payment scheme. Network-fee sponsorship and any account setup costs depend on that combination; they are not a guarantee that every payment flow is free of network costs. See supported networks. End-to-end response time also includes application work, network transport and the integration’s settlement behavior. The HTTP status code does not promise sub-second settlement.

Before using real funds

  • Protect signing keys: do not put private keys in public frontend code or commit them to source control.
  • Set spending limits appropriate to the resource and check the advertised amount, network and recipient before authorizing payment.
  • Check both payment and resource-delivery outcomes. A failed HTTP response does not prove that a payment did not settle; use the capacity and recovery guidance before retrying an uncertain payment.
  • Treat Solana batch settlement as a separate public-preview integration with pinned SDK versions, funded channels and its own recovery procedure, not a drop-in replacement for an exact-payment client.

Need help?

Join our Community

Have questions or want to connect with other developers? Join our Discord server.