The Overflow instance
You create oneOverflow instance per page and keep it. The instance owns your publishable key, page-wide options (locale, theme, validation debounce), and every element you create. Do not construct a new Overflow(...) to change options at runtime — call overflow.update({ ... }) on the existing instance instead.
new Overflow(publishableKey, options) is a singleton per page. A second new Overflow(...) call logs a warning and returns the existing instance. To recreate the instance (for example, in a hot-reload dev flow), call instance.destroy() first.
live_pub_…for production.test_pub_…for staging or test.
overflow.destroy() when you are done to tear down the instance and every element it created.
Elements
An element is a self-contained payment UI component you mount into a host node on your page. You create one by calling a factory on yourOverflow instance.
- Checkout: a composite element that renders a full payment form. Use it as your primary integration.
- Payment methods:
card,bank,applePay,googlePay. Mount standalone or nest inside Checkout. - Address elements:
billingAddress,shippingAddress, with optional autocomplete. - Contact elements:
email,fullName,phone,companyName. - Custom elements:
text,number,select,checkboxfor arbitrary metadata. - Submit button: a themed submit CTA (
submitButton).
Options
Every element factory accepts an options object with a uniform shape:- Top-level keys control behavior. Examples:
splitModeonfullName,defaultCountryonphone,modeonbank,paymentMethodsoncheckout. fieldscarries per-input customization:label,placeholder,disabled,hidden, and so on.BaseElementOptionscarry the shared identity and cascade knobs:disabled,readOnly,id,ariaLabel,locale. The cascade flows from the element to its fields; per-field overrides win.requiredandvalidateare element-specific and are not accepted everywhere —card,checkout,applePay,googlePay, andsubmitButtonreject both;bankacceptsvalidatebut notrequired. Check each element’s reference for the exact surface.- Compound elements (Checkout) nest the standalone options shape under each per-method key. What you configure standalone works the same way inside Checkout.
Events
Most elements share a common event surface (onReady, onChange, onSubmit, onError, onFocus, onBlur, onEscapeKeyPressed); wallets and submitButton add or omit events where the shape of the element differs. See Events.
Wallets add
onClick (for pre-sheet gating) and onExit (when the shopper dismisses the sheet). Non-wallet, non-button elements add onEscapeKeyPressed.
Theming
Pass design tokens on theOverflow instance. Every mounted element inherits them.
complete vs value
Two concepts govern when a form is ready to submit:
valueis the current typed or (for payment methods) authorize-ready data for an element. For payment methods it is oftennulluntil the shopper completes the fields; ononSubmityou receive the method-specific payload — card fields as an encrypted envelope (encryptedCardNumber,encryptedExpiryMonth,encryptedExpiryYear,encryptedSecurityCode,riskData,browserInfo), bank as a discriminated union ({ mode: 'manual' | 'plaid', … }), or wallets as{ walletToken, walletType }. For input elements it is the current shopper input.completeis a boolean that flipstruewhen the element passes validation. For a card element, that means every required field is filled and format-valid; for an email element, that means the value matches the email schema.
complete from onChange to gate your Pay button. Read value from onSubmit to forward to your server.
Standalone vs Checkout
You have two integration shapes:- Checkout renders shopper contact, addresses, and payment methods in one mount. One
onSubmitreturns the whole payload. Use this when you want a turnkey form. - Standalone mounts one element at a time. You gate your submit button on
onChange.completefor each element, forward each.onSubmitpayload yourself, and control the layout.
Next steps
Quickstart
Mount your first element.
Checkout
Start with the composite element.
Elements
Browse every element.
Events
Full event reference.