Tech News
← Back to articles

x402 — An open protocol for internet-native payments

read original related products more articles

1 Line of Code to Accept Digital Dollars

Just add a single line of code in your app, and you can require a USDC payment for each incoming request.

paymentMiddleware ( "0xYourAddress" , { "/your-endpoint" : "$0.01" } ); // and thats it!

If a request arrives without payment, the server responds with HTTP 402, prompting the client to pay and retry.

HTTP /1.1 402 Payment Required

x402 allows any web developer to accept crypto payments without the complexity of having to interact with the blockchain.