v1.0.0.
Create this
Returns availability for each wallet when the account offers it, the device supports it, and this page’s origin is approved for the account (first-party whop.com pages are pre-approved; a merchant page needs Apple Pay ready on its domain through the Domains API, and offering Google Pay there is subject to the Google Pay API Terms of Service). On a page that is itself inside an iframe, Apple Pay checks the top-level page’s domain instead when the browser exposes it. Apple Pay on non-WebKit browsers is the desktop iPhone-handoff flow, so mobile devices there report it unavailable — native Apple Pay on iOS browsers is unaffected.
Open the selected wallet after awaiting
Change
The buyer chose a shipping address (redacted pre-authorization: city, state, postal code and country only; Apple Pay and the
The buyer picked a shipping option, or the sheet re-announced the selected one: once the address changes are all answered and none is waiting, Apple Pay and the
The buyer selected a card, with its redacted billing address (city, state, postal code and country only): reprice the total for the address the charge taxes off. Apple Pay fires it when the buyer selects a card, and Google Pay when the sheet opens and each time the buyer switches cards. Answer
The buyer selected a payment method: reprice the total for it, such as a surcharge on credit cards. Apple Pay fires it when the buyer selects a card, and Google Pay when the sheet opens and each time the buyer switches cards, each right after that card’s
The buyer typed, changed, or removed a code in the sheet’s promo field (
The buyer authorized the payment, and no confirmation token exists yet. Subscribe to approve or refuse it first: the sheet waits for your answer, and without a handler the token is created at once. The event carries the payer, the payment method (with its redacted billing address, and in
The sheet created a confirmation token, heard once the sheet has closed. This is the same result that
The buyer dismissed the sheet or closed PayPal. Returns the unsubscribe function.
Payments resource without mounting an element: whop.payments.paymentRequest.create({ … }) in vanilla or useWhop().payments.paymentRequest.create({ … }) in React.Options
Pass these towhop.payments.paymentRequest.create({ … }).Where PayPal sends the buyer back after a
payPalRedirectOnMobile redirect. Defaults to the current page. Unreleased, in development.Set only after displaying save consent. Marks the token for
off_session or on_session use.Payment method filters in the API’s
enabled, disabled, and include_platform_defaults format. They narrow the methods the whop_pay sheet offers, and the wallets canMakePayment() reports: disabled removes types, enabled restores offered types, and include_platform_defaults: false leaves only enabled types. They never add a method the account doesn’t offer. PayPal follows the paypal type. Since v1.9.0.Ask the sheet for the payer’s phone number, delivered as
payer.phone on the result — in E.164 where it parses against the country of the contact that supplied it, as the wallet gave it otherwise; payer.country is the billing country. Google Pay collects it through the billing address the sheet already asks for. PayPal collects it through its contact section and refuses an account without one. Defaults to false.Let the buyer change a provided email inside the
whop_pay sheet. Off (the default), the payer identity is fixed to what show() was given. On, the sheet’s contact step shows the provided email prefilled and editable, and the result’s payer.email follows whatever the buyer ended on. The other sheets ignore it. Defaults to false. Unreleased, in development.Ask the sheet for a shipping address (and offer
shippingOptions when given). PayPal always asks for an address, since it is the address tax is computed on, and returns it as shipping only when this is set. Defaults to false.How much billing address the
whop_pay sheet collects with the contact details: full (default — the country’s complete address format) or minimal (name, country, postal code). The other sheets ignore this — their card networks supply billing. Defaults to "full". Unreleased, in development.Offer the sheet’s own promo code field and answer
onPromoCodeChange. Whop Pay always shows it, under the totals. Apple Pay shows the field on devices that support Apple Pay version 12 (iOS 15 and macOS 12); Google Pay shows it where the account’s Google Pay setup allows offers. Other devices open the sheet without it. Defaults to false. Since v1.5.0.A promo code already applied to the charge, prefilled into the sheet so the buyer can see, replace or remove it. Since
v1.5.0.What
appliedPromoCode does, shown next to the code in Google Pay and the whop_pay sheet. Apple Pay’s coupon field has no caption. Since v1.5.0.On phones, send the buyer to PayPal with a full-page redirect instead of opening PayPal’s window inside the page.
show('paypal_express') then resolves straight away with a confirmation token for a PayPal redirect: payer holds only an email passed to show(), billing and shipping are null, and no change events fire, so the total is not repriced on the page. Confirm the token as usual; the payment then waits for the buyer with a redirect to PayPal, which handleNextAction follows, and the buyer returns to returnUrl. Applies only when neither requestShipping nor requestPayerPhone is set; otherwise, and on desktop, PayPal opens as before. Defaults to false. Defaults to false. Unreleased, in development.Account ISO 3166-1 alpha-2 country code for the Apple Pay sheet. Omit it to use the account’s published registration country. The sheet defaults to
US when neither is available.Shipping options the sheet offers when
requestShipping is set. Display-only — update amount from your change handler. The sheet opens with the first option selected and fires no onShippingOptionChange for it, so amount must already include its price. Change it later with update().Methods
Call these on the resource.canMakePayment
Returns availability for each wallet when the account offers it, the device supports it, and this page’s origin is approved for the account (first-party whop.com pages are pre-approved; a merchant page needs Apple Pay ready on its domain through the Domains API, and offering Google Pay there is subject to the Google Pay API Terms of Service). On a page that is itself inside an iframe, Apple Pay checks the top-level page’s domain instead when the browser exposes it. Apple Pay on non-WebKit browsers is the desktop iPhone-handoff flow, so mobile devices there report it unavailable — native Apple Pay on iOS browsers is unaffected. order ranks the wallets by which sheet is native to the browser — Apple Pay first on Safari, Google Pay first elsewhere, PayPal last — so express buttons can stack best-first. payPal reports PayPal where the account offers it in this currency, the amount is within PayPal’s limits, the request does not ask for the payer’s phone (an off_session request may be $0, which saves PayPal without a charge), PayPal’s scripts load on this page, and this page’s origin is approved for the account like the other wallets’. A page with a Content Security Policy must allow PayPal’s hosts, which contentSecurityPolicy() includes. A page that already loads PayPal’s own v5 JavaScript SDK reports payPal: false. Pass types to check only the wallets you list; show(type) needs that wallet checked. wallets carries each available wallet’s official button art (light and dark color and image). whopPay is Whop’s own sheet — Whop-rendered, so it needs no device or domain check: it reports available wherever the account offers Whop Pay and its sheet has a payment method to show for this charge, on any device. This primes show(). Always await it first.ParametersReturns Promise<WalletAvailability>Whop’s own wallet sheet (
show('whop_pay')). Whop-rendered, so it needs no device or origin approval: true wherever the account offers Whop Pay and its sheet has a payment method to show for this charge, on a request minted through whop.payments.paymentRequest.create.The wallets ranked by which sheet is native to this browser — Apple Pay first on WebKit, Google Pay first everywhere else, PayPal last — so express buttons can stack best-first. Never lists
whop_pay, which is not a device wallet. Absent on consumer-stated availability (previews) and on wires that predate it. An inline union, not payment-request’s WalletSheetType: that module already imports this one.Each available wallet’s details, keyed by wallet type. Absent on consumer-stated availability (previews).
show
Open the selected wallet after awaiting canMakePayment(), synchronously in the press: Apple requires session creation within the gesture stack, and PayPal opens its window there — a pop-up on desktop, PayPal’s in-page window when the pop-up is blocked and on mobile. Pass email when your page already collected one — the wallet takes it and never asks for a second. With requestPayerEmail: false, passing one is required, and the wallet refuses to open without it because confirmation tokens require an email. While the sheet is open, update() throws: answer the change events to change it. show('whop_pay') opens Whop’s own sheet instead — a Whop-rendered modal with no activation requirement that collects the email itself when none was passed (one you pass must be a complete address), offers the buyer’s saved methods after sign-in, and resolves the same result with type whop_pay and, in paymentMethodPreview, the payment method the buyer picked, once the sheet has played its success animation and closed: every sheet is gone before you hear its result. Rejects with payment_request_cancelled after onCancel fires when the buyer dismisses the sheet. Rejects with A payment sheet is already open while another sheet is up, and, for whop_pay, when the request was minted without a presentation rail. A confirmation token an OS sheet or PayPal could not create rejects with that error and never fires onCancel. The whop_pay sheet lets the buyer try again after a failed token instead of closing. It rejects with an error and no onCancel when it failed, closed while it was creating the token, or stopped before it could be heard; any other close ends as a cancel. Call synchronously during user activation. Await prerequisites first because browsers revoke activation across asynchronous steps.ParametersReturns Promise<PaymentRequestResult>The wallet sheet that minted the token.
What the token says about the payment method it carries: its
type (in the whop_pay sheet, the method the buyer picked, such as card or klarna), category, displayName such as Visa •••• 4242, and brand and last four digits where there are any. Absent when the API sent none with the token.phone is E.164 where it parsed against the contact’s country, as given otherwise; PayPal gives one only for requestPayerPhone, and refuses an account without one. country is the billing country every sheet collects.The full billing address the confirmation token carries, unlike the redacted one the change events carry;
null when the wallet gave none. Apple Pay and Google Pay give the card’s billing address. On PayPal it is the address the buyer picked in PayPal, the one its total was taxed on. The whop_pay sheet gives the billing address the buyer entered in it.null unless requestShipping was set. option is the selected shipping option: the first offered one until the buyer picks another, and the first again when an answer replaced the options without the picked id. Apple Pay, Google Pay and the Whop sheet set it whenever options were offered, and PayPal never does.update
Change amount, lineItems and shippingOptions on this instance. Every other option is fixed at create(): create a new instance to change it.ParametersEvents
Subscribe to events below. Each method returns an unsubscribe function.onShippingAddressChange
The buyer chose a shipping address (redacted pre-authorization: city, state, postal code and country only; Apple Pay and the whop_pay sheet cut a US ZIP code to five digits and drop the last three characters of a Canadian or UK postal code). The whop_pay sheet fires it when the buyer picks a complete address, or finishes typing one, as Apple Pay fires it on a shipping contact selection, and holds the address until you answer; each address reaches your handler, one at a time. Answer with the totals for the address and the selected shipping option: the first one until the buyer picks another. shippingOptions replaces the options (an empty list changes nothing). A picked option stays selected while the answer keeps its id; when the answer drops it, the first option becomes the selection without an onShippingOptionChange, so price that one. Every error in the answer stays on the address until a later answer for an address clears it: one that names a field (city, state, postal_code, country) marks that field in Apple Pay and the whop_pay sheet, Google Pay shows the message alone. Pay is refused while an error stands on the address, and the whop_pay sheet holds its Pay button. Refuse an address you can’t ship to with a shipping_address_unserviceable error and no field. The whop_pay sheet offers to ask again when your handler threw, rejected or didn’t answer in time. On Apple Pay, Google Pay, PayPal and the whop_pay sheet, a handler that hasn’t answered within 25 seconds fails the address, the way a throwing one does, and its later answer is ignored. PayPal fires it with the address the buyer picks, and an error naming a field refuses that part of the address inside PayPal. Call updateWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onShippingOptionChange
The buyer picked a shipping option, or the sheet re-announced the selected one: once the address changes are all answered and none is waiting, Apple Pay and the whop_pay sheet fire it for the option still selected. It never fires after an answer that drops the selected option, which makes the first option the selection without an event, so every total you answer prices the selected option: the first one until the buyer picks another, the pick while your answers keep its id, and the first again once an answer drops it. Amount-only contract: updateWith carries amount/lineItems/shippingOptions/errors. An answer with errors refuses the option until the buyer picks one your handler accepts; on the whop_pay sheet, an address answer that issues the options again clears the refusal too. Apple Pay has no error slot for a shipping option, so it keeps the last accepted total whatever else the answer carries, and the first error’s message shows when the buyer taps Pay; the whop_pay sheet keeps the last accepted total the same way, shows the message beside the options and holds its Pay button, and offers to ask again when your handler threw, rejected or didn’t answer in time. Google Pay shows the message when the option is picked. The whop_pay sheet holds its options while an answer that could replace them is out. On Apple Pay, Google Pay, PayPal and the whop_pay sheet, a handler that hasn’t answered within 25 seconds refuses the option, the way a throwing one does, and its later answer is ignored. Call updateWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onBillingAddressChange
The buyer selected a card, with its redacted billing address (city, state, postal code and country only): reprice the total for the address the charge taxes off. Apple Pay fires it when the buyer selects a card, and Google Pay when the sheet opens and each time the buyer switches cards. Answer updateWith({ amount }) in minor units, updateWith({}) to keep the current total, or updateWith({ errors }) to refuse the card. Every event is answered exactly once: a handler that throws, rejects, or doesn’t answer within 10 seconds refuses the card, so the buyer picks another one. On Apple Pay and Google Pay the same selection then fires paymentMethodChange, and the sheet updates once both are answered. PayPal fires it with each shipping address the buyer picks in PayPal, which is the address its token bills and taxes on, and a refusal there refuses that address inside PayPal. The whop_pay sheet collects the billing address apart from the payment method, so it fires this for complete billing details whose city, state, postal code or country changed since the last time it fired: once they have held still for 750ms, typed or filled in from the buyer’s saved addresses, and at once when the buyer leaves its contact step or presses Pay, never on a method pick. It renders a refusal beside those details (on the named field when one is given) and holds its Pay button until the buyer changes them; it offers to ask again only when your handler threw, rejected, or missed the deadline. Call updateWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onPaymentMethodChange
The buyer selected a payment method: reprice the total for it, such as a surcharge on credit cards. Apple Pay fires it when the buyer selects a card, and Google Pay when the sheet opens and each time the buyer switches cards, each right after that card’s billingAddressChange. The whop_pay sheet fires it for each method the buyer picks, and once for the method it selected itself before the buyer can pay. paymentMethod.type is card on Apple Pay and Google Pay, and the picked payment method type in the whop_pay sheet. paymentMethod.card carries what the wallet tells about a card before the buyer authorizes: Apple Pay reports its funding (Apple usually withholds the network until then), and Google Pay its network. The whop_pay sheet reports only type and never card, so neither a card’s network nor its funding reaches you before the buyer pays. paymentMethod.billingAddress is the card’s redacted billing address on Apple Pay and Google Pay; the whop_pay sheet reports its billing address through billingAddressChange instead. Answer updateWith({ amount, lineItems }) to reprice, updateWith({}) to keep the current total, or updateWith({ errors }) to refuse the method; shippingOptions is ignored. Apple Pay marks a refusal on the card’s billing contact (on the named field when one is given) and the whop_pay sheet shows it under its methods; each holds its Pay button until the buyer picks another method. Google Pay shows the message on the card and refuses a Pay tap on it until the buyer picks a card you accept. On Apple Pay and Google Pay a refused card leaves the totals as they were, whatever this answer or its billingAddressChange answer priced. Every event is answered exactly once: a handler that throws, rejects, or doesn’t answer within 10 seconds refuses the method, and the whop_pay sheet then offers to ask again. Each sheet waits for your answer before the buyer can pay. PayPal never fires it. Call updateWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onPromoCodeChange
The buyer typed, changed, or removed a code in the sheet’s promo field (requestPromoCode). Answer updateWith({ amount }) to apply the code at a new total, updateWith({}) to apply it at the current total, or updateWith({ error }) to refuse it in place. A removal arrives with code null and is answered the same way. Replacing an applied code arrives as one event with the new code, never a removal first, and a refused new code leaves the applied one in place. When shippingOptions drops the selected option, the first one becomes the selection without an onShippingOptionChange, so price that one. appliedDescription captions the code in Google Pay and the whop_pay sheet; Apple Pay’s coupon field has no caption, so put anything the buyer must see in a line item label. A handler that throws, rejects, or doesn’t answer within 10 seconds refuses the code. Call updateWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onPaymentAuthorization
The buyer authorized the payment, and no confirmation token exists yet. Subscribe to approve or refuse it first: the sheet waits for your answer, and without a handler the token is created at once. The event carries the payer, the payment method (with its redacted billing address, and in displayName the wallet’s own label for it, such as Visa 1234), the shipping address and option, and the total and line items the buyer authorized. Answer respondWith({ approved: true }) to create the token, which show() and onConfirmationToken then deliver as usual. Answer respondWith({ approved: false, message }) to refuse: no token is created, Apple Pay and Google Pay show message in the sheet, and the buyer can change something and pay again, or close the sheet. PayPal can’t show your message, so a refusal there ends the attempt: show() rejects with payment_request_refused, and the buyer can press PayPal again. The whop_pay sheet asks when the buyer presses Pay, with type whop_pay and paymentMethod.type the payment method the buyer picked: Pay shows that it is waiting, and a refusal shows message beside Pay, which the buyer can press again. Every event is answered exactly once, and only approved: true creates a token: a handler that throws, rejects, or doesn’t answer within 25 seconds refuses the payment, early enough for Apple Pay and Google Pay to show the refusal before their own 30-second limit. Call respondWith(…) exactly once per event. A handler that throws or rejects before calling it fails that update right away. Returns the unsubscribe function.onConfirmationToken
The sheet created a confirmation token, heard once the sheet has closed. This is the same result that show() returns. Returns the unsubscribe function.onCancel
The buyer dismissed the sheet or closed PayPal. Returns the unsubscribe function.Content security policy
This resource runs on your page, not in a frame. A page with a Content Security Policy needs these sources.contentSecurityPolicy() from @whop/elements returns every source in this table. The sandbox source applies with environment: "sandbox".
