Skip to main content
A site integrated with @aifinpay/gate returns HTTP 402 with protocol: "AIFP-1". One on-chain settlement buys a batch of billing units; subsequent covered requests use an AIFP-Receipt header and consume quota.

Check the client before paying

  • @aifinpay/mcp 2.2.x pays with payable_fetch once the owner enables it.
  • @aifinpay/agent 2.1.x pays with fetchPaid (v14 journal, gas cap and an independent POL/USD rate you supply).
  • Both settle AIFP-1 on Polygon splitter v1.4 in native POL and do not execute a legacy v1.2 quote. The Python SDK does not pay yet.
  • agent.pay and AIFP-1 fetchPaid are different protocol paths; one is not a fallback for a rejected deployment in the other.
If the merchant offers an incompatible route, stop before signing. Installing the skill provides instructions, not a different executor. Consult the installed package’s documentation for its exact configuration requirements.

Discover the resource

Read /.well-known/x402.json on the same origin as the target site. Use its paths, prices and scopes, then read the site’s API catalog for required parameters. Request the chosen route and inspect the 402 minimum batch. A fresh quote supplies chain, asset, amount, merchant and expiry. For example, dev.ratersapp.com publishes both discovery and /api/agent. Its /api/agent/genres was priced at 0.0005perstandardrequestwithanexactscopeanda0.0005 per standard request with an exact scope and a 0.10 minimum batch, settling on Polygon v1.4.

Receipt scope

Read the scope offered by the merchant. Do not assume that buying one endpoint opens the whole site or that a client can widen a scope unilaterally.

Verify the result

A complete supported flow is: quote → approved on-chain settlement → verified receipt → HTTP 200 data → another covered request using the same receipt. The second request must consume quota without creating another transaction. Match the payment transaction with the merchant dashboard’s record. Network gas is separate from the batch price and varies. Keep receipts private: they are bearer credentials for prepaid access. On a timeout after broadcast, recover the existing transaction and receipt before considering any new payment.