{"object":"doc","slug":"integration-snippets","title":"Tested integration components","summary":"Retrieve complete reviewed code, instructions and tests through MCP before building payment plumbing from scratch.","tags":["guide","agents","snippets","webhooks"],"body":"# Tested integration components\n\nUse the component catalog to reuse server components and browser UI. Each bundle includes exact source, its README, tests, a component version and SHA-256 hashes. These are application building blocks, not an installer, an SDK, hosted infrastructure or proof that your application is ready for live money.\n\n## Agent workflow\n\n1. Call `list_snippets` to see what actually exists. Do not guess component IDs or download URLs.\n2. Call `get_snippet` with one returned `snippet_id`. The response contains `id`, `version`, `mode`, `runtime`, `api_version`, `description`, `file_count`, `total_bytes`, and a `files` list. Each file has `path`, `content`, `sha256`, and `size_bytes`.\n3. Read the README and the manifest before adapting anything. The manifest's `guarantee` is what the component promises, `not_included` is what stays the host's, and `host_wiring` lists the exact integration points the host must supply (the route that calls it, the model that feeds it, the secret store, the storage path, the worker that consumes it): walk that list against the real app and name each one in the plan. Copy all files under a new component directory, preserving relative paths and the bundle's browser/server boundary. Write the returned UTF-8 content with LF line endings and verify SHA-256 and byte sizes. Do not overwrite unrelated project files. If content/hash checks fail, stop and retrieve a clean bundle.\n4. Run the included tests using the required runtime. Do not omit tests or rewrite verification/deduplication logic to make integration shorter.\n5. Configure secrets using the application's server-side secret management. Never paste secrets, private keys, card data or production payloads into an agent conversation, browser bundle, source file or command history.\n6. Report in three parts: reused (each file installed unchanged, with component id, version and `sha256` from the catalog), generated (the glue written for this app and which `host_wiring` item each piece supplies), and still unsupported or open. Successfully fetching code is not successful integration.\n\n## Browser UI components\n\n`zeropoint.browser.ui` supplies checkout, payment-status, receipt and error panels as dependency-free browser ES modules. The host supplies data and callbacks; these components never collect card data, call payment APIs, store credentials or infer success from a callback. The bundle includes a standalone synthetic app, stylesheet and lifecycle tests. Read [Place payment UI in your app](ui-components.md) for placement, state mapping and accessibility acceptance. Browser currency formatting does not expand processor capabilities.\n\n## First component: Node webhook receiver\n\n`zeropoint.node.webhook-receiver` is sandbox-only, Node 24, and uses no third-party runtime packages. It verifies exact raw bytes, rejects malformed/stale signatures, checks sandbox/merchant ownership, and stores authenticated events in a local SQLite inbox before acknowledging them. It includes tests for duplicates, restarts, identity collisions and storage failures.\n\nIt does not mark orders paid, send texts, fulfill bookings, reduce inventory or enable live payments. It requires reliable local storage on one host. Do not place it in an ephemeral serverless function without designing and verifying a different durable storage adapter. Framework adapters and business-effect workers must preserve the documented raw-body and idempotency contracts.\n\nOffline tests do not prove hosted behavior. Later, a controlled HTTPS receiver must pass the signed, fast, replay and bad-signature checks independently. The existing hosted sink intentionally passes 3/4 because it accepts bad signatures. A 2xx replay response is receipt evidence, not proof that application business effects occurred once.\n\n## Terminal POS component\n\n`zeropoint.node.terminal-pos` supplies the server-side checkout portion of the antique-store POS journey. It requires Node 24, a durable local SQLite database on one host/process, an existing sandbox merchant and terminal, and `payments:write` plus `payments:read` scopes (or an existing full sandbox key).\n\nThe host app authorizes the order and computes integer cents from trusted prices. The component records a generated request identity before one create request; repeated clicks resume that record. If the response is uncertain, read-only lookup can recover the same payment. It never silently retries a create, substitutes a new order, cancels, refunds or voids. An empty lookup is not proof that no charge occurred: unresolved cases stop for operator review. Keep the database and order identity intact.\n\nThe package validates payment ownership, mode and amount before presenting a result, and treats refunded payments as needing review rather than fully paid orders. It does not supply browser authentication, inventory updates, exactly-once fulfillment, payment tips, merchant provisioning, or a complete POS. The offline example sends no external requests. Local simulated-terminal tests are not physical-hardware or live acceptance. Read the included README before adapting the component.\n\n## Subscriptions component\n\n`zeropoint.node.subscriptions` is sandbox-only, Node 24, with no third-party packages. It creates a subscription-mode checkout session under a purchase key, and applies billing events only through its vendored copy of `zeropoint.node.webhook-receiver` (signature over the raw body, envelope, sandbox mode, merchant): once per event id in its own SQLite database, a subscription copy never overwritten by a lower `object_version`, access decided by `status` only, and the messages your app sends (renewal reminder, receipt, failed payment, access changes) queued in the same transaction. It sends no email itself. Version 0.3.0 adds one-time purchases (mode `payment`, fulfilled once when complete and paid), your `customer` and a chosen `promotion_code` on the checkout request, and `listen.mjs`, a test-mode helper that replays your events to a receiver on `localhost` signed with your endpoint secret (ZeroPoint cannot deliver to `localhost`). It also has `emails.mjs`: renewal reminder, receipt and failed-payment emails from the queued messages, handed to your own `sendEmail` (no email provider is bundled), each linking to your own manage route, and `createManageRoute`, that route, which opens a fresh billing portal session for the signed-in user (a portal link works once, for 5 minutes, so it never goes in an email). See `build-subscriptions`.\n\n## Order-payment evidence component\n\n`zeropoint.node.order-payment-evidence` applies authenticated inbox events to an immutable order binding registered by the host application. It shares the webhook receiver's SQLite database and uses one transaction to record evidence, a deduplicated local outbox entry and inbox completion. No network call or business fulfillment occurs in that transaction.\n\nWith terminal checkout version 0.2.0 or later, the host can call `getBinding(orderId)` after a payment ID is known, then register that binding with the evidence component. The getter reads local trusted identity; it does not prove payment success. Never register orders from incoming webhook metadata. A keyed integration must supply the equivalent trusted server-side binding itself.\n\nThe projection distinguishes `awaiting_evidence`, `success_observed`, `not_paid_observed` and `review_required`. Attention, contradictory final states and refund evidence require review. A positive payment refund counter can represent a pending reservation; only a validated canonical refund-success event records completion, once per refund ID. Neither representation supplies settlement accounting.\n\nThe outbox is durable local evidence, not a fulfillment queue with an exactly-once delivery guarantee. A later event can contradict earlier success evidence. Before inventory changes, appointment confirmation or messaging, the host must apply its own current payment verification and review policy. This component has no dispatcher, review-resolution control, SMS provider or automatic payment retry. Its offline tests do not satisfy hosted signature verification or live acceptance gates.\n\n## Evaluating a composed integration\n\nComponent tests and a real coding-agent trial are different evidence. The repository's\noffline antique-store fixture composes the three retrieved bundles against isolated\nAPI fixtures, including response loss, replay, bad signatures and ownership mismatch.\nIt does not establish that your agent/client connected, your hardware works or your app\nis deployed. Keep those checks explicit in the owner handoff.\n\nFor a terminal POS, obtain order identity and price from trusted application state,\nbegin or recover the checkout, pass `getBinding` to the evidence worker, and inspect\ncurrent evidence before applying your application's business policy. Never reconstruct\na trusted order from arbitrary webhook metadata or count a success outbox entry as\nproof of exactly-once fulfillment. The salon text-link/tip/deposit workflow requires\nadditional supported contracts; these terminal components do not implement it.\n\nFor the complete existing-app sequence, read `integrate-antique-store-pos`. For an\nobserved component code or blocked inbox row, read `troubleshoot-terminal-integration`.\nBoth guides are available through `get_doc`; neither authorizes new payment operations.\n\n## Access and errors\n\nSnippet tools use the same authenticated documentation access as `get_doc`; they do not grant access to merchants, payments or any write operation. Revoked keys fail authentication. Calls consume the existing platform MCP budget and are audited without recording returned file content. No processor calls occur.\n\n- `snippet_not_found`: use an ID returned by `list_snippets`.\n- `snippet_unavailable`: the reviewed catalog or bundle failed validation or is missing; report the request ID to the operator. Do not substitute unreviewed code or bypass a hash failure.\n- `parameter_invalid`: the component ID is malformed or too long; a file path or URL is not an ID.\n\nOperators maintain an explicit file inventory in `snippets/catalog.json`. `python scripts/build_snippet_catalog.py --check` checks it; the same script without `--check` refreshes hashes only for already-declared paths after a reviewed change. New components need an explicit inventory and their own acceptance evidence. Versions: the catalog copies each component's `version` from its `manifest.json`. A component whose files change in a release gets one version bump in that release; a version not yet released is not bumped again for later changes before the release, so a released version and its pinned `sha256` values never change.","updated":1795275945}