Skip to main content
Use a capped EIP-2612 permit when the final total is unknown at authorization time, such as an open tab, a post-service tip, or shipping calculated during fulfillment. EIP-3009 fixes the exact value, so it cannot partially capture one authorization.

Demo

The demo above is mock only. If you want to see onchain demos on Vibenet, head to Base chain demos.

Constrain the Allowance in a Checkout Contract

This contract accepts the permit and transfers the actual amount in the same transaction. It has no general-purpose transfer function, requires the merchant caller, and allows each order ID once.
VariableAmountCheckout.sol

Sign the Maximum and Capture the Actual Total

TypeScript
The PaymentCaptured event records both the signed maximum and the actual amount, and the merchant receives only the actual amount.
A permit deadline limits when the permit signature can be submitted; it does not make an ERC-20 allowance expire after submission. Use a reviewed, immutable checkout with no path that can spend leftover allowance, keep the deadline short, and never use a merchant EOA as the capped spender.

See Also

Settle Usage-Based Payments

Use x402 upto when an API computes the final charge.

Verify a Payment

Confirm the resulting token transfer before fulfillment.