Skip to main content
x402 is an open protocol that enables payments over HTTP using standard request/response headers. It extends the HTTP 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:
1

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.
2

Payment

The client reads the terms, constructs and signs a transaction (or authorization) on-chain, and builds a PAYMENT-SIGNATURE header containing the proof.
3

Settlement (POST)

The client calls POST /v1/invoices/{id}/x402/{chain} with the PAYMENT-SIGNATURE header. Gwop verifies the transaction on-chain, marks the invoice as PAID, and returns HTTP 200 with a PAYMENT-RESPONSE header containing the settlement receipt.

Headers

All x402 data is transported in HTTP headers. Each header value is a base64-encoded JSON object.
HeaderDirectionWhen
PAYMENT-REQUIREDResponseReturned on GET (discovery). Contains payment terms.
PAYMENT-SIGNATURERequestSent on POST (settlement). Contains payment proof.
PAYMENT-RESPONSEResponseReturned 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:
ChainEndpointNetwork (CAIP-2)
Base/v1/invoices/{id}/x402/baseeip155:8453
Solana/v1/invoices/{id}/x402/solanasolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp

Recovery

If an agent sends funds on-chain but fails to construct the PAYMENT-SIGNATURE header (crash, timeout, encoding error), the recovery endpoint allows settlement using a flat JSON body instead of the base64 header:
POST /v1/invoices/{id}/x402/{chain}/recover
{
  "settlement_id": "req_...",
  "tx_hash": "0x..."
}
The 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.

Support

If you’re building an agent or wallet that integrates with Gwop’s x402 endpoints, contact support@gwop.io. We can help with header construction, test invoices, and debugging settlement failures.