Skip to main content
use provider: "kernel" to collect a user’s existing card for browser purchases. KERNEL manages the card vault integration; you don’t need a separate provider account or configuration.

Connect a card

  1. create a vault and a wallet item with spec.provider: "kernel". the wallet is connected right away, with no cards and no action. connected means the wallet exists, not that it can pay.
  2. invoke the wallet’s add_payment_method operation. it returns a payment method in pending_enrollment with a single-use card_enrollment action that expires after 30 minutes.
  3. open the action’s url for the cardholder in your trusted ui. the hosted page collects their card and email. for card entry on your own domain, pass the action’s capture_token to embedded card capture instead.
  4. retrieve the wallet with the payment_methods expansion. the card is ready to pay when its method is active and capabilities.single_use_card.eligible is true.
a connected wallet advertises add_payment_method and, once it holds a card, remove_payment_method in available_operations. invoke them only when they’re advertised. share action.url privately with the cardholder, for example on an authenticated page in your application. the url is a capability for this one enrollment: don’t send it to the agent, log it, or share it with anyone else. if enrollment fails, the link accepts another card until it expires. an expired link doesn’t affect the wallet’s other cards; call add_payment_method again for a new link. card details go directly to KERNEL’s card vaulting provider through secure hosted fields. KERNEL receives a card reference and metadata rather than the original card number. request security and compliance artifacts through KERNEL’s trust center.

Manage cards

a wallet can hold several cards. each card is a payment method scoped to its wallet: call add_payment_method once per card, as in connect a card. each call creates a separate enrollment link for one card. a wallet holds at most 10 payment methods, including pending ones, and at most 3 open enrollment links. at either limit, the wallet stops advertising add_payment_method, and invoking it returns 409 with the reason. remove a card or let an open link expire before adding another.

List payment methods

retrieve the wallet with the payment_methods expansion to list its cards in creation order. each method includes id, status, is_default, display, and capabilities.single_use_card, with eligible and reasons. a pending method also includes its action and expires_at.
a method that isn’t active is never eligible to pay. is_default is true only for the default card card; new wallets have no default card. a wallet created before cards were payment methods keeps its first card as the default payment method, with the id card, and can add more cards. if that card’s enrollment is still pending, its card_enrollment action is on the method in the payment_methods expansion, not on the wallet.

Remove a card

remove_payment_method deletes the stored card and blocks new purchases, fills, and confirmations funded by it. the wallet’s other cards aren’t affected, and the wallet stays connected even with no cards left.
removal isn’t proof that a payment didn’t happen. reconcile any purchase with the merchant’s order record before treating it as unpaid.

Make a purchase

  1. attach the vault when you create the browser.
  2. create a card item for the purchase, referencing the wallet and the merchant, amount, and currency, and set spec.payment_method_id to the id of the card that pays. visa cards also require merchant_country, the merchant’s two-letter country code. the purchase is bound to that card; see choose a card for a purchase.
  3. invoke the advertised authorize operation and complete any returned user action. keep action urls in your trusted user interface, outside the agent’s context.
  4. when fill appears in available_operations, fill the checkout, submit once, and verify the merchant’s order record. a completed fill isn’t proof of payment.
the examples create and authorize a card for 23.06 usd. authorize takes no browser or page parameters when paying with the user’s own card.
for eligible cards, checkout receives a network token number, expiry, and one-time security code. the token represents the user’s existing card; it isn’t a newly issued disposable card. fill is restricted to the configured merchant’s top-level origin. there’s no general standing approval or spending-limit setting across these paths. your application must verify purchase details before authorization. complete any returned user action and fill before the purchase’s expires_at.
fallback availability depends on the card and checkout. contact support before building on this path.where supported, the cardholder enters a fresh security code through a hosted action for each purchase. fill writes aliases that KERNEL resolves to the stored card details at browser egress. this path doesn’t issue a one-time network security code.the recorded amount and merchant details don’t restrict outgoing payment requests. an expiry or payment window isn’t a single-use guarantee. follow the returned actions and expiry; don’t treat this path as a standing spending authorization.

Choose a card for a purchase

pass the chosen method’s id as spec.payment_method_id when you create a purchase. the purchase is bound to that card when it’s created: later operations can’t switch it to another card or wallet, and an update that changes either returns 409. to pay with a different card, create a new purchase. on a card item, omitting payment_method_id selects the default card card and never falls back to another card. new wallets have no default card, so creation without the id returns 400. a KERNEL purchase can also be a payment_request item where they’re enabled for your organization; contact support to enable them. a payment_request takes the same spec as a card item with provider: "kernel" and supports the same operations, including authorize, fill, and confirm_transaction. its payment_method_id is required and must name an active method that’s eligible to pay. neither type is deprecated. updates to a payment_request item must set type: "payment_request".

Check the card funding a purchase

a KERNEL purchase reports the card it’s bound to as state.payment_method_id and whether that card can still pay as state.funding_status: funding_status never changes the purchase’s status, which still reports what already happened to the purchase. purchases created before cards could be selected report the default card card.

Permissions

add_payment_method and remove_payment_method create and delete stored cards, so a scoped api key needs vaults:write in addition to vaults:use on the vault. a key without vaults:write doesn’t see either operation in available_operations, and invoking one returns 403 with insufficient_scope. other wallet and purchase operations need only vaults:use.

Events

the wallet’s item events record each card’s lifecycle, with the card’s id in data.payment_method_id: each new purchase records purchase_created with item_type, provider, and payment_method_id_present.

Reference