@whop/elements 1.0.0-beta.4 → 1.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/checkout.d.cts CHANGED
@@ -11,17 +11,21 @@
11
11
  */
12
12
  export interface CheckoutOptions {
13
13
  /**
14
- * Existing plan ID, prefixed `plan_`. The element creates a checkout session for it, and the plan defines the price; nothing about amounts can be asserted client-side. Every checkout is created from this or a `checkoutConfiguration` — omitting both refuses loudly at mount. Set at create only: the session is minted from it, and changing it later refuses.
14
+ * Existing plan ID, prefixed `plan_`. Shorthand for an `items` array containing this plan and `quantity`. The plan defines the price; nothing about amounts can be asserted client-side. Pass either `plan`, `items`, or a `checkoutConfiguration`. Set at create only: the session is minted from it, and changing it later refuses.
15
15
  */
16
16
  plan?: string;
17
- /**
18
- * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
19
- */
20
- checkoutConfiguration?: string;
21
17
  /**
22
18
  * How many units to purchase. Plans that disallow multiples refuse values above 1. Set at create only: the session is minted with it, and changing it later refuses. @default 1
23
19
  */
24
20
  quantity?: number;
21
+ /**
22
+ * The plans in this checkout and how many units of each to purchase. Every item must belong to the same seller and use compatible billing terms; the API validates the complete cart and prices it as one charge. Pass this instead of `plan`, `quantity`, or `checkoutConfiguration`. Set at create only: the session is minted from this exact cart, and changing it later refuses.
23
+ */
24
+ items?: CheckoutItemInput[];
25
+ /**
26
+ * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
27
+ */
28
+ checkoutConfiguration?: string;
25
29
  /**
26
30
  * A promo code to apply before the buyer ever sees the price — the discount is on the first quote, and the buyer can still change or remove it. Pass the code a marketing link carried: a code that has expired or was never valid opens the checkout at full price with the reason on the promo row, never a checkout that will not open. Set at create only.
27
31
  */
@@ -64,7 +68,18 @@ export interface CheckoutOptions {
64
68
  * Consumer props for the "checkout" element. Set at create (or as `<CheckoutElement />` JSX props), and updatable live via `update()`.
65
69
  * @see https://docs.whop.com/elements/latest/checkout/checkout
66
70
  */
67
- export interface CheckoutElementProps {}
71
+ export interface CheckoutElementProps {
72
+ /**
73
+ * 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.
74
+ * @default ""
75
+ */
76
+ buyerEmail?: string;
77
+ /**
78
+ * 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.
79
+ * @default false
80
+ */
81
+ lockBuyerEmail?: boolean;
82
+ }
68
83
 
69
84
  /**
70
85
  * The live handle for a mounted "checkout" element. Returned by `create("checkout")`; in React, the component's `ref`.
@@ -95,6 +110,16 @@ export interface CheckoutElementHandle {
95
110
  * @see https://docs.whop.com/elements/latest/checkout/checkout
96
111
  */
97
112
  export interface CheckoutElementCreateOptions {
113
+ /**
114
+ * 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.
115
+ * @default ""
116
+ */
117
+ buyerEmail?: string;
118
+ /**
119
+ * 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.
120
+ * @default false
121
+ */
122
+ lockBuyerEmail?: boolean;
98
123
  /**
99
124
  * Runs after the loading skeleton first paints and before `onReady`.
100
125
  */
@@ -115,7 +140,7 @@ export interface CheckoutElementCreateOptions {
115
140
  */
116
141
  export interface ExpressCheckoutElementProps {
117
142
  /**
118
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
143
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
119
144
  * @default ["apple_pay","google_pay"]
120
145
  */
121
146
  wallets?: ("apple_pay" | "google_pay")[];
@@ -156,7 +181,7 @@ export interface ExpressCheckoutElementHandle {
156
181
  */
157
182
  export interface ExpressCheckoutElementCreateOptions {
158
183
  /**
159
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
184
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
160
185
  * @default ["apple_pay","google_pay"]
161
186
  */
162
187
  wallets?: ("apple_pay" | "google_pay")[];
@@ -190,7 +215,7 @@ export interface CheckoutHandle {
190
215
  */
191
216
  create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
192
217
  /**
193
- * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Apple Pay additionally requires the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before the button renders there. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
218
+ * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Both wallets require the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before either button renders there. Offering Google Pay on your own site is subject to the Google Pay API Terms of Service. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
194
219
  * Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
195
220
  */
196
221
  create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
@@ -210,6 +235,20 @@ export interface CheckoutHandle {
210
235
  */
211
236
  export interface CheckoutStatics {}
212
237
 
238
+ /**
239
+ * Declared from the app's `CheckoutItemInput`, referenced by a host-capability surface.
240
+ */
241
+ export interface CheckoutItemInput {
242
+ /**
243
+ * Existing plan ID, prefixed `plan_`.
244
+ */
245
+ plan: string;
246
+ /**
247
+ * Number of units to purchase. Defaults to 1; plans can disallow quantities above 1.
248
+ */
249
+ quantity?: number | undefined;
250
+ }
251
+
213
252
  /**
214
253
  * Checkout attribution recorded with the session. The element maps these fields to `POST /api/v1/checkout_sessions`; empty values are omitted, and `country` is resolved by the API.
215
254
  * Declared from the app's `CheckoutAttributionInput`, referenced by a host-capability surface.
package/checkout.d.ts CHANGED
@@ -11,17 +11,21 @@
11
11
  */
12
12
  export interface CheckoutOptions {
13
13
  /**
14
- * Existing plan ID, prefixed `plan_`. The element creates a checkout session for it, and the plan defines the price; nothing about amounts can be asserted client-side. Every checkout is created from this or a `checkoutConfiguration` — omitting both refuses loudly at mount. Set at create only: the session is minted from it, and changing it later refuses.
14
+ * Existing plan ID, prefixed `plan_`. Shorthand for an `items` array containing this plan and `quantity`. The plan defines the price; nothing about amounts can be asserted client-side. Pass either `plan`, `items`, or a `checkoutConfiguration`. Set at create only: the session is minted from it, and changing it later refuses.
15
15
  */
16
16
  plan?: string;
17
- /**
18
- * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
19
- */
20
- checkoutConfiguration?: string;
21
17
  /**
22
18
  * How many units to purchase. Plans that disallow multiples refuse values above 1. Set at create only: the session is minted with it, and changing it later refuses. @default 1
23
19
  */
24
20
  quantity?: number;
21
+ /**
22
+ * The plans in this checkout and how many units of each to purchase. Every item must belong to the same seller and use compatible billing terms; the API validates the complete cart and prices it as one charge. Pass this instead of `plan`, `quantity`, or `checkoutConfiguration`. Set at create only: the session is minted from this exact cart, and changing it later refuses.
23
+ */
24
+ items?: CheckoutItemInput[];
25
+ /**
26
+ * Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan — the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets — an option passed here beside it wins over the configuration’s copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configuration’s own plan, which can never be swapped out from under its presets. Set at create only.
27
+ */
28
+ checkoutConfiguration?: string;
25
29
  /**
26
30
  * A promo code to apply before the buyer ever sees the price — the discount is on the first quote, and the buyer can still change or remove it. Pass the code a marketing link carried: a code that has expired or was never valid opens the checkout at full price with the reason on the promo row, never a checkout that will not open. Set at create only.
27
31
  */
@@ -64,7 +68,18 @@ export interface CheckoutOptions {
64
68
  * Consumer props for the "checkout" element. Set at create (or as `<CheckoutElement />` JSX props), and updatable live via `update()`.
65
69
  * @see https://docs.whop.com/elements/latest/checkout/checkout
66
70
  */
67
- export interface CheckoutElementProps {}
71
+ export interface CheckoutElementProps {
72
+ /**
73
+ * 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.
74
+ * @default ""
75
+ */
76
+ buyerEmail?: string;
77
+ /**
78
+ * 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.
79
+ * @default false
80
+ */
81
+ lockBuyerEmail?: boolean;
82
+ }
68
83
 
69
84
  /**
70
85
  * The live handle for a mounted "checkout" element. Returned by `create("checkout")`; in React, the component's `ref`.
@@ -95,6 +110,16 @@ export interface CheckoutElementHandle {
95
110
  * @see https://docs.whop.com/elements/latest/checkout/checkout
96
111
  */
97
112
  export interface CheckoutElementCreateOptions {
113
+ /**
114
+ * 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.
115
+ * @default ""
116
+ */
117
+ buyerEmail?: string;
118
+ /**
119
+ * 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.
120
+ * @default false
121
+ */
122
+ lockBuyerEmail?: boolean;
98
123
  /**
99
124
  * Runs after the loading skeleton first paints and before `onReady`.
100
125
  */
@@ -115,7 +140,7 @@ export interface CheckoutElementCreateOptions {
115
140
  */
116
141
  export interface ExpressCheckoutElementProps {
117
142
  /**
118
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
143
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
119
144
  * @default ["apple_pay","google_pay"]
120
145
  */
121
146
  wallets?: ("apple_pay" | "google_pay")[];
@@ -156,7 +181,7 @@ export interface ExpressCheckoutElementHandle {
156
181
  */
157
182
  export interface ExpressCheckoutElementCreateOptions {
158
183
  /**
159
- * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Apple Pay also needs the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the Apple Pay button stays hidden.
184
+ * Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device, the served matrix, or the checkout’s payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the page’s domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) — first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).
160
185
  * @default ["apple_pay","google_pay"]
161
186
  */
162
187
  wallets?: ("apple_pay" | "google_pay")[];
@@ -190,7 +215,7 @@ export interface CheckoutHandle {
190
215
  */
191
216
  create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
192
217
  /**
193
- * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Apple Pay additionally requires the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before the button renders there. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
218
+ * One-press Apple Pay and Google Pay buttons for a checkout — the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with — and the checkout's own payment method configuration allows — using the served button art, and renders nothing where no wallet is available. Both wallets require the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before either button renders there. Offering Google Pay on your own site is subject to the Google Pay API Terms of Service. A checkout the sheet cannot honestly finish — a waitlist join, a transfer, a form question only a page can ask — refuses loudly instead of rendering a doomed button.
194
219
  * Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
195
220
  */
196
221
  create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
@@ -210,6 +235,20 @@ export interface CheckoutHandle {
210
235
  */
211
236
  export interface CheckoutStatics {}
212
237
 
238
+ /**
239
+ * Declared from the app's `CheckoutItemInput`, referenced by a host-capability surface.
240
+ */
241
+ export interface CheckoutItemInput {
242
+ /**
243
+ * Existing plan ID, prefixed `plan_`.
244
+ */
245
+ plan: string;
246
+ /**
247
+ * Number of units to purchase. Defaults to 1; plans can disallow quantities above 1.
248
+ */
249
+ quantity?: number | undefined;
250
+ }
251
+
213
252
  /**
214
253
  * Checkout attribution recorded with the session. The element maps these fields to `POST /api/v1/checkout_sessions`; empty values are omitted, and `country` is resolved by the API.
215
254
  * Declared from the app's `CheckoutAttributionInput`, referenced by a host-capability surface.