Payment Flow
The complete x402 payment lifecycle — from 402 response to settlement.
A detailed walkthrough of the x402 payment flow through the Dunmore gateway.
Step 1: Initial Request (402 Response)
When a client hits a gateway URL without a payment header:
GET https://gateway.dunmore.xyz/my-api/weather
→ 402 Payment Required
→ {
"x402Version": 2,
"accepts": [{
"scheme": "exact",
"network": "eip155:8453",
"maxAmountRequired": "10000",
"resource": "https://gateway.dunmore.xyz/my-api/weather",
"payTo": "0x...",
"maxTimeoutSeconds": 30,
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}]
}
Step 2: Payment Submission
The client signs a USDC payment and resubmits:
GET https://gateway.dunmore.xyz/my-api/weather
X-PAYMENT: <base64-encoded-signed-payment>
→ 200 OK (proxied response from upstream)
Step 3: Verification and Forwarding
The gateway verifies the payment signature and forwards the request to your upstream API. The upstream receives a clean request with no payment headers.
Step 4: Asynchronous Settlement
After the response is sent to the client, the gateway settles the payment on Base. Settlement happens asynchronously — the client doesn't wait for on-chain confirmation.
Step 5: Event Emission
After settlement, events are emitted to the outbox and delivered to all configured subscribers (webhooks, Slack, Discord, Segment, email).