Level 1: You use Playwright
Attach to your Playwright page. This is the same code as every other browser, with your own launch instead of a provider’s.chromium.launch() with chromium.connectOverCDP(yourCdpUrl).
Level 2: You speak CDP directly
Not on Playwright? The SDK also exposesattachToCdp. Give it a browser-level, session-aware CDP connection wrapped in its two-method CdpLike interface (send a command, subscribe to events). The SDK needs the browser level, not a single page session, because card fields live in cross-origin iframes that are separate CDP targets and it attaches to each one.
Level 3: You do your own interception
If you already intercept network requests in your browser, skip the SDK and make the authorization call yourself. When your agent submits the placeholder card and you see the request to the payment processor, pause it and send it to Agentcard:approvalUrl to send the user. Poll GET /v2/checkout/authorizations/:id until it is approved, then fulfill the paused request with the processor response from the authorization. Two things to get right:
- CORS. Stripe and most processors are called cross-origin. Your fulfilled response must carry
access-control-allow-originset to the paused request’s ownOriginheader, plusaccess-control-allow-credentials: true, or the page rejects it. The SDK exportswithCorsHeadersfor this. - Recognized processors only.
GET /v2/checkout/recognizerslists the processor endpoints Agentcard can complete. Pause those, and leave everything else untouched.