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

# Agent purchases

> Let an agent buy with a business card, one approved purchase at a time.

> [!NOTE]
>
> Spend is in preview. Contact Ionic to enable it for your account.

With Spend, an agent asks to use a business card for a specific purchase. The
business owner sees the seller, amount, and purpose, and approves or declines.
After approval, a browser worker you run receives short-lived card details and
completes checkout.

## How it works

1. A business owner adds a card and chooses which agents can use it.
2. The agent requests approval for a purchase.
3. The owner approves it in Ionic, within any spending limits they set.
4. Your browser worker claims the card details and completes checkout.
5. Your platform records the seller's order confirmation.

Each step has its own permission: access to the business, access to a card,
and approval for each purchase. The owner approves every purchase, even one
within their limits.

> [card] [Build the integration](https://docs.ionicfi.com/guides/spend-platform-integration.md)
>
> Add a card, request approval, and claim the card in your browser worker.

> [card] [Manage cards and approvals](https://docs.ionicfi.com/guides/spend-card-access.md)
>
> Steps for business owners: card access, limits, and purchase decisions.

> [card] [Test and recover](https://docs.ionicfi.com/guides/spend-testing.md)
>
> Test approvals, retries, revoked access, and interrupted checkouts.

> [card] [API reference](https://docs.ionicfi.com/api-reference/spend-intents.md)
>
> Spend intents, cards, and setup sessions.

## Objects and who calls them

| Object | What it does |
| - | - |
| [Setup session](https://docs.ionicfi.com/api-reference/spend-setup-sessions.md) | A hosted page where a business owner adds a card. |
| [Card](https://docs.ionicfi.com/api-reference/spend-cards.md) | A business card an owner has made available to your agent. |
| [Spend intent](https://docs.ionicfi.com/api-reference/spend-intents.md) | One purchase request, from approval to card delivery. |

| Endpoint | Key | Permission |
| - | - | - |
| `POST /v1/spend/setup_sessions` | Business or platform secret key | `spend:write` |
| `GET /v1/spend/setup_sessions/{id}` | The business or platform that created it | `spend:read` |
| `GET /v1/spend/cards` | Agent secret key | `spend:read` |
| `POST /v1/spend_intents` | Agent secret key with access to the card | `spend:write` |
| `GET /v1/spend_intents` | Agent secret key | `spend:read` |
| `GET /v1/spend_intents/{id}` | The agent that created it | `spend:read` |
| `POST /v1/spend_intents/{id}/claim` | The agent that created it | `spend:write` |
| `POST /v1/spend_intents/{id}/cancel` | The agent that created it | `spend:write` |

A platform acting for a connected business also sends `Ionic-Account`. Only a
business owner can approve a purchase, in the Ionic dashboard.

## Confirm the purchase with the seller

A `claimed` spend intent means Ionic delivered the card details. The seller's
order confirmation is your proof of purchase, so record it in your own system.
If checkout may have been submitted, check with the seller before trying again,
so the business isn't charged twice.


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