Life of a paid call
A paid call has two separate outcomes: the result your agent receives and the money eventually collected for it. This page follows the local assay-mcp path after you have enabled paid calls and funded escrow.
How it works
Section titled “How it works”sequenceDiagram participant A as AI client participant L as Local assay-mcp participant S as Assay MCP server participant P as Provider and request verifier participant V as Assay result checks participant E as Escrow contract A->>L: Discover a tool and call it L->>S: Tool call S->>S: Check access, arguments and eligible providers S-->>L: Payment request for selected provider L->>L: Check guards and sign locally L->>S: Same call with signed payment S->>S: Validate payment and reserve funds S->>P: Mapped, signed provider request P->>P: Verify request before serving P-->>S: Result S->>V: Record result for checks S-->>L: Result and receipt, usually VERIFYING L-->>A: Result and receipt V->>V: Apply the tool's policy alt Refund or void V->>S: Release reservation, no collection else Settle the served call V->>S: Allow redemption S->>E: Submit signed payment E->>E: Move customer balance into payment hold alt Timely report upheld S->>E: Refund held payment to customer escrow else Hold ends without a blocking report S->>E: Collect held payment E-->>P: Provider share to payout wallet end endOne call, step by step
Section titled “One call, step by step”- Discover the tool. Your agent reads the tool list or searches and reads a tool’s full description. Discovery supplies its input shape and price. The URL and agent policy determine what it can find.
- Choose a provider. Assay validates arguments and checks available providers against access, provider rules, contract compatibility and payment eligibility. On this paid path it offers a provider without calling that endpoint yet.
- Request payment permission. Assay returns
PAYMENT_REQUIRED. The request identifies the provider, amount, asset, network, escrow, call identity and payment sequence. No provider call or money reservation happens for this unsigned offer. It also offers a payment channel when the client asked for one. - Check and sign locally.
assay-mcpchecks the request against the call it forwarded, a recent quote, its built-in payment configuration, your key permission and limits. It also checks the allowed paid URL, optional provider restriction and any required confirmation. It signs with the local payment key: on a channel, the lane’s new running total (its previous total plus this price); otherwise a per-call payment. Then it resends the same call with the same idempotency key. - Reserve funds and call the provider. Assay checks the signed payment against the call it computes itself. The retry stays with the offered provider and contract version. It reserves the amount before making the mapped provider request. Normal provider requests carry an Assay request signature; stored authentication headers are attached for their configured origin.
- Authenticate and serve. In a signature-protected setup, the provider’s verifier checks the signature, body digest, time window and one-time nonce before the handler runs. The provider returns its data. Assay classifies the response and maps it into the tool’s promised shape.
- Return the result and check it. A usable mapped data result is durably recorded for asynchronous checks. The initial receipt normally says
VERIFYING: the price is held, not yet a final charge. A provider-attributed output shape violation can be refunded immediately. Request or system errors are voided rather than treated as data-quality failures. - Apply the verdict. An enforcing failure releases the reservation and records a provider strike. A misapplied check voids the payment without a strike. A settling decision permits the signed payment to be submitted on chain; the contract moves funds from the customer balance into a payment hold. A channel’s calls are submitted together, about 30 minutes after the first one not yet recorded.
- Collect or refund. With the default collection hold, the on-chain hold lasts at least one hour from redemption (a channel bucket matures at the next full hour after that, so one to two hours; longer if the hold setting is raised above 3,600 seconds). Collection then happens in the provider’s next payout run. Assay waits to collect while a qualifying customer report is open and refunds an upheld report while the held-payment refund remains possible. Otherwise collection pays the provider share and platform fee. Use the receipt’s filing deadline: the guaranteed reporting window ends before collection becomes eligible.
Details that affect integrations
Section titled “Details that affect integrations”| Situation | What it means |
|---|---|
| Result received while checking | You have data, but its final charge is still unresolved. Read the receipt status. |
Served call marked SETTLED |
The service decision is complete. On-chain redemption and provider collection may still be pending. |
| Payment cannot be collected before its signing window lapses | A served call can become owed. Paid calls stop until the debt is settled; free calls remain available. |
| Network timeout | It does not establish whether the provider ran or payment happened. Reuse the logical operation’s idempotency key. |
| Provider is no longer eligible on the signed retry | Assay refuses that payment rather than silently paying another provider. |
The diagram shows a signed paid call to a signature-protected provider. Free calls and API-key-only endpoints take different paths. Read How paying works for payment setup, Retries and idempotency for uncertain outcomes, and API key or signature for provider authentication.
