Mogami
  • Home
  • Roadmap & ideas
  • x402 in French
  • Java client SDK
    • Getting started
    • Example client
  • Java server SDK
    • Getting started
    • Example server
    • Configuration
  • Faciliator server
    • Getting started
    • Verifications
  • Learning X402
    • Protocol explanation
      • Get /weather without X-PAYMENT
      • Get /weather with X-PAYMENT
      • Payment verification on server
      • Payment settlement on server
    • X402 hands-on
    • Useful links
  • Contact
    • Email
    • Twitter
Powered by GitBook
On this page
  1. Learning X402
  2. Protocol explanation

Get /weather without X-PAYMENT

When calling a service without a valid payment attached (meaning there no X-PAYMENT header is set), the server responds with HTTP 402 error providing pricing and payment details:

{
  "x402Version": 1,
  "error": "X-PAYMENT header is required",
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "1000",
      "resource": "http://localhost:4021/weather",
      "description": "",
      "mimeType": "",
      "payTo": "0x2980bc24bBFB34DE1BBC91479Cb712ffbCE02F73",
      "maxTimeoutSeconds": 60,
      "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
      "extra": {
        "name": "USDC",
        "version": "2"
      }
    }
  ]
}

PreviousProtocol explanationNextGet /weather with X-PAYMENT

Last updated 27 days ago

This response is described here with Payment Required Response & payment Requirements. In our project, we have two objects to deal with it : PaymentRequired & PaymentRequirement.

https://github.com/coinbase/x402?tab=readme-ov-file#type-specifications