overflow.checkout(...) and onSubmit.
Lifecycle
- Create.
overflow.checkout(options)returns a handle. No network calls yet. - Mount.
checkout.mount('#host')renders a loading skeleton, then fetches your merchant payment settings from the Overflow API. - Ready. Once configuration loads, Checkout renders the configured sections and fires
onReady. - Interact. As the shopper types or selects fields,
onChangefires with the aggregated{ value, complete, errors }. - Submit. The submit button inside Checkout (or your programmatic
checkout.submit()call) validates every section, tokenizes the selected payment method, and firesonSubmitwith the payload. - Authorize. Forward the payload to your server, which calls the Overflow API to authorize the charge with your secret key.
Section order
Sections render in this default order:- Contact
- Shipping address
- Billing address
- Payment methods
- Custom elements
options.order. Unlisted sections fall through in default order after the ones you listed:
Payment method order
Payment methods render in the order you pass:http://, a wallet that reports unavailable, a missing configuration) are hidden without shifting siblings. If a method becomes available later in the session, it slots back into its original position.
defaultPaymentMethod, when set, overrides the initial selection. If the default is unavailable at runtime, the first available method wins.
Contact block
Contact is opt-in. Omitcontact (or pass {}) to render Checkout with no contact fields.
email → fullName → companyName → phone; override with contact.order.
Addresses
SetbillingAddress and/or shippingAddress to enable those sections. Each accepts every option the standalone element accepts.
Custom elements
Custom elements slot in viacustomElements. Each entry is one mounted child managed by Checkout.
order: ['contact', 'customElements', 'paymentMethods'].
Submit flow
Callingcheckout.submit() (or the internal submit button firing) does the following in one pass:
- Flush any pending debounced validation on every mounted child.
- Collect per-section errors, tagged by
source. - If there are errors, fire
onErrorwith the aggregatedfieldErrorsand stop. - Otherwise, tokenize the selected payment method.
- Fire
onSubmitwith{ value }wherevaluecarries the method, the tokenized payment payload, and every configured section (contact, addresses, custom elements).
onSubmit from the sheet directly. Contact and address data collected inside the wallet sheet are folded into value alongside the payment payload.
Update in place
You can change Checkout options after mount:Programmatic access to custom elements
Reach into a configured custom slot withcheckout.getCustomElement(name):
null if the slot is not configured. Built-in sub-elements (email, card, etc.) are not exposed this way; their values are already on the aggregated envelope.
Next steps
Best practices
Recommendations for real integrations.
Sections
Per-section configuration.