x402 payments protocol
"1 line of code to accept digital dollars. No fee, 2 second settlement, $0.001 minimum payment."
app.use(
// How much you want to charge, and where you want the funds to land
paymentMiddleware("0xYourAddress", { "/your-endpoint": "$0.01" })
);
// That's it! See examples/typescript/servers/express.ts for a complete example. Instruction below for running on base-sepolia.
Philosophy
Payments on the internet are fundamentally flawed. Credit Cards are high friction, hard to accept, have minimum payments that are far too high, and don't fit into the programmatic nature of the internet. It's time for an open, internet-native form of payments. A payment rail that doesn't have high minimums + % based fee. Payments that are amazing for humans and AI agents.
Principles
-
Open standard: the x402 protocol will never force reliance on a single party
-
HTTP Native: x402 is meant to seamlessly complement the existing HTTP request made by traditional web services, it should not mandate additional requests outside the scope of a typical client / server flow.
-
Chain and token agnostic: we welcome contributions that add support for new chains, signing standards, or schemes, so long as they meet our acceptance criteria laid out in CONTRIBUTING.md
-
Trust minimizing: all payment schemes must not allow for the facilitator or resource server to move funds, other than in accordance with client intentions
-
Easy to use: x402 needs to be 10x better than existing ways to pay on the internet. This means abstracting as many details of crypto as possible away from the client and resource server, and into the facilitator. This means the client/server should not need to think about gas, rpc, etc.
Ecosystem
The x402 ecosystem is growing! Check out our
ecosystem page to see projects building with x402, including:
- Client-side integrations
- Services and endpoints
- Ecosystem infrastructure and tooling
- Learning and community resources
Want to add your project to the ecosystem? See our
#adding-your-project-to-the-ecosystem">demo site README for detailed instructions on how to submit your project.
Terms:
- resource: Something on the internet. This could be a webpage, file server, RPC service, API, any resource on the internet that accepts HTTP / HTTPS requests.
- client: An entity wanting to pay for a resource.
- facilitator server: A server that facilitates verification and execution of on-chain payments.
- resource server: An HTTP server that provides an API or other resource for a client.
Technical Goals:
- Permissionless and secure for clients and servers
- Gasless for client and resource servers
- Minimal integration for the resource server and client (1 line for the s...
回复