Skip to main content

Paying a payment link with x402

A merchant who has switched on Agent payments lets any x402 v2 agent pay their payment links. Funds move straight from the agent’s wallet to the merchant’s wallet. BlankFX pays the gas and records the payment.
Sepolia (testnet) and test tokens only, switched on per environment. Ethereum (mainnet) is not yet supported. This route needs no API key and is served at https://api.blankfx.org/x402/pay/{payment-link-id} (not under /public/v1).

The flow

An x402 client library does both steps for you.

What the 402 tells the agent

One-time setup for the agent’s wallet

1

Approve Permit2 once

None of the BlankFX Sepolia tokens support EIP-3009, so payment uses Permit2. Do a one-time ERC-20 approve of the token to the canonical Permit2 contract 0x000000000022D473030F116dDEE9F6B43aC78BA3. The agent pays that gas itself. The approval costs roughly 136,000 gas on these tokens, so if your client sets a gas limit by hand, use at least 200,000. Without it BlankFX answers 412 (PERMIT2_ALLOWANCE_REQUIRED), reserves nothing, and the official client does not approve for you.
2

Allow the token in your client

The official client refuses any token missing from its built-in default list. Add the BlankFX token to spendControls.allowedAssets, or the payment fails with “rejected by spendControls”.
3

Raise the cap if needed

The client caps each payment at $1 by default. For an allow-listed token, set maxAmountPerPayment on its entry.

Minimal client

Verified with @x402/fetch and @x402/evm v2.28.0, including a live payment on Sepolia (October 2026).

Example: what a successful payment looks like

For a 1 USDC invoice with a 0.05% transfer fee, the 402 asks for 1000500 (6 decimals, so 1.0005 USDC). After the signed retry the response is 200 and the PAYMENT-RESPONSE header decodes to:
The body is the invoice with paidVia: "x402". The merchant sees the payer and the fee in Payment Status; nobody else does.

What BlankFX checks before it spends gas

  • The recovered signer equals the payer.
  • The recipient, token and exact amount equal the challenge BlankFX issued (not what the client echoes).
  • The authorization has 30 to 90 seconds of validity left.
  • The Permit2 nonce is unused.
  • The wallet holds the amount and has approved Permit2.
  • The payer’s wallet is not suspended and stays within the $2,000/day cap for unverified wallets, the same checks a human payer meets.

Errors

errorReason codes on a 402: Chain error text is never returned. If settlement is still confirming, retry the same signed payment: it returns the current state and never sends a second transaction.

Not supported yet

EIP-3009 tokens (none on Sepolia), converting between coins, gas-sponsored approvals, browser-based agents (no CORS on this route) and mainnet.