check_purchase
Before you pay for something, ask whether your owner's spend policy lets you pay this price to this seller. Works for any purchase, whatever wallet or checkout you pay with. Returns a decision (allow, deny or ask), a reason code and a reason. allow comes with a reservation: the amount is held against today's cap, so make the purchase, then call settle_purchase with outcome paid (and the amount paid) or failed. ask means a person approves first; once they have, send the same check again. deny means do not buy. With include_fair_price, or when the policy asks for it, the price is also judged by verify_price and its verdict and band come back with the answer. Needs a Last Price credential with price compute scope. Needs a claimed workspace: a sandbox key from self-registration is refused (403) until a person claims the workspace.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | No | Optional: what you are buying. | |
| amount | Yes | The price you are about to pay. | |
| intent | No | Optional: what the buyer approved for this purchase, from an American Express intent, an AP2 intent mandate, or declared by you. A purchase that names another seller, costs more than max_amount (counting every purchase under the same intent_id), is in another currency or comes after expires_at is denied, whatever the policy allows. evidence (the token or mandate) is kept only as a hash and is not verified yet. Only where the workspace has intents switched on (else an error with code not_released). | |
| pay_to | No | Optional: the wallet address (bare or CAIP-10) or merchant account id the money goes to. A person's approval is then for that account only, and confirm_purchase and settle_purchase must name the same one: another is refused with code payee_changed. Only where the workspace has payee binding switched on (else an error with code not_released). | |
| quotes | No | Optional: competing offers for this purchase, yours among them. A procurement policy needs two above its two-quote threshold. | |
| seller | Yes | Who you are paying: a store, domain, API or wallet name. | |
| agent_id | No | Only with a workspace-wide key: check on behalf of this agent. An agent key always checks as itself. | |
| category | No | Optional: its category, when the policy limits categories. | |
| currency | No | Three-letter ISO currency code. Defaults to USD. | |
| agentid_token | No | Your AgentID ID token, issued for Last Price, when your owner's policy lets only verified agents spend. Sent as the AgentID-Token header. | |
| include_fair_price | No | Also judge the price with verify_price and return its band. |