Skip to main content

Try it (its real) 👇

React setup

Step 1: Install the package

Step 2: Add the button

The returnUrl is required on the one click checkout button (unlike the regular embedded checkout, where it’s optional). Payments started here may complete inside the Whop Pay dialog via a redirect-based payment method (3DS, Sezzle, etc.) and the user needs somewhere to land that closes the loop on your page. When the customer is redirected back, check the status query parameter:
  • success: The payment succeeded.
  • error: The payment failed or was canceled.
On success, the redirect also includes:
  • payment_id — the id of the payment. Use it to look up the payment on your backend or render a confirmation.
  • setup_intent_id — set instead of payment_id when checkout didn’t charge anything (e.g. saving a card for future use).
  • state_id — the checkout session id.

Step 3: (optional) Configure - Available properties

planId

Required (or checkoutConfigurationId) - The plan id you want to checkout. Provide either this or checkoutConfigurationId, not both.

checkoutConfigurationId

Required (or planId) - An API-created checkout configuration id. Use this to mount the button against a pre-configured checkout (e.g. with attached metadata, a pre-applied promo, or a multi-line cart) instead of creating a new session at mount time. Provide either this or planId, not both.

returnUrl

Required - The URL to return to after payment authorization flows.

methods

Optional - Which methods the button is allowed to render, in priority order. Defaults to ["apple-pay", "google-pay", "whop-pay"].
  • apple-pay — the native Apple Pay button (Safari and other Apple Pay-capable browsers).
  • google-pay — the native Google Pay button (Chrome, Android, and other Google Pay-capable browsers).
  • whop-pay — a Whop Pay button that opens checkout in a dialog.
Wallet requests are strict: a methods={["google-pay"]} button only ever renders Google Pay — it never falls back to Apple Pay (and vice versa). If none of the allowed methods can render in the current browser, nothing renders and the onExpressMethodResolved callback fires with { rendered: "none" }.

theme

Optional - The theme for the button and the dialog. Possible values are light, dark, or system.

themeOptions

Optional - Theme tuning for the Whop Pay dialog.

prefill

Optional - Prefill the email or address inside the Whop Pay dialog. Same shape as the regular embedded checkout — see prefill options.

affiliateCode

Optional - Attribute the sale to an affiliate.

promoCode

Optional - Apply a promo code on the session.

adaptivePricing

Optional - Set to true to present prices in the buyer’s local currency where supported. Defaults to false.

skipRedirect

Optional - Set to true to skip the final redirect and keep your page loaded. Automatically true when onComplete is provided.

onComplete

Optional - Fires when the checkout completes successfully.
Setting this implies skipRedirect = true.

onPaymentError

Optional - Fires when checkout payment processing fails, with a human readable message and an optional machine readable code.

onExpressMethodResolved

Optional - Fires once the button decides which method it will render.
rendered: "none" means the button won’t show anything — typically because the only requested method is apple-pay and the browser can’t render it. Use this to hide the surrounding slot so you don’t leave an empty space on the page.

What renders

The button picks one method per browser, in this order: If you only request apple-pay and the browser can’t render it, the button signals back to your page (via the express-method-resolved event) so you can hide the slot.

Other websites

Step 1: Add the script tag

Step 2: Add the button

The one click checkout button is a custom element. Once the script loads it registers <whop-express-checkout-button>:

Step 3: (optional) Configure - Available attributes

Step 4: Listening for events

The custom element dispatches DOM events you can listen for: