402 Payment Required status code into a full payment flow: discovery, authorization, settlement, and receipt — all within a single resource loop.
Gwop implements x402 natively. Every invoice automatically generates chain-scoped x402 endpoints. Agents, wallets, and any x402-compatible client can discover payment terms, construct a payment, and settle — without custom integration.
How it works
The x402 flow is a three-step resource loop on a single endpoint:Discovery (GET)
The client calls
GET /v1/invoices/{id}/x402/{chain}. The server returns HTTP 402 with a PAYMENT-REQUIRED header containing the payment terms: amount, asset, recipient address, and timeout.Payment
The client reads the terms, constructs and signs a transaction (or authorization) on-chain, and builds a
PAYMENT-SIGNATURE header containing the proof.Headers
All x402 data is transported in HTTP headers. Each header value is a base64-encoded JSON object.| Header | Direction | When |
|---|---|---|
PAYMENT-REQUIRED | Response | Returned on GET (discovery). Contains payment terms. |
PAYMENT-SIGNATURE | Request | Sent on POST (settlement). Contains payment proof. |
PAYMENT-RESPONSE | Response | Returned on POST (success). Contains settlement receipt. |
Facilitators
Gwop manages the facilitator infrastructure for x402 settlement. The facilitator is responsible for verifying on-chain transactions and confirming that the correct amount, asset, and recipient were settled. Merchants do not need to run facilitators. Gwop operates facilitators on both Solana and Base, and the invoice endpoints route through them automatically.Chains
Gwop supports x402 on two chains. Each has a dedicated endpoint per invoice:| Chain | Endpoint | Network (CAIP-2) |
|---|---|---|
| Base | /v1/invoices/{id}/x402/base | eip155:8453 |
| Solana | /v1/invoices/{id}/x402/solana | solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp |
x402 on Base
EIP-3009 transferWithAuthorization flow.
x402 on Solana
SPL token transfer with fee payer support.
Recovery
If an agent sends funds on-chain but fails to construct thePAYMENT-SIGNATURE header (crash, timeout, encoding error), the recovery endpoint allows settlement using a flat JSON body instead of the base64 header:
settlement_id is returned in the PAYMENT-REQUIRED header during discovery (in accepts[0].extra.settlementId). The tx_hash is the on-chain transaction hash.
Recovery uses the same verification pipeline as normal settlement — it just removes the base64 encoding requirement.
