Olivia x420Olivia x420

x402 Payment Protocol Demo

HTTP 402 on BNB Blockchain

API Response

No response yet. Make a request to see the response here.

Access Protected Weather API

Click below to access the protected weather API. The Oliviax402() function will automatically handle the payment if required!

💡 Open DevTools Network tab to see 2 requests: first without payment (gets 402), then with payment (gets data)

How Oliviax402 works:

  1. Initial Request: Tries to access resource (no payment)
  2. 402 Detection: Server returns 402 with payment spec
  3. Extract Requirements: Gets network, amount, recipient from 402
  4. Build & Sign: Creates and signs transaction automatically
  5. Retry with Payment: Resends request with X-PAYMENT header
  6. Verification: Middleware calls facilitator to verify
  7. Settlement: Facilitator submits to Aptos blockchain
  8. Success: Returns resource + transaction hash

✨ Just call x402Axios({ privateKey, url }) - that's it!