Skip to main content
Your agent builds the cart the way it already does: in a real browser, on the merchant’s own website. Agentcard does not change how the agent shops. It attaches to the browser and waits for the moment the checkout form sends the card to the payment processor. There is one rule: attach before the agent reaches the payment form. The SDK has to be watching when the page tries to send the card.

Choose a browser

The SDK attaches to any Playwright Chromium page, which means it works with: Your agent keeps control of the browser during approval and afterward.

Install

You need your Agentcard client_id and client_secret on your server, and the user_id of the person whose card will pay (from Adding a card).

Attach to the page

string
required
The Agentcard user whose vaulted card pays.
string
required
Shown on the approval screen. Pass what the user would recognize.
number | string
Your hint at the amount: an integer in the currency’s smallest unit (2306 for $23.06), or a decimal string in normal units ("23.06"). Pass with currency. Caps use the amount the processor charges. Send amount to have a purchase judged the moment your agent opens it.
string
ISO 4217 code for amount. Required with it.
function
Called with the approval link the moment the payment pauses. Deliver it to the user in your own thread or app.

Two things that break attachment

  • Service workers. Use a context with serviceWorkers: 'block'. Playwright cannot intercept requests from an already-active service worker, so the SDK refuses to attach to one.
  • Attaching too late. If the agent has already submitted the payment form, there is nothing to pause. Attach right after you get the page, before navigation.

Don’t want a browser?

Agentcard’s Purchase API builds the cart and completes the checkout for you on the merchants it covers (Amazon, Walmart, Target, DoorDash, and more). No browser to run, same passkey approval for the user.