Introduction
In this chapter we describe our extension of the x402 protocol (HTTP-402 payment required) mechanism by integrating with the EIP‑4337 / ERC‑4337 “Account Abstraction / UserOperation” framework, enabling signed user operations to be encoded in the X-PAYMENT HTTP header, forwarded through a TEE-backed facilitator for validation, simulation and on-chain settlement, and thereby delivering a flexible, multi-token, multi-chain payment flow for protected content access.
This extension (“x402 +4337”) offers a path to implement pay-walls and on-demand monetisation of HTTP content, APIs or any resource behind the standard HTTP 402 response, without the need for a dedicated token standard (e.g., ERC-3009) and with full flexibility of account abstraction, sponsored gas, arbitrary callData, and smart‐wallet verification logic.
We will walk through the conceptual background, the detailed flow, the architecture of facilitator and client SDK, features and advantages, and finally implementation and integration guidelines.
HTTP 402 Payment Required (x402)
The HTTP status code 402 Payment Required, while rarely used in the wild, has been proposed (for example in the x402 protocol) as a means to indicate that access to a resource is contingent on a payment. Under a standard x402 implementation, the server responds with 402 and a payload that describes the payment requirements (token, amount, recipient, etc). Once payment is made, the resource is unlocked.
ERC-4337 / Account Abstraction & UserOperation
The ERC-4337 specification enables smart contract accounts to act as first-class wallets via a new pseudo-transaction object called a UserOperation. Key aspects:
The user builds and signs a UserOperation rather than a regular transaction.
A bundler (off-chain service) receives the UserOperation, simulates validation, and then submits it (often batched) to the on-chain
EntryPointcontract.Supports advanced features: paymasters (gas sponsorship, token-fee gas), flexible non-EOA wallets, multi-step logic, ERC-20 gas payment, custom validation logic.
Therefore, using UserOperations allows much richer wallet and payment experiences.
By combining x402 with ERC-4337, we get the best of both worlds: HTTP-level paywall signalling with off-chain→on-chain payment settlement via smart-wallets and account abstraction.
Last updated