Skip to main content
Presets are optional. Without them, every Vault purchase goes through as usual. Presets are the rules you put on what an agent may buy: a spend cap, a merchant list, a currency, a time window. A preset can apply to one of a user’s stored cards. Save a preset under a name of your choice, then attach it where it should apply.
Once you attach a preset, Agentcard judges each purchase it covers. A purchase made outside of the preset rules is refused, nothing is charged, and you are told which preset and which rule(s) refused it. Attach a preset when you want a purchase-level restriction, guarding against how much a particular agent or set of agents should spend in a day, for example. You can also use presets while you build: set a tight preset to test your work before shipping to production. The rules and their refusal codes are the ones a card preset uses.

Choose what to restrict

Pick the rules the preset holds when you save it. Caps count separately for each card the preset is attached to. Caps use the amount the processor charges. Send amount to have a purchase judged the moment your agent opens it. Available preset parameters: Caps are in US dollars. A purchase whose processor names no amount, with no amount from your agent, is refused right before the card is sent with amount_unknown, and a purchase in another currency is refused for the currency.

Attach to a card

Attach a preset to one of a user’s stored cards, and every purchase paid with that card follows it. Read the card id from the user’s stored cards, or from the id in the vault.card_stored event:
Attach the preset to that card:
A card id that is not one of your users’ cards is refused:
From now on office-supplies judges every purchase paid with that card. Your agent opens a purchase on the card by sending card_id on the checkout authorization; at a merchant the preset does not allow, the call answers HTTP 403 and no authorization exists:
Send card_id, or leave the user with exactly one stored card, and Agentcard judges the card’s presets the moment your agent opens the purchase; otherwise it judges them right before the card is sent, once the user has chosen and unlocked a card. To stop using the preset on that card, detach it with the same body:
A per-day cap attached to a card counts that card’s purchases alone. Attach the same preset to two cards and each has its own $50 a day.

Combine several presets

When one or more presets apply to a purchase, the purchase must satisfy all of them. Agentcard judges each purchase against every attached preset, and any that would cause a refusal are named in the response.

Read a refused purchase

Agentcard checks a purchase twice: when your agent opens it, and again right before the card is sent, after the user approves. If a preset refuses at the second check, the user sees:
Your agent reads the same outcome when it reads the authorization back: status is declined, with the preset and the rule named. A purchase every attached preset allows is approved and paid like any other.

Replace or delete a preset

Read your presets, or one preset and where it is attached:
To replace a preset, save the same name again. The new rules apply everywhere it is attached. Purchases already counted toward a cap stay counted, so tightening a rate at noon does not reset the day. To delete a preset, remove it by name. It stops judging every purchase it was attached to:
Save the same name again later and its caps start from zero.

Relax restrictions

You can relax a preset’s restrictions by changing what it does when a purchase breaks a rule: a warning instead of the default refusal. Set "mode": "watch" on the preset, or save the same rules under a second preset with "mode": "watch". For example, a currency rule:
Attach it, and a purchase in another currency goes through. Once the charge is recorded you are told, with the preset and where it is attached named:
Every rule relaxes the same way. A watched cap says by how much the purchase went over it.

Receive the notices

Every refusal and every watched purchase sends one notice, three ways: an event to your webhook, an email to your billing contact and your account’s owners and admins, and a post in your Slack conversation with Agentcard once you have connected it. A test-mode purchase sends the webhook only. Every notice names the preset, where it is attached, the rule, and what to do next. A refusal when your agent opens the purchase is a checkout_authorization.refused event. It has no authorization id, because none was created:
A refusal right before the card is sent is a checkout_authorization.declined event with the same fields. A watched purchase is a checkout_authorization.watched event, sent after approved. See Checkout authorization events. The email for the refusal above:
The Slack post for the same refusal:

Look up a refusal code

Codes from merchant_denied down are returned when your agent opens the purchase or right before the card is sent. The first three are returned when you save or attach. Every refusal names the preset that refused and the card it is attached to, with its last four digits. When several presets refuse the same purchase, refusals lists each one, and the top-level fields are the first.