Skip to main content
PAYMENTS

x402 Integration

Implement x402 payment flows with PEAC. When your API returns HTTP 402, the agent pays via x402 (stablecoin or fiat) and receives a signed receipt on success.

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.

Quickstart

  1. Deploy your peac.txt policy file
  2. Configure x402 payment endpoint in your Originary dashboard
  3. Return HTTP 402 with x402 payment challenge when access is gated
  4. Verify payment via x402 protocol
  5. 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 })

Ready to accept stablecoin payments?

Start accepting x402 payments and build HTTP 402 for APIs with Originary today.

Get Started