Skip to main content
Your chat assistant can let a signed-in customer set up an agent, buy a ticket within their permission, or queue for a drop — inside your page, with no redirect and no cookies. Available in @alytegen/sdk 0.4.0 (@alytegen/sdk/browser). Three credentials exist in this flow, and each stays where it belongs: Your page never sees the third one, and your backend never sees the second. If the buyer has no permission yet, an ordinary session’s consent view asks them to confirm a code emailed by Alyte — inside the iframe — then creates the agent and permission and hands your page the resulting IDs. An enabled merchant-attested session can instead create a permission within its configured ceilings without that code. The attest-only API key stays on your backend; the same browser helpers work with the resulting session.
Prerequisite. This flow is offered to merchants onboarded under an Alyte contract (Getting access). The contract carries one rule the API cannot enforce for you: your pages and your backend never handle the buyer’s verification code — see what your integration must never do.
Already embedding the authorize page in a modal? That path keeps working (Embedded authorize). The consent component is the cookie-free alternative for chats and single-page apps.

Set up

1

Register your chat origin

Up to three bare origins, space- or comma-separated: https, no path or query (http is accepted for localhost and 127.0.0.1 only). null clears them. The same list drives three things: which pages may frame Alyte, where Alyte posts messages, and which browser origins may call the buyer API with a bearer (Browser access and CORS). New registrations reach the preflight cache within 30 seconds.
2

Mint on your backend; hand the browser only the token

The mint endpoint must never accept a browser-supplied email as identity. The token works once, for 15 minutes, for one consumer: either your page exchanges it (below) or the buyer navigates the redeem link — not both. Three links per email per 15 minutes.
3

Exchange it in the browser

The call must come from a registered origin; from anywhere else it is refused with 403 and the token is not consumed, so a misconfigured origin costs you a fix, not a re-mint. A replayed or expired token answers 401 link_invalid. When expiresAt passes, or any call answers 401 unauthorized, ask your backend for a fresh mint and exchange again; build a new client with the new bearer.
4

Open consent when the buyer needs an agent

The SDK mounts Alyte’s consent view as an iframe in container, hands it the bounded bearer through a parent-origin-checked message, and resolves when the buyer has chosen or created a permission. Choosing an existing usable agent needs no verification. Creating one with an ordinary session does: the view sends a 6-digit code to the attested email and verifies it inside the iframe; card entry also happens there. On completion the iframe is removed and you receive IDs only.
5

Buy, watch and revoke with the bounded client

attemptId is a UUID you persist before dispatch and reuse, unchanged, if the response is lost — never a fresh one for an uncertain charge. The SDK retries nothing on its own. settled is success; pending is not yet decided; sca_required means the buyer must authenticate with their bank and the browser path for that is not available yet — do not treat it as success and do not send a new purchase.
Your backend still fulfils from the verified payment.settled webhook, idempotently. Anything your page learns from the SDK is presentation state, not fulfilment evidence.

openConsent options

Resolves with { agentId, mandateId }. Rejects with AlyteConsentError, whose code is:

Theme

The view reads as part of your shop through one small, validated object. Fields other than these are ignored. scheme picks a complete palette first; valid overrides apply on top. Invalid values are ignored. If the resulting colours fail contrast checks (4.5:1 for text, 3:1 for accents against both backgrounds), all four colours fall back to the scheme defaults — they are not adjusted. The permission terms, validation errors and disabled controls keep fixed readable colours, and payment-provider card inputs keep the provider’s styling. The theme applies to this mounted view only; it does not change shop settings. Omit font to keep Alyte’s Hanken Grotesk; secondary text and dividers are derived from your palette with readable contrast.

Chrome, drafts and closing

Inside your frame the view drops Alyte’s own brand, account email and footer and shows a small “Secured by Alyte” line — your page owns the chrome. A setup the buyer has started survives closing the dialog, or your frame being torn down, and resumes where it was (kept per buyer for a day; never a credential). Closing the consent view with a setup in progress asks “Discard this setup?” first; cancelled is sent only when the buyer confirms, so a host that closes its modal on cancelled never loses an unfinished setup by accident. Nothing changes on your side: the same cancelled handling applies, it just fires less often by mistake.

Bounded client reference

Every buy and watch is checked server-side against the buyer’s current permission, card evidence and live availability. Non-2xx responses throw AlyteApiError with status, code and details; a purchase refusal (402) carries its outcome in details. See Errors.

What your integration must never do

  • Never call the verification endpoints or handle the buyer’s code, from your page or from your backend. The consent view does that. A code entered anywhere in your own UI is a defect in the integration, not a feature. Alyte refuses browser calls to those endpoints from partner origins; that refusal is a browser boundary, not a substitute for this rule.
  • Never proxy buyer calls through your server or keep the bearer anywhere but memory. The credential belongs to the buyer’s browser session.
  • Never claim a purchase in chat before settlement. Say “confirmed” on the webhook, not on a resolved promise.
If you cannot use the SDK, mount the view yourself:
Optional query keys mirror the SDK options: tier, qty, lang, return, and the theme fields accent, background, surface, text, font, radius, scheme (colours as bare RRGGBB or URL-encoded %23RRGGBB). Every message is { type: 'alyte:consent', merchantId, event, …fields }. Always check event.origin against Alyte’s origin and event.source against your iframe’s window. The view’s own requests go to Alyte’s origin without cookies; the bearer you bootstrapped is the only credential it holds, and the full verification credential it mints stays inside.