> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aifinpay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AIFP-1 payment flow

> Understand discovery, quotes, settlement verification and prepaid receipts without guessing transaction calldata.

This page describes the self-hosted AIFP-1 gate flow. It is a protocol
explanation, not a signing workaround for an unsupported client deployment.
Check [current payment support](/pay/paywalled-sites) first.

1. Read the merchant origin's `/.well-known/x402.json` and API parameter catalog.
2. Request a protected resource. HTTP 402 describes its merchant, resource,
   tier, price, minimum batch and receipt scope.
3. Request a fresh quote from the advertised quote endpoint. Inspect the
   amount, asset, chain, expiry and deployment against independently trusted
   client configuration and the owner's budget.
4. Use a supported, verified executor for that deployment. Do not construct
   a transaction solely from untrusted quote calldata or an old ABI example.
5. Submit the transaction reference and the required wallet-bound payment
   authorization to the pay endpoint. Wait for successful verification and a
   quota receipt.
6. Verify the receipt, then retry the resource with `AIFP-Receipt: <receipt>`.
7. Reuse that receipt for subsequent requests within its scope and remaining quota.

<Note>
  Contract generations have different ABIs and guarantees. Legacy `payMatic`
  examples are not instructions for a v1.2 `payNative` deployment, and a v1.3
  executor cannot be pointed at either by changing an address. A protocol label
  such as AIFP-1 does not make the contract generations interchangeable.
</Note>

## What each artifact proves

| Artifact | What it proves |
| - | - |
| Discovery | The site advertises resources and payment endpoints |
| HTTP 402 | The resource requests payment under stated terms |
| Quote | Proposed terms; no funds have moved |
| Successful transaction | Settlement occurred; still verify the correct event and recipient |
| Verified receipt | The issuer recognized payment and granted a scoped quota |
| HTTP 200 with data | The partner accepted the receipt for that request |

Wallet creation, an invoice, or a funded address is not a completed payment.
The [MCP tool reference](/reference/mcp-tools) says which preparation tools
are actually available in the published server.

See [the public agent-flow document](https://github.com/AiFinPay/sdk/blob/main/AGENT-FLOW.md)
for implementation context and the installed package's versioned documentation
for supported executors. Keep transaction recovery state private; never put
raw signing material or bearer receipts in logs or recordings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.