Skip to main content
This guide covers the SDK-level migration only: loading, mounting, options, events, and submit flow. Data migration (customers, saved payment methods, stored tokens) is a separate operations topic and is not covered here.
Migrating stored payment credentials and historical customer data requires a separate handoff with the Overflow team. That content is not yet published. Contact support when you are ready to plan that work.

Before you start

  • Get a test_pub_… publishable key for your staging environment and a live_pub_… key for production. See Concepts.
  • Confirm your server has an authorize endpoint wired to Overflow. See the authorize a payment API reference.
  • Read the Checkout element overview. Checkout is the recommended primary path and maps most directly to Stripe’s Payment Element.

Concept mapping

Loading and initialization

Stripe:
Payment Elements:
appearance and locale on the loader options (or new Overflow(pk, { … })) set the primary theme for every element. Passing appearance on a specific element is an optional per-element override. Notes:
  • Publishable keys use the live_pub_… and test_pub_… prefixes. There is no separate live/test toggle in code; the prefix determines the environment.
  • The npm package is a small loader that fetches the SDK from the CDN. There is no bundled SDK build. See Installation.
  • The primary theme lives on the Overflow instance — pass appearance to new Overflow(pk, { appearance }) (or mutate it later with overflow.update({ appearance })) and every element inherits it.

Mounting

The mount() signature is compatible:
Only one instance may be mounted to a given selector at a time. Call unmount() before re-mounting.

Options mapping

Options are set per element in the factory call, not on a shared elements object. Optional fields document their defaults on each page under Options.

Event mapping

Handlers are attached with .on('onEventName', handler) after the element is created. Event name strings include the on prefix — same idea as Stripe’s .on, different event name strings.
The full event surface for each element is documented in Events. Highlights:
  • onChange carries complete, value, and optional errors (FieldError[]). See onChange.
  • onSubmit fires after a successful submit() (or wallet sheet success) with a non-null value to forward to your server. See onSubmit.
  • Validation failures from submit() emit onError with code: 'validation_failed' and fieldErrors; they are not returned from submit().
  • Wallet buttons emit onClick synchronously so you can validate the cart before showing the sheet. See onClick.
  • Shopper abandonment fires onExit and is not an error. See onExit.

Submit and authorize flow

There is no client secret in the browser. The browser produces an authorize-ready payload (encrypted envelope for card, walletToken for wallets); the server authorizes. element.submit() returns void. Register onSubmit and onError before calling it — success and failure both arrive as events.
On the server, call the Overflow authorize endpoint with your secret key. See the authorize a payment API reference for the request and response shape.

Validation and error handling

  • Validation errors surface on onChange.errors while the shopper types, and as an onError event with code: 'validation_failed' and fieldErrors when submit() fails. See Handle validation errors.
  • Error payloads follow OverflowErrorEvent: { code, message, fieldErrors?, cause? }. For Checkout, each FieldError may include an optional source ('contact' | 'billingAddress' | 'shippingAddress' | 'paymentMethod' | 'customElement') — fieldErrors is always an array, not an object keyed by section. See Field errors and Error codes.
  • Wallet unavailability (Apple Pay or Google Pay not offered on this device) is not an error. Fall back to the primary Checkout element.

Theming

  • Set high-level tokens with appearance.variables. See Token reference.
  • Use appearance.size and appearance.shadowSize presets rather than per-element pixel values. See Sizing presets and Shadows.
  • Element-scoped overrides live under appearance.elements.<name>. See Element-scoped overrides.
  • The element renders inside an isolated tree; page CSS does not leak in. See CSS isolation.

What this guide does not cover

Data migration (customers, saved payment methods, stored tokens), drop-in API compatibility, and server-side concerns like webhooks and disputes are out of scope. Contact support to plan data migration.

See also

Last modified on July 29, 2026

Related topics

Webhooks