permit() function (e.g., USDC). The client signs an off-chain permit authorizing the Permit2 contract, and the facilitator submits it atomically during settlement via x402ExactPermit2Proxy.settleWithPermit.
Overview
When using the Permit2 asset transfer method, the user must first approve the Permit2 contract to spend their tokens. For tokens that support EIP-2612, this approval can be done entirely off-chain:- For Buyers: No gas needed — sign a permit off-chain and the facilitator handles the rest
- For Sellers: Advertise this extension so clients using EIP-2612 tokens get a seamless experience
- For Facilitators: Accept the permit signature and call
settleWithPermitto atomically approve + settle in one transaction
How It Works
- Server advertises
eip2612GasSponsoringin thePaymentRequiredresponse extensions - Client checks if Permit2 allowance is insufficient; if so, signs an EIP-2612 permit off-chain
- Client includes the permit data in the
extensions.eip2612GasSponsoring.infofield of the payment payload - Facilitator calls
x402ExactPermit2Proxy.settleWithPermit(), which atomically submits the EIP-2612 permit and executes the Permit2 transfer in a single transaction
Server Usage
Advertise support for this extension in your route configuration:- TypeScript
- Go
- Python
Client Usage
TheExactEvmScheme handles EIP-2612 gas sponsoring automatically. When the server advertises this extension and the client’s Permit2 allowance is insufficient, the scheme signs the EIP-2612 permit and includes it in the payment payload.
- TypeScript
- Go
- Python
When to Use
Use this extension when:- Your payment token implements EIP-2612 (has a
permit()function) - You want fully gasless Permit2 onboarding for your users
- You’re using the
permit2asset transfer method
SDK Support
| SDK | Supported |
|---|---|
| TypeScript | ✅ |
| Go | ✅ |
| Python | ✅ |