Choose a browser
The SDK attaches to any Playwright Chromium page, which means it works with:- KERNEL: connect over
cdp_ws_url. KERNEL also ships a native Agentcard integration that needs no SDK. Pick one per checkout. - Browserbase: connect over the session’s
connectUrl. - Any CDP browser: supply its CDP URL.
Install
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
What the user approves, as an integer in the smallest unit (2306 for $23.06). Pass with
currency. On a Stripe PaymentIntent confirm, Agentcard holds the processor to this amount. Elsewhere it is shown and reported.string
ISO 4217 code for
amountCents. Required with it.function
Called with the approval link the moment the payment pauses. Deliver it to the user through your own channel.
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.