Facilitator interface
x402 V2 defines three HTTP operations:| Endpoint | Purpose |
|---|---|
/supported | Lists supported protocol versions, schemes, networks, extensions, and signers |
/verify | Checks a payment payload against its requirements without settling it |
/settle | Submits or completes the payment and returns its settlement result |
/supported during startup or deployment. Do
not advertise a payment option until the selected facilitator confirms support
for that exact x402 version, scheme, and Solana network.
https://x402.org/facilitator. Its /supported response lists the exact
scheme on Solana devnet (solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1) with the fee
payer it signs with:
Verification before fulfillment
The safe request order is:- Parse the
PAYMENT-SIGNATUREpayload with a protocol library. - Match it to the exact
PaymentRequirementsoriginally offered. - Verify the payload locally or through
/verify. - Perform the resource operation only if the chosen payment flow permits post-fulfillment settlement.
- Call
/settleand returnPAYMENT-RESPONSEwith the result.
Treat facilitator responses as payment decisionsAuthenticate facilitator traffic, validate every response, use strict
timeouts, and fail closed. A network error or malformed response is not proof
of payment.
Choose a deployment model
| Model | Use when | Main responsibility |
|---|---|---|
| Managed facilitator | You want the smallest operational surface | Review supported networks, trust model, availability, and data policy |
| Dedicated self-hosted | Several APIs share signing and settlement infrastructure | Secure keys, RPCs, storage, scaling, and upgrades |
| In-process facilitation | One service needs full control and can operate chain components | Keep payment code isolated and prevent request load from exhausting it |
In-process facilitation with Pay
Pay.sh runs in-process facilitation with one command. Its gateway returns the402 challenge, verifies and settles the
payment itself, and then serves or proxies the request to your API, so you don’t
run a separate facilitator. These steps need pay 0.29.0 or later. To try the
flow locally first, run pay --sandbox gate demo.
-
Generate a paywall file:
-
Replace the
forward_url:line inpaywall.ymlwith aroutingblock that points at your API. Inpay0.29.0 the scaffold still writesforward_url, andpay gate apirejects the file withmissing field `routing`:paywall.yml -
Add the x402 scheme to each metered endpoint. Without
schemes, the gateway only offers an MPP charge (mpp/charge), not x402. Withx402-exact, the402response also carries an x402 V2PAYMENT-REQUIREDheader for theexactscheme:Usepaywall.ymlschemes: [x402-exact]to offer x402 only. -
Start the gateway with the wallet that receives payments:
/supported.
Review how it protects fee-payer keys, prevents replay, confirms transactions,
handles partial failures, and reports incidents.
Kora as Solana signing infrastructure
Kora is a Solana signer node with transaction validation and fee-sponsorship policies. An x402 facilitator can use Kora as its signing and submission backend:x402 with Kora
Kora does not replace x402. The resource server and facilitator still implement the x402 V2 objects and endpoints; Kora enforces Solana transaction policy and protects the fee-payer signer behind its RPC interface. Follow the Kora x402 guide for the maintained demo and configuration.Production checklist
Keys and transaction policy
- Store facilitator and fee-payer keys in a hardware-backed or remote signing backend.
- Allowlist the System, Compute Budget, Token, Token-2022, and Associated Token programs only as required by the supported scheme.
- Reject unexpected writable accounts, transfer authorities, recipients, mints, instructions, and compute prices before signing.
- Keep payment-receiving accounts separate from operational fee-payer accounts.
Replay and idempotency
- Persist consumed payment identifiers and transaction signatures in a shared, durable store.
- Make verification and consume atomic so two server instances cannot accept the same authorization concurrently.
- Require an idempotency key for resource operations with side effects.
- Return the original result for a legitimate retry instead of charging again.
Availability and failure handling
- Set bounded timeouts for
/verify,/settle, RPC submission, and confirmation. - Distinguish rejected, expired, pending, confirmed, and failed settlements.
- Do not rebuild or resign a transaction after blockhash expiry without asking the payer to authorize the new transaction.
- Use more than one RPC endpoint and monitor blockhash freshness, confirmation latency, and fee-payer balance.