PAYMENTS
x402 Integration
HTTP 402 examples and HTTP 402 for APIs using x402 payments and x402 integration. Learn how to implement blockchain-based x402 stablecoin payments with Originary to build machine-payable APIs that generate verifiable PEAC-Receipts.
What is x402?
x402 is a protocol built on the HTTP 402 status code that enables instant, blockchain-based payments for web resources and APIs. Developed by Coinbase, x402 allows users to pay for resources via API without registration, emails, OAuth, or complex signatures.
Originary integrates with x402 to normalize stablecoin payments into standard PEAC-Receipts, providing a unified proof of payment regardless of the payment rail used.
5-Minute Quickstart
- Deploy your
peac.txtpolicy file - Configure x402 payment endpoint in your Originary dashboard
- Return HTTP 402 with x402 payment challenge when access is gated
- Verify payment via x402 protocol
- Issue PEAC-Receipt header in response after payment confirmation
Code Example
// Challenge with 402
res.status(402).json({
protocol: 'x402',
amount: '1.00',
currency: 'USDC',
address: '0x...'
})
// After payment verification, issue receipt
res.setHeader('PEAC-Receipt', signedJWT)
res.json({ content: protectedData })Related Resources
Ready to accept stablecoin payments?
Start accepting x402 payments and build HTTP 402 for APIs with Originary today.
Get Started