> For the complete documentation index, see [llms.txt](https://docs.goassay.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.goassay.ai/start-here/how-it-works.md).

# How it works

Follow one paid tool call from your AI's request to a payout or refund.

Here is what happens to one paid call and its money, from request to payout or refund. The example assumes a local AI app, USDG already in escrow and approved spending limits. A free call skips the payment steps and earns the provider nothing.

```mermaid
flowchart TD
    A[AI asks for a tool] --> B[Local app checks payment permission]
    B --> C[Price reserved in your escrow]
    C --> D[Provider answers; Assay checks]
    D -->|No charge| E[Reservation released to your balance]
    D -->|Charge allowed| F[Payment held in the contract]
    F -->|Timely report accepted| G[Refund to your escrow]
    F -->|Ready to collect| H[Provider wallet receives its share]
```

## One call, step by step

{% stepper %}
{% step %}

### Your AI chooses a tool

It reads what the tool does, its inputs and price. Assay finds an eligible provider. **Money:** your deposit is still in escrow; choosing a tool does not pay anyone.
{% endstep %}

{% step %}

### Your local app approves the payment

The local assay-mcp app checks the payment request against your approved limits and signs it with your payment key. This key is separate from your wallet's key. **Money:** still in your escrow balance, with no provider payment yet. Without permission, the paid call stops here.
{% endstep %}

{% step %}

### Assay reserves the price and asks the provider

Assay checks the signed permission, reserves the call amount and sends the tool request to the chosen provider's API. **Money:** still in escrow, but the reserved amount is unavailable for other calls or withdrawal.
{% endstep %}

{% step %}

### The answer arrives and the checks run

Assay records what came back and checks it against the tool's rules. Your AI may receive the answer while checks are still running. **Money:** remains reserved. A result labelled **Checking** has no final charge yet.
{% endstep %}

{% step %}

### Assay decides whether to charge

If an active check finds a provider failure, the reservation is released. A call allowed to charge moves into a payment hold on chain. **Money:** either available again in your escrow balance, or held by the contract until the provider is paid. The receipt shows which checks ran.
{% endstep %}

{% step %}

### The held payment is refunded or collected

The payment hold lasts one hour from the moment the payment is recorded on chain. Use the receipt's **Refundable until** time, not the time you received the answer. A report filed before then pauses collection and, if accepted, returns the full amount to your escrow. After that time you can still report a bad result for up to 7 days, but it no longer refunds the call; it counts toward the provider's quality record.

**Money:** stays in the contract until refunded to your balance or collected. Collection sends the provider's share to its payout wallet and Assay's included fee to Assay. A completed payout cannot be pulled back through this refund flow. If a served call's payment cannot be collected, it becomes **Owed** and paid calls pause until you settle it. If it stays uncollected for too long it is marked **Written off**: the provider is not paid, but you still owe it and paid calls stay paused until you settle it.
{% endstep %}
{% endstepper %}

## What the receipt tells you

The receipt shows the listed price, what you paid, what was not charged, any amount still held or owed, and which checks ran. If the checks missed a bad answer, use **Report a bad result** on the receipt. A refund returns to your Assay balance; moving it to your wallet is a separate withdrawal.

## Next

* Ready to start? [Create your account](https://docs.goassay.ai/use-tools/create-your-account).
* Want the technical sequence? See [Life of a paid call](https://docs.goassay.ai/developers/overview/life-of-a-call).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.goassay.ai/start-here/how-it-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
