Skip to main content
AI agents work with checkout on two sides. A developer’s agent creates checkouts for you, from the CLI, the MCP server or the API. A buyer’s agent completes a checkout in the browser, using the WebMCP tools on Polar’s hosted checkout page.

Create checkouts with an agent

Prompt

Complete a checkout in the browser

Polar’s hosted checkout registers WebMCP tools: functions a browser exposes to an AI agent through navigator.modelContext. An agent in a WebMCP-capable browser calls them to read the order, fill in the buyer’s details and pay, instead of clicking through the form. The tools are on the hosted checkout page only. They’re not available in embedded checkout, and you don’t need to turn anything on. Amounts are integers in the smallest unit of the checkout currency, as everywhere in the API: 1500 is $15.00 in USD.

Card details are typed, not set

The card form is a Stripe iframe on another origin, so no tool can fill it. The agent calls focus_card_number, then types the card number, Tab, the expiry as MMYY, Tab, and the CVC. It checks payment.card_complete with get_checkout_state before calling submit_checkout. If the card issuer asks for authentication, submit_checkout can end with a navigation instead of a result. The purchase is complete once the page URL ends in /confirmation.

Learn more