@whop/elements 1.0.0-beta.1 → 1.0.0-beta.3
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/ads.d.cts +33 -3
- package/ads.d.ts +33 -3
- package/checkout.d.cts +3 -3
- package/checkout.d.ts +3 -3
- package/index.d.cts +8 -3
- package/index.d.ts +8 -3
- package/package.json +10 -2
- package/payments.d.cts +11 -11
- package/payments.d.ts +11 -11
- package/tracking.d.cts +94 -3
- package/tracking.d.ts +94 -3
- package/verifications.d.cts +308 -0
- package/verifications.d.ts +308 -0
- package/wallet.d.cts +2222 -541
- package/wallet.d.ts +2222 -541
- package/websites.d.cts +36 -10
- package/websites.d.ts +36 -10
package/ads.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ export interface AdsOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
accountId?: string;
|
|
18
18
|
/**
|
|
19
|
-
* A scoped token every surface under this handle reads and writes with. **Mint one token for the whole handle, not one per element.** Work out the scopes of every element you are going to mount, request them on a single token, and set it here — the handle projects that one credential into each element's frame, so a second token per surface buys nothing and leaves you several expiration dates to track instead of one. Mint it on your server with `POST /api/v1/access_tokens` and set a fresh one with `update({ accessToken })` before it expires. Mounting everything needs `ad_campaign:read`/`:create`, `ad_group:read`, `ad:read`, `stats:read`, the `:update`/`:delete` scopes the table's row actions use, `company:basic:read` for the pixel checks `campaign-creator` runs, and `payment:charge` plus `user:email:read` to add an ad-spend card
|
|
19
|
+
* A scoped token every surface under this handle reads and writes with. **Mint one token for the whole handle, not one per element.** Work out the scopes of every element you are going to mount, request them on a single token, and set it here — the handle projects that one credential into each element's frame, so a second token per surface buys nothing and leaves you several expiration dates to track instead of one. Mint it on your server with `POST /api/v1/access_tokens` and set a fresh one with `update({ accessToken })` before it expires. Mounting everything needs `ad_campaign:read`/`:create`, `ad_group:read`, `ad:read`, `stats:read`, the `:update`/`:delete` scopes the table's row actions use, `company:basic:read` for the pixel checks `campaign-creator` runs, and `payment:charge` plus `user:email:read` to add an ad-spend card; the billing slots list stored cards and spendable wallets with `member:payment_methods:read`. Mounting fewer surfaces can ask for fewer scopes — still on the one token. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
20
20
|
*/
|
|
21
21
|
accessToken?: string;
|
|
22
22
|
/**
|
|
@@ -120,6 +120,11 @@ export interface CampaignCreatorElementProps {
|
|
|
120
120
|
* @default "campaign-settings"
|
|
121
121
|
*/
|
|
122
122
|
initialStep?: "ads" | "ad-groups" | "campaign-settings";
|
|
123
|
+
/**
|
|
124
|
+
* File IDs (`file_…`) your app uploaded via `POST /api/v1/files`, offered in the builder's creative library. They show first in the library list, in this order, and while any are set the media pickers open on the library instead of the upload drop zone. Create the files with the same API key that mints the `ads` handle's `accessToken` — the builder reads them back in one batch (`GET /api/v1/files`), and file reads only answer the credential that created them. Pass at most 250 IDs, the batch read's limit. A file appears once its upload has finished processing; an ID that never finishes, or that points at something other than an image or video, is left out. Pass new IDs with `update({ externalMediaIds })` to stream media into a builder that is already open.
|
|
125
|
+
* @default []
|
|
126
|
+
*/
|
|
127
|
+
externalMediaIds?: string[];
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
/**
|
|
@@ -171,6 +176,11 @@ export interface CampaignCreatorElementCreateOptions {
|
|
|
171
176
|
* @default "campaign-settings"
|
|
172
177
|
*/
|
|
173
178
|
initialStep?: "ads" | "ad-groups" | "campaign-settings";
|
|
179
|
+
/**
|
|
180
|
+
* File IDs (`file_…`) your app uploaded via `POST /api/v1/files`, offered in the builder's creative library. They show first in the library list, in this order, and while any are set the media pickers open on the library instead of the upload drop zone. Create the files with the same API key that mints the `ads` handle's `accessToken` — the builder reads them back in one batch (`GET /api/v1/files`), and file reads only answer the credential that created them. Pass at most 250 IDs, the batch read's limit. A file appears once its upload has finished processing; an ID that never finishes, or that points at something other than an image or video, is left out. Pass new IDs with `update({ externalMediaIds })` to stream media into a builder that is already open.
|
|
181
|
+
* @default []
|
|
182
|
+
*/
|
|
183
|
+
externalMediaIds?: string[];
|
|
174
184
|
/**
|
|
175
185
|
* The account owner backed out of the builder without launching. Nothing has been discarded — a draft campaign, if one was started, is already saved. An overlay has already closed itself by the time this fires; react to it if your page needs to.
|
|
176
186
|
*/
|
|
@@ -394,6 +404,16 @@ export interface TableElementProps {
|
|
|
394
404
|
* @default true
|
|
395
405
|
*/
|
|
396
406
|
showPausedCampaigns?: boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Whether paused ad groups are listed.
|
|
409
|
+
* @default true
|
|
410
|
+
*/
|
|
411
|
+
showPausedAdGroups?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Whether paused ads are listed.
|
|
414
|
+
* @default true
|
|
415
|
+
*/
|
|
416
|
+
showPausedAds?: boolean;
|
|
397
417
|
}
|
|
398
418
|
|
|
399
419
|
/**
|
|
@@ -455,6 +475,16 @@ export interface TableElementCreateOptions {
|
|
|
455
475
|
* @default true
|
|
456
476
|
*/
|
|
457
477
|
showPausedCampaigns?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Whether paused ad groups are listed.
|
|
480
|
+
* @default true
|
|
481
|
+
*/
|
|
482
|
+
showPausedAdGroups?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Whether paused ads are listed.
|
|
485
|
+
* @default true
|
|
486
|
+
*/
|
|
487
|
+
showPausedAds?: boolean;
|
|
458
488
|
/**
|
|
459
489
|
* The open tab changed. Mirror it into your own URL if you want it to survive a reload.
|
|
460
490
|
*/
|
|
@@ -472,9 +502,9 @@ export interface TableElementCreateOptions {
|
|
|
472
502
|
*/
|
|
473
503
|
onCustomMetricsChanged?: ((payload: { customMetrics: CustomMetricDefinition[]; }) => void);
|
|
474
504
|
/**
|
|
475
|
-
* The viewer moved one of the table’s own controls — the All tab’s drill, the breakdown, the search box, the paused toggle. Carries all
|
|
505
|
+
* The viewer moved one of the table’s own controls — the All tab’s drill, the breakdown, the search box, the paused toggle on any of the three tabs. Carries all of them whichever moved; store them and pass them back as props, or they reset on the next mount.
|
|
476
506
|
*/
|
|
477
|
-
onViewChanged?: ((payload: { sourcesDrill: string | null; breakdown: "age" | "gender" | "age_gender" | "placement" | "publisher_platform" | "device_platform" | "impression_device" | "country" | "region" | "hour" | null; query: string; showPausedCampaigns: boolean; }) => void);
|
|
507
|
+
onViewChanged?: ((payload: { sourcesDrill: string | null; breakdown: "age" | "gender" | "age_gender" | "placement" | "publisher_platform" | "device_platform" | "impression_device" | "country" | "region" | "hour" | null; query: string; showPausedCampaigns: boolean; showPausedAdGroups: boolean; showPausedAds: boolean; }) => void);
|
|
478
508
|
/**
|
|
479
509
|
* What the All tab is now looking at, as source paths ready to hand to a chart: `null` off the All tab (Whop advertising alone), `[]` for every source, otherwise the ticked rows or the drilled-into group. Every surface under the same handle has already followed it.
|
|
480
510
|
*/
|
package/ads.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface AdsOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
accountId?: string;
|
|
18
18
|
/**
|
|
19
|
-
* A scoped token every surface under this handle reads and writes with. **Mint one token for the whole handle, not one per element.** Work out the scopes of every element you are going to mount, request them on a single token, and set it here — the handle projects that one credential into each element's frame, so a second token per surface buys nothing and leaves you several expiration dates to track instead of one. Mint it on your server with `POST /api/v1/access_tokens` and set a fresh one with `update({ accessToken })` before it expires. Mounting everything needs `ad_campaign:read`/`:create`, `ad_group:read`, `ad:read`, `stats:read`, the `:update`/`:delete` scopes the table's row actions use, `company:basic:read` for the pixel checks `campaign-creator` runs, and `payment:charge` plus `user:email:read` to add an ad-spend card
|
|
19
|
+
* A scoped token every surface under this handle reads and writes with. **Mint one token for the whole handle, not one per element.** Work out the scopes of every element you are going to mount, request them on a single token, and set it here — the handle projects that one credential into each element's frame, so a second token per surface buys nothing and leaves you several expiration dates to track instead of one. Mint it on your server with `POST /api/v1/access_tokens` and set a fresh one with `update({ accessToken })` before it expires. Mounting everything needs `ad_campaign:read`/`:create`, `ad_group:read`, `ad:read`, `stats:read`, the `:update`/`:delete` scopes the table's row actions use, `company:basic:read` for the pixel checks `campaign-creator` runs, and `payment:charge` plus `user:email:read` to add an ad-spend card; the billing slots list stored cards and spendable wallets with `member:payment_methods:read`. Mounting fewer surfaces can ask for fewer scopes — still on the one token. Omitted, the calls carry the viewer's own session, which only answers same-origin.
|
|
20
20
|
*/
|
|
21
21
|
accessToken?: string;
|
|
22
22
|
/**
|
|
@@ -120,6 +120,11 @@ export interface CampaignCreatorElementProps {
|
|
|
120
120
|
* @default "campaign-settings"
|
|
121
121
|
*/
|
|
122
122
|
initialStep?: "ads" | "ad-groups" | "campaign-settings";
|
|
123
|
+
/**
|
|
124
|
+
* File IDs (`file_…`) your app uploaded via `POST /api/v1/files`, offered in the builder's creative library. They show first in the library list, in this order, and while any are set the media pickers open on the library instead of the upload drop zone. Create the files with the same API key that mints the `ads` handle's `accessToken` — the builder reads them back in one batch (`GET /api/v1/files`), and file reads only answer the credential that created them. Pass at most 250 IDs, the batch read's limit. A file appears once its upload has finished processing; an ID that never finishes, or that points at something other than an image or video, is left out. Pass new IDs with `update({ externalMediaIds })` to stream media into a builder that is already open.
|
|
125
|
+
* @default []
|
|
126
|
+
*/
|
|
127
|
+
externalMediaIds?: string[];
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
/**
|
|
@@ -171,6 +176,11 @@ export interface CampaignCreatorElementCreateOptions {
|
|
|
171
176
|
* @default "campaign-settings"
|
|
172
177
|
*/
|
|
173
178
|
initialStep?: "ads" | "ad-groups" | "campaign-settings";
|
|
179
|
+
/**
|
|
180
|
+
* File IDs (`file_…`) your app uploaded via `POST /api/v1/files`, offered in the builder's creative library. They show first in the library list, in this order, and while any are set the media pickers open on the library instead of the upload drop zone. Create the files with the same API key that mints the `ads` handle's `accessToken` — the builder reads them back in one batch (`GET /api/v1/files`), and file reads only answer the credential that created them. Pass at most 250 IDs, the batch read's limit. A file appears once its upload has finished processing; an ID that never finishes, or that points at something other than an image or video, is left out. Pass new IDs with `update({ externalMediaIds })` to stream media into a builder that is already open.
|
|
181
|
+
* @default []
|
|
182
|
+
*/
|
|
183
|
+
externalMediaIds?: string[];
|
|
174
184
|
/**
|
|
175
185
|
* The account owner backed out of the builder without launching. Nothing has been discarded — a draft campaign, if one was started, is already saved. An overlay has already closed itself by the time this fires; react to it if your page needs to.
|
|
176
186
|
*/
|
|
@@ -394,6 +404,16 @@ export interface TableElementProps {
|
|
|
394
404
|
* @default true
|
|
395
405
|
*/
|
|
396
406
|
showPausedCampaigns?: boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Whether paused ad groups are listed.
|
|
409
|
+
* @default true
|
|
410
|
+
*/
|
|
411
|
+
showPausedAdGroups?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Whether paused ads are listed.
|
|
414
|
+
* @default true
|
|
415
|
+
*/
|
|
416
|
+
showPausedAds?: boolean;
|
|
397
417
|
}
|
|
398
418
|
|
|
399
419
|
/**
|
|
@@ -455,6 +475,16 @@ export interface TableElementCreateOptions {
|
|
|
455
475
|
* @default true
|
|
456
476
|
*/
|
|
457
477
|
showPausedCampaigns?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Whether paused ad groups are listed.
|
|
480
|
+
* @default true
|
|
481
|
+
*/
|
|
482
|
+
showPausedAdGroups?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Whether paused ads are listed.
|
|
485
|
+
* @default true
|
|
486
|
+
*/
|
|
487
|
+
showPausedAds?: boolean;
|
|
458
488
|
/**
|
|
459
489
|
* The open tab changed. Mirror it into your own URL if you want it to survive a reload.
|
|
460
490
|
*/
|
|
@@ -472,9 +502,9 @@ export interface TableElementCreateOptions {
|
|
|
472
502
|
*/
|
|
473
503
|
onCustomMetricsChanged?: ((payload: { customMetrics: CustomMetricDefinition[]; }) => void);
|
|
474
504
|
/**
|
|
475
|
-
* The viewer moved one of the table’s own controls — the All tab’s drill, the breakdown, the search box, the paused toggle. Carries all
|
|
505
|
+
* The viewer moved one of the table’s own controls — the All tab’s drill, the breakdown, the search box, the paused toggle on any of the three tabs. Carries all of them whichever moved; store them and pass them back as props, or they reset on the next mount.
|
|
476
506
|
*/
|
|
477
|
-
onViewChanged?: ((payload: { sourcesDrill: string | null; breakdown: "age" | "gender" | "age_gender" | "placement" | "publisher_platform" | "device_platform" | "impression_device" | "country" | "region" | "hour" | null; query: string; showPausedCampaigns: boolean; }) => void);
|
|
507
|
+
onViewChanged?: ((payload: { sourcesDrill: string | null; breakdown: "age" | "gender" | "age_gender" | "placement" | "publisher_platform" | "device_platform" | "impression_device" | "country" | "region" | "hour" | null; query: string; showPausedCampaigns: boolean; showPausedAdGroups: boolean; showPausedAds: boolean; }) => void);
|
|
478
508
|
/**
|
|
479
509
|
* What the All tab is now looking at, as source paths ready to hand to a chart: `null` off the All tab (Whop advertising alone), `[]` for every source, otherwise the ticked rows or the drilled-into group. Every surface under the same handle has already followed it.
|
|
480
510
|
*/
|
package/checkout.d.cts
CHANGED
|
@@ -115,7 +115,7 @@ export interface CheckoutElementCreateOptions {
|
|
|
115
115
|
*/
|
|
116
116
|
export interface ExpressCheckoutElementProps {
|
|
117
117
|
/**
|
|
118
|
-
* Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device
|
|
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.
|
|
119
119
|
* @default ["apple_pay","google_pay"]
|
|
120
120
|
*/
|
|
121
121
|
wallets?: ("apple_pay" | "google_pay")[];
|
|
@@ -156,7 +156,7 @@ export interface ExpressCheckoutElementHandle {
|
|
|
156
156
|
*/
|
|
157
157
|
export interface ExpressCheckoutElementCreateOptions {
|
|
158
158
|
/**
|
|
159
|
-
* Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device
|
|
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.
|
|
160
160
|
* @default ["apple_pay","google_pay"]
|
|
161
161
|
*/
|
|
162
162
|
wallets?: ("apple_pay" | "google_pay")[];
|
|
@@ -190,7 +190,7 @@ export interface CheckoutHandle {
|
|
|
190
190
|
*/
|
|
191
191
|
create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
|
|
192
192
|
/**
|
|
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 shipping address for physical goods, 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
|
|
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 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.
|
|
194
194
|
* Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
|
|
195
195
|
*/
|
|
196
196
|
create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
|
package/checkout.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ export interface CheckoutElementCreateOptions {
|
|
|
115
115
|
*/
|
|
116
116
|
export interface ExpressCheckoutElementProps {
|
|
117
117
|
/**
|
|
118
|
-
* Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device
|
|
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.
|
|
119
119
|
* @default ["apple_pay","google_pay"]
|
|
120
120
|
*/
|
|
121
121
|
wallets?: ("apple_pay" | "google_pay")[];
|
|
@@ -156,7 +156,7 @@ export interface ExpressCheckoutElementHandle {
|
|
|
156
156
|
*/
|
|
157
157
|
export interface ExpressCheckoutElementCreateOptions {
|
|
158
158
|
/**
|
|
159
|
-
* Which wallets may render — a filter over what the buyer’s device actually offers. The element never shows a wallet the device
|
|
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.
|
|
160
160
|
* @default ["apple_pay","google_pay"]
|
|
161
161
|
*/
|
|
162
162
|
wallets?: ("apple_pay" | "google_pay")[];
|
|
@@ -190,7 +190,7 @@ export interface CheckoutHandle {
|
|
|
190
190
|
*/
|
|
191
191
|
create(name: "checkout", options?: CheckoutElementCreateOptions): CheckoutElementHandle;
|
|
192
192
|
/**
|
|
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 shipping address for physical goods, 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
|
|
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 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.
|
|
194
194
|
* Exclusive slot `entry`. Mount exactly one of: checkout | expressCheckout.
|
|
195
195
|
*/
|
|
196
196
|
create(name: "expressCheckout", options?: ExpressCheckoutElementCreateOptions): ExpressCheckoutElementHandle;
|
package/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FrameworkGlobals, WhopElementsLocale } from "./_framework.js";
|
|
2
2
|
import type { PaymentsHandle, PaymentsOptions, PaymentsStatics } from "./payments.js";
|
|
3
|
+
import type { VerificationsHandle, VerificationsOptions, VerificationsStatics } from "./verifications.js";
|
|
3
4
|
import type { CheckoutHandle, CheckoutOptions, CheckoutStatics } from "./checkout.js";
|
|
4
5
|
import type { AdsHandle, AdsOptions, AdsStatics } from "./ads.js";
|
|
5
6
|
import type { TrackingHandle, TrackingOptions, TrackingStatics } from "./tracking.js";
|
|
@@ -15,6 +16,10 @@ export interface Whop {
|
|
|
15
16
|
* Collect a payment from a `plan_` ID or inline currency and amount. Mount PaymentElement, CardElement, or CardFields, then call `payments.createConfirmationToken` with billing details. Wallet selections open their sheet automatically. Confirm the token server-side, then pass the payment's `client_secret` to `handleNextAction` for any pending step.
|
|
16
17
|
*/
|
|
17
18
|
payments: { create(options: PaymentsOptions): PaymentsHandle } & PaymentsStatics;
|
|
19
|
+
/**
|
|
20
|
+
* Collects and verifies identity information for an account. Mount `kyc` for a complete KYC or KYB flow backed by the Verifications API.
|
|
21
|
+
*/
|
|
22
|
+
verifications: { create(options: VerificationsOptions): VerificationsHandle } & VerificationsStatics;
|
|
18
23
|
/**
|
|
19
24
|
* Drives a full hosted checkout for one plan — price summary, promo codes, the currency the buyer pays in, and the whole payment collection surface (the payments elements, composed inside) — against the Whop checkout sessions API. Mount it with a `plan` (or a `checkoutConfiguration` you authored) and the element opens the checkout session itself; the session credential never leaves the element. The buyer pays inside the element, and a finished checkout redirects the current tab to `returnUrl`, including the page that contains the element. Fulfill from webhooks rather than a browser callback. Without a `returnUrl`, the buyer rests on the element’s own success face. The element automatically drives an off-site payment step, such as 3DS or a bank page. On whop.com, it brings the buyer back into the restored checkout; in an embed, the buyer returns to the same `returnUrl`. A failed payment reopens the same checkout with the reason shown, so the buyer can pay again. Every option is set at creation: the element mints a checkout session from these values when it mounts. Changing one later with `update()` or new React props fails instead of changing the existing order. Mount a new checkout to change the purchase.
|
|
20
25
|
*/
|
|
@@ -24,15 +29,15 @@ export interface Whop {
|
|
|
24
29
|
*/
|
|
25
30
|
ads: { create(options: AdsOptions): AdsHandle } & AdsStatics;
|
|
26
31
|
/**
|
|
27
|
-
* An account's tracked audience: everyone its pixel has seen, and every event they performed. Scope it to an account with `accountId`, then mount `people`, `events`, or both
|
|
32
|
+
* An account's tracked audience: everyone its pixel has seen, and every event they performed. Scope it to an account with `accountId`, then mount `people`, `events`, or both. They read the same window and the same credit rule, so two surfaces side by side can never disagree about what they are showing. `person` is where a click on either of them leads: one person's whole record, mountable inline or presentable over your page. `links` wires their person links to your own pages.
|
|
28
33
|
*/
|
|
29
34
|
tracking: { create(options: TrackingOptions): TrackingHandle } & TrackingStatics;
|
|
30
35
|
/**
|
|
31
|
-
* Drives an account's money surfaces. `deposit` returns live funding rails; `send` moves money to a recipient or creates a public claim link; `withdraw`
|
|
36
|
+
* Drives an account's money surfaces. `required-actions` is the outstanding-action bar from Whop's balance dashboard. `actions` renders the Deposit, Accept, Send, and Convert controls: Deposit, Send, and Convert open their Wallet overlays, while Accept opens Whop's checkout-link creator for a business account or company creation for a personal account. `deposit` returns live funding rails; `convert` swaps USD with Gold or Bitcoin and exposes FX currencies only to gated first-party users; `send` moves money to a recipient or creates a public claim link; `withdraw` lists payout methods and creates the payout when the host does not already drive that API; `balances` holds two faces — the holdings list, and the balance block drawing value over a window; `cards` is the compact issued-card list; `cardsTable` renders the full sortable card roster; `cardsChart` plots card spend; `whopCard` renders one revealable card; `activity` lists ledger movements; `activityDetail` renders a prefetched movement, or retrieves one by activity ID or card transaction ID, in a standalone drawer; and `verification` is the identity-only nudge. Every data-backed surface can use the viewer's session when no token is provided.
|
|
32
37
|
*/
|
|
33
38
|
wallet: { create(options: WalletOptions): WalletHandle } & WalletStatics;
|
|
34
39
|
/**
|
|
35
|
-
* An account's websites: every site built on whop.
|
|
40
|
+
* An account's websites: every site built on whop.site plus every domain the Whop Pixel reports, with traffic and attributed revenue per domain. Mount `websites` and it lists them with visitors, page views, sales, revenue, trend, and most-viewed pages. Mount `pixel-setup` alongside it and a site whose pixel the wizard just proved live gets a waiting row automatically, because its first events take a few minutes to reach the stats API and the site would otherwise look lost — you wire nothing up for that, and the row is kept on your page so it is still there if the merchant reloads. Reading stats is privileged, so it needs an `accessToken` — except inside Whop's own app, where the viewer's session carries the read.
|
|
36
41
|
*/
|
|
37
42
|
websites: { create(options: WebsitesOptions): WebsitesHandle } & WebsitesStatics;
|
|
38
43
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FrameworkGlobals, WhopElementsLocale } from "./_framework.js";
|
|
2
2
|
import type { PaymentsHandle, PaymentsOptions, PaymentsStatics } from "./payments.js";
|
|
3
|
+
import type { VerificationsHandle, VerificationsOptions, VerificationsStatics } from "./verifications.js";
|
|
3
4
|
import type { CheckoutHandle, CheckoutOptions, CheckoutStatics } from "./checkout.js";
|
|
4
5
|
import type { AdsHandle, AdsOptions, AdsStatics } from "./ads.js";
|
|
5
6
|
import type { TrackingHandle, TrackingOptions, TrackingStatics } from "./tracking.js";
|
|
@@ -15,6 +16,10 @@ export interface Whop {
|
|
|
15
16
|
* Collect a payment from a `plan_` ID or inline currency and amount. Mount PaymentElement, CardElement, or CardFields, then call `payments.createConfirmationToken` with billing details. Wallet selections open their sheet automatically. Confirm the token server-side, then pass the payment's `client_secret` to `handleNextAction` for any pending step.
|
|
16
17
|
*/
|
|
17
18
|
payments: { create(options: PaymentsOptions): PaymentsHandle } & PaymentsStatics;
|
|
19
|
+
/**
|
|
20
|
+
* Collects and verifies identity information for an account. Mount `kyc` for a complete KYC or KYB flow backed by the Verifications API.
|
|
21
|
+
*/
|
|
22
|
+
verifications: { create(options: VerificationsOptions): VerificationsHandle } & VerificationsStatics;
|
|
18
23
|
/**
|
|
19
24
|
* Drives a full hosted checkout for one plan — price summary, promo codes, the currency the buyer pays in, and the whole payment collection surface (the payments elements, composed inside) — against the Whop checkout sessions API. Mount it with a `plan` (or a `checkoutConfiguration` you authored) and the element opens the checkout session itself; the session credential never leaves the element. The buyer pays inside the element, and a finished checkout redirects the current tab to `returnUrl`, including the page that contains the element. Fulfill from webhooks rather than a browser callback. Without a `returnUrl`, the buyer rests on the element’s own success face. The element automatically drives an off-site payment step, such as 3DS or a bank page. On whop.com, it brings the buyer back into the restored checkout; in an embed, the buyer returns to the same `returnUrl`. A failed payment reopens the same checkout with the reason shown, so the buyer can pay again. Every option is set at creation: the element mints a checkout session from these values when it mounts. Changing one later with `update()` or new React props fails instead of changing the existing order. Mount a new checkout to change the purchase.
|
|
20
25
|
*/
|
|
@@ -24,15 +29,15 @@ export interface Whop {
|
|
|
24
29
|
*/
|
|
25
30
|
ads: { create(options: AdsOptions): AdsHandle } & AdsStatics;
|
|
26
31
|
/**
|
|
27
|
-
* An account's tracked audience: everyone its pixel has seen, and every event they performed. Scope it to an account with `accountId`, then mount `people`, `events`, or both
|
|
32
|
+
* An account's tracked audience: everyone its pixel has seen, and every event they performed. Scope it to an account with `accountId`, then mount `people`, `events`, or both. They read the same window and the same credit rule, so two surfaces side by side can never disagree about what they are showing. `person` is where a click on either of them leads: one person's whole record, mountable inline or presentable over your page. `links` wires their person links to your own pages.
|
|
28
33
|
*/
|
|
29
34
|
tracking: { create(options: TrackingOptions): TrackingHandle } & TrackingStatics;
|
|
30
35
|
/**
|
|
31
|
-
* Drives an account's money surfaces. `deposit` returns live funding rails; `send` moves money to a recipient or creates a public claim link; `withdraw`
|
|
36
|
+
* Drives an account's money surfaces. `required-actions` is the outstanding-action bar from Whop's balance dashboard. `actions` renders the Deposit, Accept, Send, and Convert controls: Deposit, Send, and Convert open their Wallet overlays, while Accept opens Whop's checkout-link creator for a business account or company creation for a personal account. `deposit` returns live funding rails; `convert` swaps USD with Gold or Bitcoin and exposes FX currencies only to gated first-party users; `send` moves money to a recipient or creates a public claim link; `withdraw` lists payout methods and creates the payout when the host does not already drive that API; `balances` holds two faces — the holdings list, and the balance block drawing value over a window; `cards` is the compact issued-card list; `cardsTable` renders the full sortable card roster; `cardsChart` plots card spend; `whopCard` renders one revealable card; `activity` lists ledger movements; `activityDetail` renders a prefetched movement, or retrieves one by activity ID or card transaction ID, in a standalone drawer; and `verification` is the identity-only nudge. Every data-backed surface can use the viewer's session when no token is provided.
|
|
32
37
|
*/
|
|
33
38
|
wallet: { create(options: WalletOptions): WalletHandle } & WalletStatics;
|
|
34
39
|
/**
|
|
35
|
-
* An account's websites: every site built on whop.
|
|
40
|
+
* An account's websites: every site built on whop.site plus every domain the Whop Pixel reports, with traffic and attributed revenue per domain. Mount `websites` and it lists them with visitors, page views, sales, revenue, trend, and most-viewed pages. Mount `pixel-setup` alongside it and a site whose pixel the wizard just proved live gets a waiting row automatically, because its first events take a few minutes to reach the stats API and the site would otherwise look lost — you wire nothing up for that, and the row is kept on your page so it is still there if the merchant reloads. Reading stats is privileged, so it needs an `accessToken` — except inside Whop's own app, where the viewer's session carries the read.
|
|
36
41
|
*/
|
|
37
42
|
websites: { create(options: WebsitesOptions): WebsitesHandle } & WebsitesStatics;
|
|
38
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whop/elements",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "Whop Elements — vanilla-js loader + types. Loads the hosted SDK and exposes the typed WhopElements factory.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"checkout",
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"types": "./payments.d.cts"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
+
"./verifications": {
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./verifications.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./verifications.d.cts"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
43
51
|
"./checkout": {
|
|
44
52
|
"import": {
|
|
45
53
|
"types": "./checkout.d.ts"
|
|
@@ -81,5 +89,5 @@
|
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
},
|
|
84
|
-
"whopElementsApiHash": "
|
|
92
|
+
"whopElementsApiHash": "aa5a847faaed38909df8586be24e560636b7a252df483fea1a4f981631d2d400"
|
|
85
93
|
}
|
package/payments.d.cts
CHANGED
|
@@ -166,7 +166,7 @@ export interface PaymentElementProps {
|
|
|
166
166
|
*/
|
|
167
167
|
order?: string[];
|
|
168
168
|
/**
|
|
169
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
169
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
170
170
|
* @default {"billingDetails":"minimal"}
|
|
171
171
|
*/
|
|
172
172
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -226,7 +226,7 @@ export interface PaymentElementCreateOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
order?: string[];
|
|
228
228
|
/**
|
|
229
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
229
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
230
230
|
* @default {"billingDetails":"minimal"}
|
|
231
231
|
*/
|
|
232
232
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -490,9 +490,9 @@ export interface CardElementCreateOptions {
|
|
|
490
490
|
*/
|
|
491
491
|
layout?: "compact" | "stacked";
|
|
492
492
|
/**
|
|
493
|
-
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network.
|
|
493
|
+
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
494
494
|
*/
|
|
495
|
-
onChange?: ((payload: { complete: boolean; brand: string; }) => void);
|
|
495
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
496
496
|
/**
|
|
497
497
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
498
498
|
*/
|
|
@@ -602,7 +602,7 @@ export interface TaxIdElementProps {
|
|
|
602
602
|
*/
|
|
603
603
|
disabled?: boolean;
|
|
604
604
|
/**
|
|
605
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
605
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
606
606
|
* @default ""
|
|
607
607
|
*/
|
|
608
608
|
country?: string;
|
|
@@ -652,7 +652,7 @@ export interface TaxIdElementCreateOptions {
|
|
|
652
652
|
*/
|
|
653
653
|
disabled?: boolean;
|
|
654
654
|
/**
|
|
655
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
655
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
656
656
|
* @default ""
|
|
657
657
|
*/
|
|
658
658
|
country?: string;
|
|
@@ -751,9 +751,9 @@ export interface CardFieldsSubOptions {
|
|
|
751
751
|
*/
|
|
752
752
|
networks?: CardNetworkArt[];
|
|
753
753
|
/**
|
|
754
|
-
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network.
|
|
754
|
+
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
755
755
|
*/
|
|
756
|
-
onChange?: ((payload: { complete: boolean; brand: string; }) => void);
|
|
756
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
/**
|
|
@@ -975,7 +975,7 @@ export interface PaymentRequestResourceOptions {
|
|
|
975
975
|
*/
|
|
976
976
|
export interface PaymentRequestResource {
|
|
977
977
|
/**
|
|
978
|
-
* 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 its domain registered as a payment method domain). 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 — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
978
|
+
* 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 its domain registered and verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain)). 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 — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
979
979
|
*/
|
|
980
980
|
canMakePayment: () => Promise<WalletAvailability>;
|
|
981
981
|
/**
|
|
@@ -1041,7 +1041,7 @@ export interface PaymentsHandle {
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
create(name: "taxId", options?: TaxIdElementCreateOptions): TaxIdElementHandle;
|
|
1043
1043
|
/**
|
|
1044
|
-
* Whop's merchant-of-record notice: the Whop wordmark with links to the buyer terms and privacy policy.
|
|
1044
|
+
* Whop's merchant-of-record notice: the Whop wordmark with links to the buyer terms and privacy policy. Mount it alongside every payment collection surface.
|
|
1045
1045
|
*/
|
|
1046
1046
|
create(name: "branding", options?: BrandingElementCreateOptions): BrandingElementHandle;
|
|
1047
1047
|
/**
|
|
@@ -1070,7 +1070,7 @@ export interface PaymentsHandle {
|
|
|
1070
1070
|
*/
|
|
1071
1071
|
export interface PaymentsStatics {
|
|
1072
1072
|
/**
|
|
1073
|
-
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL.
|
|
1073
|
+
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL. Inside an iframe they navigate the top-level tab. If the embedding page refuses that navigation, they reject with code `TAB_NAVIGATION_BLOCKED`, and the payment stays pending. Set `returnUrl` to update the destination before presentation. An update failure rejects before any step runs. Inline steps never navigate to that URL. A payment with no pending step resolves immediately.
|
|
1074
1074
|
*/
|
|
1075
1075
|
handleNextAction: (input: { clientSecret: string; returnUrl?: string | undefined; pollIntervalMs?: number | undefined; }) => Promise<{ status: string; redirected: boolean; lastPaymentError: { code?: string | null | undefined; decline_code?: string | null | undefined; message?: string | null | undefined; } | null; }>;
|
|
1076
1076
|
/**
|
package/payments.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface PaymentElementProps {
|
|
|
166
166
|
*/
|
|
167
167
|
order?: string[];
|
|
168
168
|
/**
|
|
169
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
169
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
170
170
|
* @default {"billingDetails":"minimal"}
|
|
171
171
|
*/
|
|
172
172
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -226,7 +226,7 @@ export interface PaymentElementCreateOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
order?: string[];
|
|
228
228
|
/**
|
|
229
|
-
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. It locks when only one is available.
|
|
229
|
+
* Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available.
|
|
230
230
|
* @default {"billingDetails":"minimal"}
|
|
231
231
|
*/
|
|
232
232
|
fields?: { billingDetails?: "full" | "minimal" | "never" | undefined; };
|
|
@@ -490,9 +490,9 @@ export interface CardElementCreateOptions {
|
|
|
490
490
|
*/
|
|
491
491
|
layout?: "compact" | "stacked";
|
|
492
492
|
/**
|
|
493
|
-
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network.
|
|
493
|
+
* Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
494
494
|
*/
|
|
495
|
-
onChange?: ((payload: { complete: boolean; brand: string; }) => void);
|
|
495
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
496
496
|
/**
|
|
497
497
|
* Runs after the loading skeleton first paints and before `onReady`.
|
|
498
498
|
*/
|
|
@@ -602,7 +602,7 @@ export interface TaxIdElementProps {
|
|
|
602
602
|
*/
|
|
603
603
|
disabled?: boolean;
|
|
604
604
|
/**
|
|
605
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
605
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
606
606
|
* @default ""
|
|
607
607
|
*/
|
|
608
608
|
country?: string;
|
|
@@ -652,7 +652,7 @@ export interface TaxIdElementCreateOptions {
|
|
|
652
652
|
*/
|
|
653
653
|
disabled?: boolean;
|
|
654
654
|
/**
|
|
655
|
-
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`. EU and unmapped or empty values select `eu_vat`. Other
|
|
655
|
+
* ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes.
|
|
656
656
|
* @default ""
|
|
657
657
|
*/
|
|
658
658
|
country?: string;
|
|
@@ -751,9 +751,9 @@ export interface CardFieldsSubOptions {
|
|
|
751
751
|
*/
|
|
752
752
|
networks?: CardNetworkArt[];
|
|
753
753
|
/**
|
|
754
|
-
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network.
|
|
754
|
+
* Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.
|
|
755
755
|
*/
|
|
756
|
-
onChange?: ((payload: { complete: boolean; brand: string; }) => void);
|
|
756
|
+
onChange?: ((payload: { complete: boolean; brand: string; funding: string | null; issuingCountry: string | null; }) => void);
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
/**
|
|
@@ -975,7 +975,7 @@ export interface PaymentRequestResourceOptions {
|
|
|
975
975
|
*/
|
|
976
976
|
export interface PaymentRequestResource {
|
|
977
977
|
/**
|
|
978
|
-
* 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 its domain registered as a payment method domain). 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 — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
978
|
+
* 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 its domain registered and verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain)). 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 — so express buttons can stack best-first. This primes `show()`. Always await it first.
|
|
979
979
|
*/
|
|
980
980
|
canMakePayment: () => Promise<WalletAvailability>;
|
|
981
981
|
/**
|
|
@@ -1041,7 +1041,7 @@ export interface PaymentsHandle {
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
create(name: "taxId", options?: TaxIdElementCreateOptions): TaxIdElementHandle;
|
|
1043
1043
|
/**
|
|
1044
|
-
* Whop's merchant-of-record notice: the Whop wordmark with links to the buyer terms and privacy policy.
|
|
1044
|
+
* Whop's merchant-of-record notice: the Whop wordmark with links to the buyer terms and privacy policy. Mount it alongside every payment collection surface.
|
|
1045
1045
|
*/
|
|
1046
1046
|
create(name: "branding", options?: BrandingElementCreateOptions): BrandingElementHandle;
|
|
1047
1047
|
/**
|
|
@@ -1070,7 +1070,7 @@ export interface PaymentsHandle {
|
|
|
1070
1070
|
*/
|
|
1071
1071
|
export interface PaymentsStatics {
|
|
1072
1072
|
/**
|
|
1073
|
-
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL.
|
|
1073
|
+
* Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dismissing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL. Inside an iframe they navigate the top-level tab. If the embedding page refuses that navigation, they reject with code `TAB_NAVIGATION_BLOCKED`, and the payment stays pending. Set `returnUrl` to update the destination before presentation. An update failure rejects before any step runs. Inline steps never navigate to that URL. A payment with no pending step resolves immediately.
|
|
1074
1074
|
*/
|
|
1075
1075
|
handleNextAction: (input: { clientSecret: string; returnUrl?: string | undefined; pollIntervalMs?: number | undefined; }) => Promise<{ status: string; redirected: boolean; lastPaymentError: { code?: string | null | undefined; decline_code?: string | null | undefined; message?: string | null | undefined; } | null; }>;
|
|
1076
1076
|
/**
|