Skip to content

Quickstart

This guide will help you choose the right setup for your use case and get started with x402 in minutes.

Choose Your Role

x402 has two sides: servers (merchants who sell access to resources) and clients (buyers who pay for access). You may need one or both depending on your project.


Server Options

If you want to accept x402 payments on your API or service, pick a server framework below.

TypeScript

FrameworkBest ForGuide
ExpressTraditional Node.js APIs, broad ecosystem supportExpress Server Guide
HonoEdge-first APIs, lightweight and fastHono Server Guide

Python

FrameworkBest ForGuide
FastAPIModern async APIs, automatic docs, type safetyFastAPI Server Guide
FlaskSimple APIs, rapid prototypingFlask Server Guide

Client Options

If you want to pay for x402-protected resources, pick a client library below.

TypeScript

LibraryBest ForGuide
FetchNative browser and Node.js, no dependenciesFetch Client Guide
AxiosFeature-rich HTTP client, interceptorsAxios Client Guide

Python

LibraryBest ForGuide
httpxModern async HTTP, recommended for new projectshttpx Client Guide
requestsWidely adopted, synchronous HTTPrequests Client Guide

Environment Variables

Regardless of which framework you choose, you will need the following environment variables configured in your project.

Required

bash
# The facilitator that verifies and settles payments
FACILITATOR_URL=https://facilitator.svmacc.tech

# Your Solana wallet address (receives payments if you are a server)
ADDRESS=<your-solana-wallet-address>

# The Solana network to use
NETWORK=solana-devnet

Network Options

ValueDescription
solana-devnetSolana devnet. Use this for development and testing. Transactions use devnet USDC and cost nothing.
solanaSolana mainnet. Use this for production. Transactions use real USDC.

Tip: Start with solana-devnet while building and testing. Switch to solana when you are ready to go live.

Getting a Wallet Address

You need a Solana wallet address to send or receive payments. If you do not have one:

  1. Install a Solana wallet such as Phantom or Solflare.
  2. Create a new wallet and copy your public address.
  3. For devnet testing, airdrop devnet SOL using the Solana Faucet.

Next Steps

Pick a guide from the tables above and follow the step-by-step instructions:

Powered by SVM Facilitator