Pay with a card the user approves
writ_paymentPay on a website without card numbers reaching the chat: request user approval, then Writ fills the card and places the order after confirmation.
Instructions
Pay on a website with one of the user's cards, without the card number ever reaching this conversation: the AI never sees or asks for card numbers. action='request' (site, max_amount, purpose) returns a tell_user and an open_url: a Writ window where the user picks or adds a card (or makes a virtual card) and approves it. A purchase needs that approval. action='wait' grant_id= is ONE held call (up to 60s) that answers when they approve, with the card's brand and last four digits only. PLACING THE ORDER: action='checkout' (session on the final checkout page, commit_selector = the place-order button, total_selector = the order total, grant_id, or max_amount when the store uses its own saved card) pauses the session and the user confirms (emailed link, the Writ app, or an auto-confirm rule they turned on); then Writ types the card, checks the total and clicks the order button itself: a real purchase. You never click an order button yourself (refused). action='wait' confirmation_id= returns the outcome. action='fill' types an approved virtual card early (multi-page checkouts). Card use is limited to the site and amount granted; an unused grant expires after 15 minutes. action='list' shows the user's payment methods as handles (kind, brand, last4, id), never numbers; a handle goes into writ_wire_monitor buy.payment {kind, ref}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | request: the store's domain, e.g. 'store.example.com'. The card is typed only on this site and its payment frames. | |
| steps | No | checkout: steps Writ runs after confirmation, before the order button, e.g. [{"type":"fill_card"}, {"type":"click","selector":"#continue"}, {"type":"wait","seconds":2}] for a card page followed by a review page. Default: fill the granted card, then the order button. | |
| action | Yes | request = ask the user to approve a card for one purchase; wait = hold until they answer (grant_id) or until a checkout is settled (confirmation_id); checkout = pause at the order button for the user's confirmation, then Writ places the order; fill = type an approved virtual card early; list = the user's payment methods as handles. | |
| fields | No | request, for live browsing: card field -> CSS selector on the checkout page (read them with writ_browser_context), or {selector, frame_url} for a field inside a payment provider's frame (frame_url = part of the frame's URL, e.g. 'js.stripe.com'). Keys: number, exp (MM/YY), exp_month, exp_year, exp_year2, cvc, name, zip. Writ types into exactly these. | |
| purpose | No | request: one line the user reads when approving, e.g. 'Buy Nike Dunk Low, size 10'. | |
| session | No | checkout / fill (required) / request: the session_id of the writ_browser_use session on the checkout page. | |
| summary | No | checkout: one line the user reads when confirming, e.g. '1 x Nike Dunk Low, size 10, shipped to home'. | |
| currency | No | request: three-letter ISO code (default 'usd'). | |
| grant_id | No | wait / fill / checkout: the grant_id action='request' returned. | |
| max_amount | No | request / checkout: the most this purchase may charge, tax and shipping included (e.g. 129.99). checkout without grant_id needs it. | |
| automation_id | No | request: the automation the card is for, when the purchase is a saved automation. | |
| total_selector | No | request / checkout: CSS selector of the order total on the checkout page. Writ reads it and never clicks on when it is above the maximum. Needed for an auto-confirm rule to apply. | |
| commit_selector | No | checkout (required): CSS selector of the button that places the order. Writ clicks it after the user confirms. | |
| confirmation_id | No | wait: the confirmation_id action='checkout' returned. | |
| payment_method_id | No | request: a handle id from action='list' to pre-select that card; the user still approves. |