# Sapiom Pay > Let your AI agent buy for each of your users with their own saved card. Sapiom vaults each user's card, authorizes every transaction against real checkout facts, and fills the card into checkout without your agent ever seeing it. > ## Agent Instructions > Sapiom Pay is for platforms whose agent shops for many end users. Each end user is a buyer with their own Sapiom key and saved cards. > Use the buyer's key for every call made on that buyer's behalf. Never use one buyer's key for another user, and never give the agent the platform key. > Backends call the REST API at https://api.sapiom.ai/v1. Agents can also call the hosted MCP tools at https://api.sapiom.ai/v1/mcp/pay. Both take the key in an x-api-key header. > Keys that start with sk_test_ reach the sandbox, a separate test environment with its own buyers and cards, at the same addresses. Use test card numbers only there. > Never ask a buyer for a card number, expiry date or CVV in chat. Buyers enter card details only on Sapiom's hosted pages. > Check the merchant before buying. Use purchase.type ucp_checkout only when the merchant check returns supported. Otherwise use browser_checkout. > Follow the nextAction in each transaction result. Action links are secrets for the intended buyer only. > Use one idempotency key per transaction. Resume an unanswered create with the same request and key. If a UCP update or cancellation is uncertain, stop and hand off to a person. If a browser cancellation is uncertain, read the transaction and resend the same cancellation, with the same key, only if it is not closed. Never start a new transaction to escape an uncertain outcome. > For a ucp_checkout purchase, report an order as placed only when order.outcome is confirmed; if it is unknown, stop and hand off to a person. A browser_checkout purchase has no order confirmation (order is null): confirm the order on the merchant's page. - [Sapiom Pay for agents](https://docs.sapiom.ai/index.md): Give every user of your agent their own card vault. Sapiom authorizes each transaction and fills the card into checkout without the agent seeing it. - [Quickstart: set up your first buyer](https://docs.sapiom.ai/quickstart.md): Create a buyer for a test user, save a card for them, and connect your agent as that buyer. No transaction is made. - [How Sapiom Pay works](https://docs.sapiom.ai/how-it-works.md): Who does what in a Sapiom Pay transaction, why Sapiom needs checkout details before releasing a card, and how the real card reaches checkout. - [Test your Sapiom Pay integration in the sandbox](https://docs.sapiom.ai/sandbox.md): The Sapiom sandbox enables you to test a Sapiom Pay integration using test keys, test cards, and a test store. The API is the same as in production. - [Get a platform key to manage buyers](https://docs.sapiom.ai/buyers/platform-keys.md): Create a Sapiom platform key in the dashboard and give each user their own isolated buyer and buyer key. - [Manage buyers](https://docs.sapiom.ai/buyers/create-buyers.md): Create a buyer and buyer key for each of your users, handle buyers that already exist, store keys safely and remove buyers. - [Connect the agent](https://docs.sapiom.ai/buyers/connect-agent.md): Open each buyer's MCP connection with that buyer's key, and give your agent the rules it needs to pay safely. - [Save a buyer's card with a hosted setup link](https://docs.sapiom.ai/cards/vault-a-card.md): Send your user a hosted link to save their card, confirm the card is ready, and manage saved cards. - [Show your brand on Sapiom's hosted pages](https://docs.sapiom.ai/cards/brand-hosted-pages.md): Set the name and logo your users see when they save a card or approve a transaction. - [Authorize a transaction](https://docs.sapiom.ai/transactions/authorize.md): Create a transaction for a merchant's UCP checkout or for a checkout page your agent completes, then follow each nextAction until payment is ready. - [Pay in the browser](https://docs.sapiom.ai/transactions/browser-pay.md): Attach the Browser Pay SDK to the browser that runs checkout, so the merchant receives the real card while your code only handles a placeholder. - [Use Browser Pay with Anchor](https://docs.sapiom.ai/transactions/browsers/anchor.md): Get an Anchor browser session's CDP WebSocket URL for Browser Pay, then end the session when checkout ends. - [Use Browser Pay with Kernel](https://docs.sapiom.ai/transactions/browsers/kernel.md): Get a Kernel browser's CDP WebSocket URL for Browser Pay, then delete the browser when checkout ends. - [Use Browser Pay with Browserbase](https://docs.sapiom.ai/transactions/browsers/browserbase.md): Get a Browserbase session's CDP WebSocket URL for Browser Pay, then release the session when checkout ends. - [Use Browser Pay with Browser Use](https://docs.sapiom.ai/transactions/browsers/browser-use.md): Get a Browser Use browser's CDP URL for Browser Pay, then stop the browser when checkout ends. - [Confirm the order and recovery](https://docs.sapiom.ai/transactions/confirm-and-recover.md): Read the transaction until the card is sent, confirm the order with the merchant, refresh a UCP checkout when asked, and retry without buying twice. - [Integration checklist](https://docs.sapiom.ai/transactions/integrator-checklist.md): What your integration stores, compares and does at each step of a purchase. A failed checkout must not block the buyer or pay twice. - [Cap what a buyer's card can spend](https://docs.sapiom.ai/controls/spending-limits.md): Set per-transaction, per-period and date-range limits on a buyer's saved card. - [How card data is handled](https://docs.sapiom.ai/security/card-data.md): Who sees a saved card, how the real card reaches the merchant, and what that means for your PCI scope. - [Webhooks](https://docs.sapiom.ai/coming-soon/webhooks.md): Get notified when a buyer saves a card or a transaction needs attention, instead of polling. - [Issue cards](https://docs.sapiom.ai/coming-soon/issued-cards.md): Early access: card issuing for agent platforms, with transaction-specific virtual cards, approval controls and payment updates. - [Sapiom Pay API overview](https://docs.sapiom.ai/api-reference/overview.md): Base URLs, keys, permissions and idempotency for the Sapiom Pay REST API, MCP tools and Browser Pay SDK. - [Create a buyer](https://docs.sapiom.ai/api-reference/buyers/create-a-buyer.md): Creates a buyer (a tenant) for one of your users. Use your own user ID as `externalId`. Returns `409` when a buyer with that `externalId` already exists. Requires your [platform key](/api-reference/overview#authentication). - [List buyers](https://docs.sapiom.ai/api-reference/buyers/list-buyers.md): Lists your buyers. Find the buyer for one of your users with `filter[externalId]`. Requires your [platform key](/api-reference/overview#authentication). - [Delete a buyer](https://docs.sapiom.ai/api-reference/buyers/delete-a-buyer.md): Removes a buyer. Requires your [platform key](/api-reference/overview#authentication). - [Create a buyer key](https://docs.sapiom.ai/api-reference/buyers/create-a-buyer-key.md): Creates an API key for one buyer. The response includes `plainKey`, which is shown only once. Requires your [platform key](/api-reference/overview#authentication). - [Create a setup link](https://docs.sapiom.ai/api-reference/cards/create-a-setup-link.md): Create a link to the hosted page where a cardholder adds a card for this tenant. Requires a [buyer key](/api-reference/overview#authentication). - [Get a setup link](https://docs.sapiom.ai/api-reference/cards/get-a-setup-link.md): Get a card setup link, including the card it added once completed. Requires a [buyer key](/api-reference/overview#authentication). - [List cards](https://docs.sapiom.ai/api-reference/cards/list-cards.md): List the tenant's current payment cards and whether each is ready for agent transactions. Requires a [buyer key](/api-reference/overview#authentication). - [Get a card](https://docs.sapiom.ai/api-reference/cards/get-a-card.md): Get a payment card, including a removed one. Requires a [buyer key](/api-reference/overview#authentication). - [Set the default card](https://docs.sapiom.ai/api-reference/cards/set-the-default-card.md): Make a card the tenant's default: the one a card payment uses when it names none. Requires a [buyer key](/api-reference/overview#authentication). - [Remove a card](https://docs.sapiom.ai/api-reference/cards/remove-a-card.md): Remove a payment card. It can no longer pay from the moment this returns. Requires a [buyer key](/api-reference/overview#authentication). - [Get spending limits](https://docs.sapiom.ai/api-reference/spending-limits/get-spending-limits.md): Reads a card's spending limits, the saved `version` to send when you change them, and how much of each limit the card has used. Requires a key with `org.read` to read limits or `org.write` to set them, such as your [platform key](/api-reference/overview#authentication), and the buyer's ID in the `sa… - [Set spending limits](https://docs.sapiom.ai/api-reference/spending-limits/set-spending-limits.md): Replaces a card's spending limits. Send the `version` from [Get spending limits](/api-reference/spending-limits/get-spending-limits), or `0` the first time, and `null` for any limit you don't want. Returns `409` when that version is out of date or the card can't be used. Requires a key with `org.rea… - [Check a merchant](https://docs.sapiom.ai/api-reference/merchants/check-a-merchant.md): Checks whether a merchant offers a UCP checkout Sapiom can drive. When `status` is `supported`, create the transaction with `purchase.type: "ucp_checkout"`. Otherwise, use `browser_checkout` and complete the merchant's checkout page in a browser with Browser Pay attached. Requires a [buyer key](/api… - [Create a transaction](https://docs.sapiom.ai/api-reference/transactions/create-a-transaction.md): Creates a transaction that buys from one merchant with one of the buyer's saved cards. Declare what it buys in `purchase`: `ucp_checkout` sends the merchant's UCP checkout, which Sapiom drives; `browser_checkout` states the merchant and total of a checkout page your agent completes in a browser. Nam… - [Get a transaction](https://docs.sapiom.ai/api-reference/transactions/get-a-transaction.md): Returns the transaction's `purchase`, `order`, `version` and `nextAction`. `nextAction` uses the same `type` and `actor` values as the MCP tools. To wait for a change, pass `maxWaitSeconds` and your last `version` as `since`. Requires a [buyer key](/api-reference/overview#authentication). - [Cancel a transaction](https://docs.sapiom.ai/api-reference/transactions/cancel-a-transaction.md): Cancels the transaction. For `ucp_checkout`, Sapiom cancels the merchant checkout first, then the card payment. For `browser_checkout`, Sapiom cancels the card payment and the placeholder stops working. Cancelling again does nothing. Returns `409` once it's too late: `card_relayed` after your agent… - [Open the checkout](https://docs.sapiom.ai/api-reference/transactions/open-the-checkout.md): Discovers the merchant named in the transaction's request facts, negotiates, and creates the merchant checkout. The merchant cannot be changed by this call. A body carrying payment data is rejected. Requires a [buyer key](/api-reference/overview#authentication). - [Get the checkout](https://docs.sapiom.ai/api-reference/transactions/get-the-checkout.md): Hands any newer merchant evidence to governance first, then returns the checkout, session, governance, payment, and `nextAction`: what the agent should do next. With `maxWaitSeconds`, waits for something to act on: until `nextAction` is not `wait`, or, with `since`, until the envelope `version` diff… - [Replace the checkout](https://docs.sapiom.ai/api-reference/transactions/replace-the-checkout.md): Forwards a full-replacement update to the merchant. Payment data is rejected; credentials are never accepted here. One merchant operation per checkout is in flight at a time. Requires a [buyer key](/api-reference/overview#authentication). - [Cancel the checkout](https://docs.sapiom.ai/api-reference/transactions/cancel-the-checkout.md): Cancels at the merchant and closes the governing transaction. Cancelling a cancelled checkout is a no-op. Requires a [buyer key](/api-reference/overview#authentication). - [Refresh the checkout](https://docs.sapiom.ai/api-reference/transactions/refresh-the-checkout.md): Gets the merchant's current checkout without changing anything there. Call it when `nextAction.type` is `reconcile_checkout`, or after `payment_submitted` to learn whether the order completed. Then read the transaction for `order`. Requires a [buyer key](/api-reference/overview#authentication). - [Relay a card request](https://docs.sapiom.ai/api-reference/browser-pay-relay/relay-a-card-request.md): Sends a card request that Browser Pay paused in the buyer's browser on to the payment provider. The request carries the transaction's placeholder card; the card provider replaces it with the real card, at most once per placeholder. The response is the payment provider's answer, or a typed refusal. R… - [Sapiom Pay MCP tools reference](https://docs.sapiom.ai/api-reference/mcp-tools.md) - [Browser Pay SDK reference](https://docs.sapiom.ai/api-reference/browser-pay-sdk.md): Exports, options, events and reason codes for the @sapiom/browser-pay package. - [Sapiom Pay errors and how to handle them](https://docs.sapiom.ai/api-reference/errors.md): Error shapes for Sapiom Pay MCP tools, the transaction error codes, and which errors are safe to retry. ## OpenAPI Specs - [openapi](/api-reference/openapi.json) This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.