Before you start
- have an existing browser agent. this guide adds payment handling, not navigation or reasoning.
- choose a wallet integration from the wallet overview, then follow its tab below.
- install a KERNEL sdk with the
vaultsresource. setKERNEL_API_KEYandKERNEL_PROJECT_IDin your controller. - use a low-value checkout you control. link is live-only and requires an https merchant origin and verified field selectors. agentcard requires a native processor adapter; the processor doesn’t need to be stripe.
- for agentcard, set
AGENTCARD_MODEin your controller and verify it against the credential’s mode. customer-owned configs exposetest_mode(truemeans sandbox); for KERNEL-managed credentials, confirm the deployment’s mode. stop if the mode is unknown or mismatched. - identify how you’ll read the merchant’s trusted order record. you need it to confirm a matching paid order. deterministic checkout data can verify purchase details before submission, but without the order record afterward, the result remains indeterminate.
Roles and resources
- controller: your trusted application code. it calls KERNEL, verifies purchases, authorizes field bindings, presents user actions, and observes payment state.
- agent: your browser automation. it proposes purchase details and selectors, then completes the approved checkout.
- user: the person who connects a payment method, confirms the purchase, and completes provider approval.
Shared safety rules
One-time setup
1. Create a vault
scope the client and vault to the project that will own the browser session. these clients disable automatic sdk retries.vaults.upsert creates the vault or retrieves one with the same name. vault names
are immutable within the project.
2. Connect a wallet
allow at most one wallet item per provider in a vault. list the vault’s items and group wallets byspec.provider before rendering your payment settings:
recheck in your controller immediately before creating a wallet. the api makes
item keys unique, not providers, so a different key can create a duplicate wallet.
deleting a wallet invalidates its dependent card items; use an explicit
remove-and-replace flow instead of adding a second wallet.
- let the user select a provider that doesn’t already have a wallet in the vault.
- create the wallet item through your controller, following the link setup or agentcard setup.
- present the returned action using the authenticated flow below. the user connects or enrolls their real payment method with the provider.
- wait for the wallet’s status to become
connectedbefore preparing a purchase.
Present hosted actions in your application
provider action urls are bearer-like handoffs to enrollment or approval. route them through your controller:- your controller retrieves the item and keeps the raw action url out of logs, analytics, and model context.
- store the action server-side under an opaque id bound to the authenticated user, vault id, item key, and action name.
- render a link to your own authenticated action endpoint. before redirecting, verify the session owns that binding and the item still returns the same action.
- send the redirect with
Cache-Control: no-storeandReferrer-Policy: no-referrer. - apply a short application ttl capped by
item.expires_atorstate.authorization.expires_atwhen present. invalidate the record immediately when the action changes, disappears, or reaches a terminal state.
presentProviderAction functions later in this guide represent this
application-owned flow. the checkout agent and its browser must never receive
the raw provider url.
For each purchase
1. Attach the vault to a browser
vault attachments are fixed at browser creation. use the same project-scoped client that created the vault.browser_live_view_url lets the user watch the checkout during confirmation
and agentcard approval pauses. presentLiveView represents your authenticated
user-facing page: keep the url server-side with the user and browser session
binding, render or embed it only after checking that session, and remove it when
you delete or time out the browser. don’t log the url or put it in model context.
see live view for iframe and csp
requirements.
connect your existing agent to browser.cdp_ws_url. see Controlling a Browser for supported connection options.
navigate to checkout in this session before verifying the purchase. use the same
session to inspect and submit it; the vault attachment includes items created later.
2. Verify and confirm the purchase
- let the agent propose the merchant, amount, currency, and item or cart contents. treat every proposed value as untrusted.
- independently obtain the expected values from a trusted source. prefer your order or cart backend. when no backend exists, use deterministic page extraction with fixed selectors or structured page data, not another model response.
- normalize the values in your controller and compare the proposal with the trusted result. compare the amount in minor currency units and require the merchant, currency, and item or cart contents to match.
- stop when any value is missing, cannot be verified, or disagrees. do not create or update a card item and do not invoke authorization.
- show the independently verified values to the user and wait for explicit confirmation.
- freeze that verified, confirmed purchase object. derive the card specification and any authorization request from that same object. do not accept replacement values from the agent after confirmation.
3. Collect other checkout fields
collect required email, billing, shipping, phone, and other customer fields from the user or their previously approved backend data. pass them separately from payment input; don’t ask the agent to invent missing values. answer any agent disclosure truthfully in the merchant’s form and verify the control is selected before submission. if a required field or disclosure can’t be completed and verified, stop. see checkout-specific notes for stripe’s disclosure controls.4. Prepare payment input and submit once
follow the tab for your provider. each path uses the frozen purchase object from step 2, a connected wallet in the same vault, and this browser session.- Link by Stripe
- Agentcard
Prepare and authorize the card
- list the wallet’s payment methods and let the user select one.
- create a link card item named
notebook-orderfrom the verified purchase and selected method. - require
authorizeinavailable_operations, invoke it with that same purchase object, and present any returned action through your controller. - wait for the card to become
ready, then requirefillimmediately before use. link cards never exposestate.aliases.
Fill the approved fields
your controller must authorize the destination and selectors before disclosure.checkoutURL / checkout_url is the browser’s exact current top-level https url,
including query and fragment. it must share the origin of spec.merchant_url.
no playwright page object is required. see field requirements.fill supports stored billing fields
as well as card fields. requesting an absent value returns field_unavailable
before any writes.index, status, and optional error_code.
failed may leave earlier writes in place; unknown or a transport error means
the outcome is uncertain. stop without retrying or switching to aliases. see the
fill outcome contract for details and link checkout
for the cli equivalent.only continue on completed. inspect the checkout without reading card values
back, complete the remaining customer fields and disclosures, and submit once.
then verify the outcome. filling is not payment success
and doesn’t consume the item or clear its encrypted material; the provider’s
single-use card semantics are separate from item state.Verify the outcome
use the merchant’s trusted order record to confirm a paid order whose merchant, amount, currency, and items match the frozen purchase. item state, events, and the checkout page provide supporting evidence, not proof by themselves. if the record is unavailable or the sources disagree, keep the result indeterminate and don’t retry.
retain the vault id, card key, browser id, and last event id until reconciliation
is complete. delete the browser after outcome inspection or your reconciliation
deadline; this doesn’t undo provider execution or cancel an order. keep or delete
the vault and provider items based on future use, except when
recovery_required
prohibits deletion.
Checkout-specific notes
Stripe payment links and adaptive pricing
Stripe payment links and adaptive pricing
for a stripe payment link without an order or cart backend, use the payment-link
response as the deterministic source. the current response exposes
account_settings.display_name, line_item_group.total,
line_item_group.currency, and line_item_group.line_items. use dom text and
data-testid attributes only as supplemental checks. stripe can render multiple
responsive copies of a summary or omit product-level test ids in another layout,
so don’t require a specific test id or number of matching elements. these are
stripe page details rather than a KERNEL contract. if the structured response is
missing or its values disagree with the rendered checkout, fail verification
instead of falling back to model inference.stripe adaptive pricing can change the checkout’s displayed amount and currency
for the browser’s location. create the card item from the active presentment
amount and currency shown to the user and submitted by that checkout, not the
payment link’s base integration amount and currency. include those active values
in the verified purchase object and the confirmation screen.Stripe agent disclosure controls
Stripe agent disclosure controls
stripe can render hidden or duplicate copies of its disclosure control for
responsive layouts. target the visible label. if the label doesn’t toggle the
control, locate the associated real
input[type="checkbox"] and invoke its
native dom click(). read that same input’s checked property and require it to
be true before submission. if you can’t verify the checked state, stop without
submitting.Missing or unconnected wallets
Missing or unconnected wallets
without a wallet item, card creation fails because
spec.wallet must
reference a wallet from the same vault and provider. with an unconnected link
wallet, card creation returns a conflict. with an unconnected agentcard
wallet, a card without card_id can remain requested, while a pinned
card_id cannot be validated. neither path is ready for checkout.Try with a coding agent
connect the provider wallet first through your controller or a human-operated terminal. these prompts require exactly one connected wallet for the chosen provider inuser-12345 and a coding agent with access to the KERNEL cli.
complete the prerequisites, including verifying the payment
mode and identifying your merchant order record. replace the checkout url with
a low-value checkout you control.
the coding agent must stop whenever a provider action is required: cli output
can contain the action url. keep enrollment, authorization actions, and approval
observation outside that agent. the prompts repeat the safety requirements so
they remain self-contained when copied.