{"object":"doc","slug":"ui-components","title":"Place payment UI in your app","summary":"Reuse checkout, status, receipt and error panels with explicit host callbacks and uncertain-outcome handling.","tags":["guide","ui","components","accessibility","agents"],"body":"# Place payment UI in your app\n\nThe browser bundle provides four working presentation components. Your host supplies authorized order data, current payment state and callbacks. The bundle has no payment execution, card fields, network calls or browser storage.\n\n## Retrieve and try it\n\n1. Call `list_snippets`, then `get_snippet` with `snippet_id: \"zeropoint.browser.ui\"` if listed. Availability follows the deployed catalog; do not assume a draft branch is deployed.\n2. Copy the complete bundle to a new folder, preserving paths and verifying the returned hashes. Read its README. Run `node --test test/*.test.mjs` with Node 20 or newer.\n3. Run the bundled `python serve.py` and open `http://127.0.0.1:8011/example.html`. This local-only server explicitly serves `.mjs` as JavaScript; generic static servers on Windows may use an incorrect MIME type. Opening the file directly does not load browser modules reliably.\n4. Try every synthetic state. Controls log UI intents only. Check that changing success to unknown removes receipt access and never offers another checkout automatically.\n5. Copy `ui-kit.mjs` and `ui-kit.css` into your app's static assets. Load the stylesheet and mount into an empty element. There is no build step or runtime package dependency.\n\n## Minimal host adapter\n\n```html\n<link rel=\"stylesheet\" href=\"/assets/ui-kit.css\">\n<div id=\"checkout\"></div>\n<script type=\"module\" src=\"/assets/checkout.mjs\"></script>\n```\n\n```js\nimport { mountCheckout } from './ui-kit.mjs';\n\nconst checkout = mountCheckout(document.querySelector('#checkout'), {\n  title: 'Your order', amountMinor: 1299, currency: 'USD', state: 'ready',\n  onCheckout: ({ signal }) => host.openAuthorizedPaymentFlow({ signal }),\n});\n// Publish only state verified by your host integration:\ncheckout.update({ state: 'processing' });\n// On navigation or a change of order:\ncheckout.destroy();\n```\n\n`host` is a placeholder for your application, not a supplied SDK. Callback completion does not update payment state. The checkout remains locked until an explicit host state update. Set `ready` again only when the host establishes that starting a payment is appropriate. Never reuse a mounted checkout for a different order; destroy and remount.\n\n## Component reference\n\nEvery export accepts `(targetElement, props)` and returns `update(partialProps)` and `destroy()`.\n\n| Export | Intent callback | Enabled condition |\n| --- | --- | --- |\n| `mountCheckout` | `onCheckout` | Valid amount and currency, ready, callback present, no pending action |\n| `mountPaymentStatus` | `onRefresh` | Pending, processing, expired or unknown, callback present |\n| `mountReceipt` | `onReceipt` | Confirmed succeeded, valid amount, receiptAvailable true, callback present |\n| `mountPaymentError` | `onReview` | Declined, canceled, expired or unknown, callback present |\n\nProps include plain-text `title`, integer `amountMinor` from 0 through 999999999999, uppercase `currency`, `state`, and boolean `receiptAvailable`. Currency formatting is display support, not a claim that the payment API accepts every displayed currency or amount. Callbacks receive a frozen snapshot containing `state`, `amountMinor`, `currency` and an abort `signal`. The host owns receipt access; no arbitrary receipt URL is accepted.\n\n## Map state explicitly\n\nUI states are `ready`, `pending`, `processing`, `succeeded`, `declined`, `canceled`, `expired`, and `unknown`. These are a presentation vocabulary, not a replacement for the API schema. Map only a confirmed processor decline to `declined`. Generic API `failed`, a timeout, an unrecognized state or a network failure must not be interpreted as a decline or proof of no charge. Use `unknown` until the host establishes a more specific outcome. Expiration alone does not establish what happened to a payment.\n\nUpdates preserve native controls. When a focused action becomes disabled, focus moves to its feedback or current outcome; clearing focused feedback moves focus to the new outcome. These text targets do not add Tab stops, and updates do not take focus from elsewhere in the host app. Destroy aborts callback signals and suppresses late feedback; aborting UI work does not cancel an operation already sent. Component guards do not supply backend idempotency or prevent duplicate requests from another tab. Read [payment states](handle-every-payment-state.md) and [integration components](integration-snippets.md) before wiring callbacks.\n\n## Use the workspace\n\nOpen **UI components** for the same module running inside the console. Open **Documentation** to search guide bodies and read examples. In **Projects**, save your app profile, selected components and implementation notes, then copy the brief to your coding agent. Projects are shared by authorized console members of your platform, with a maximum of 20 projects. Any console member can read them; saving or deleting one requires access that includes `projects:write`, which read-only access does not. Save explicitly before leaving.\n\nEvidence selections are your team's observations, not automatic verification. Record commands, results and remaining work in notes without including credentials or customer data. A saved project does not connect an agent, deploy code or verify a sandbox transaction. If another session changed the project, preserve your brief and reload before reconciling edits.\n\n## Acceptance in your app\n\nCheck keyboard activation, visible focus, narrow layouts, both component themes and 200% zoom. Use a real screen reader to confirm names, disabled states and live payment announcements in the host application. The bundle's automated tests and console preview do not establish screen-reader acceptance or payment integration readiness. Keep UI, local component, hosted sandbox and physical-terminal evidence separate.\n\nKeyed checkout needs one manual step. Card tokenization refuses browsers driven by automation tools with `RECAPTCHA_DECLINED` (processor behaviour, VERIFIED 10/18/2026), so a scripted test cannot obtain a nonce: enter a test card by hand in a real browser. If your app sends a Content-Security-Policy, its `frame-src` must allow the hosted card form's host; the hosted card form concept lists what loads inside it.","updated":1792457361}