Prerequisites
- A publishable key from the Dashboard. Use
live_pub_…in production andtest_pub_…in test. - A server endpoint that can accept the tokenized payload and call the Overflow authorize API.
- A page where you can add a script tag or an npm import and an empty
<div>.
1. Install the SDK
Either import the loader from npm:Overflow constructor:
2. Add a host element
Checkout mounts into a single DOM node you provide.3. Mount Checkout
Configure the payment methods you accept, opt into contact fields, and mount:paymentMethodsaccepts any subset of'card','bank','applePay', and'googlePay'.- Wallet methods that fail the device-availability probe are filtered out at runtime.
- Order of the array controls the order the methods appear.
4. Track readiness and validity
UseonReady to remove a loading skeleton, and onChange.complete to gate your own UI (an external submit button, an analytics event, and so on).
5. Handle submit
Checkout drives its own submit button. When the shopper authorizes,onSubmit fires with a discriminated value envelope:
value shape is { method, contact, billingAddress, shippingAddress, [methodKey] } where method is one of 'card', 'bank', 'applePay', or 'googlePay' and the per-method key holds the tokenized payment credentials.
Never send the payload directly to the payment gateway. Your server calls the Overflow authorize endpoint with the tokenized payload; see the authorize a payment API reference.
6. Handle errors
message is already localized and safe to render. Do not surface cause; it carries raw diagnostics.
See onError and Error codes for the full code list.
7. Ship it
- Match the brand: pass
appearancetonew Overflow(...). See Theming. - Enable wallets: see Wallets.
- Localize the country list: see Localization.