Skip to main content
This page documents @whop/elements@1.10.0 and @whop/elements-react@1.10.0.
Since v1.10.0. Create this Checkout resource without mounting an element: whop.checkout.checkoutSession.create({ … }) in vanilla or useWhop().checkout.checkoutSession.create({ … }) in React.

Options

Pass these to whop.checkout.checkoutSession.create({ … }).
string
required
Account ID, prefixed biz_, that sells the line items.
CheckoutSessionLineItem[]
required
What the buyer is buying: each entry names a variant (plan_…) and an optional quantity (default 1). Several entries form a cart.
string
required
Where the buyer lands after PayPal when the tab was redirected, with payment and status appended: succeeded, canceled, failed, or processing while Whop is still finishing the charge (read the payment from your server to see it settle). On desktop the pop-up closes instead and show() settles.
Record<string, string>
Your own string keys and values, up to 40, kept on the checkout session and copied onto the payment it creates, so they come back on the payment and its webhooks, for example ad and affiliate attribution. They are set from the buyer’s browser, so never rely on them for prices or fulfilment.
"off_session"
Set to off_session to save the buyer’s PayPal account so your server can charge it later without the buyer, for example for a one-click upsell. PayPal asks the buyer to agree to future payments while they approve. Set it only after telling the buyer their PayPal account will be saved.
string
The buyer’s email, which the payment and membership belong to. Omit it to use the email of the PayPal account that approves.
CheckoutSessionPaymentMethodOptions
Options for one payment method. paypal.requestShipping has PayPal ask the buyer for a shipping address. When the account has an enabled https webhook subscribed to shipping_address.changed, Whop calls it for each address and charges the totals it replies with. Defaults to false.

Methods

Call these on the resource.
Call show synchronously during user activation. Await prerequisites first.

load

Create the checkout session from lineItems. Calling it again answers the same session. show() loads it first when it has not been loaded. terms is what the buyer accepts by paying: show its links (the seller’s published policies and Whop’s buyer terms) next to your button, and when terms.required is true, have the buyer actively accept them, for example with a checkbox. requirements lists what the session needs before it can be paid: anything other than email, terms and, with paypal.requestShipping, shipping_address cannot be collected here, so show() refuses it. Returns Promise<CheckoutSessionLoaded>
string
required
string
required
string[]
required
CheckoutSessionTerms
required

show

Call it synchronously in your PayPal button’s click handler: on desktop it opens the pop-up there, and a pop-up opened later is blocked. Pass termsAccepted: true only when load()’s terms.links were shown next to the button for this press, and, when terms.required is true, the buyer actively accepted them. Resolves with { payment } once the buyer approves and Whop charges. Rejects with an error whose code is attestation_required without termsAccepted, requirements_unsupported when the session needs something PayPal cannot collect (see load()’s requirements), payment_request_cancelled when the buyer cancels or closes PayPal, seller_pricing_unavailable when the account cannot price this payment through its webhook (it does not handle its own tax, or the cart has a promo code, buyer fee, marketplace split or a plan that renews), or payment_failed otherwise. On phones the tab goes to PayPal and the promise never settles. Call synchronously during user activation. Await prerequisites first because browsers revoke activation across asynchronous steps. Parameters
"paypal"
required
CheckoutSessionShowOptions
Returns Promise<CheckoutSessionConfirmResult>
CheckoutSessionPayment
required