Skip to main content
This page documents @whop/elements@1.9.0 and @whop/elements-react@1.9.0.
Since v1.0.0. Mounts inside Checkout. Pass props and callbacks through the create options or React props.
Exclusive. CheckoutElement is an alternative to ExpressCheckoutElement in this Checkout handle. Mount one at a time. Destroy it before mounting another.

Example data. Open the Playground.

Props

string
Prefills the buyer email the host page already knows: the authenticated first-party viewer’s, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyer’s email wins over it. Empty (default) leaves the field for the buyer. Defaults to "".
boolean
Keeps the buyer from editing the prefilled buyerEmail — an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a buyerEmail there is nothing to lock. Defaults to false.
object
Prefills what the host page already knows about the buyer. The buyer can edit every prefilled field, and a phone number or complete shipping address the session already holds wins over it. phone fills the checkout’s phone number field when the seller collects one, in E.164 format such as +14155552671; when that field exists it also supplies the billing phone for methods that need one, so pass phone rather than billingDetails.phone. shippingAddress fills the shipping address when the checkout collects one (country is an ISO 3166-1 alpha-2 code; with a country the form cannot use, only the name is prefilled). billingDetails prefills the payment method’s billing details like the payment element’s defaultValues.billingDetails. Use buyerEmail for the email. Since v1.1.0.

Events

Pass callbacks in the create options or React props.

onLoaderStart

Runs after the loading skeleton first paints and before onReady.

onReady

Runs after the element’s first complete paint.

onError

Runs when the element fails to load or crashes. The fallback remains visible. Use code for programmatic handling. sourceKey identifies a failed host-state source.
object

Methods

Call these on the handle returned by create, or through a React ref.

mount

Mounts the element in target and starts loading. React components mount themselves. Parameters
string | HTMLElement
required

destroy

Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.

update

Merges new props into the mounted element. In React, change the component props instead. Parameters
Partial<CheckoutElementProps>
required

Styling

Style these parts through appearance.classes. Use camel case or kebab case for property names and include units. Page stylesheets can’t reach the element’s frame. The framework validates each declaration before injecting it.
In React, pass appearance to <Checkout>. Set it globally with WhopElements({ appearance }).