Skip to main content
Agentcard lets an agent running in an Anchor session pay with your user’s real card. The card never reaches the agent, the task text, or your servers. The agent types a placeholder card at checkout. The Agentcard SDK, attached to the session, holds the payment request, and the user approves it on their phone with a passkey. Their device swaps in the real card, and the order completes.

What you need

  • An Anchor API key, in ANCHORBROWSER_API_KEY.
  • An Agentcard client_id and client_secret, from the Agentcard dashboard.
  • A user who has stored a card in the Agentcard Vault, and the user_id you received when they stored it. See Adding a card.

Install

Use @agent-cards/sdk 0.20.0 or later. Earlier versions, published under the older name @agent-cards/checkout, refuse a page that has Anchor’s extensions on it.

Attach Agentcard to a session

Create a session, then attach Agentcard to its page before your agent reaches the payment form.
syncRegistry() loads the list of payment processors the SDK can hold. Call it once per client. onApprovalUrl receives a link to the user’s approval screen. Send it from your own app, and keep it out of your logs: only the user should open it.

With Anchor’s agent

Pass the same sessionId to agentTask, so the agent shops in the session Agentcard is attached to. A task created without sessionId runs in a new browser where the SDK is not attached, the store receives the placeholder card, and the purchase fails.
Two things to tell the agent in the task: the placeholder card to type, and that the payment waits for the cardholder after Pay, so it does not click Pay a second time while the user approves. Keep the approval link out of the task, because the agent reads the task. The agent’s summary is not proof that the merchant took the order. Confirm the order with the merchant while the session is still open, then end the session.

Full guide

The complete flow, including attaching to new tabs the agent opens and refusing card requests from tabs the SDK has not reached, is in Agentcard’s docs: Agentcard with Anchor.