stripe-pwa-elements 4.0.0 → 4.0.2

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.
Files changed (108) hide show
  1. package/dist/cjs/factory-tenFFIul.js +1200 -0
  2. package/dist/cjs/{factory-da3xAKkz.js → i18n-FhEOc8vz.js} +6 -1131
  3. package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/stripe-address-element.cjs.entry.js +12 -4
  6. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
  7. package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +15 -82
  8. package/dist/cjs/stripe-currency-selector.cjs.entry.js +11 -3
  9. package/dist/cjs/stripe-elements.cjs.js +1 -1
  10. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +31 -5
  11. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +11 -3
  12. package/dist/cjs/stripe-payment-element.cjs.entry.js +106 -161
  13. package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
  14. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +23 -16
  15. package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
  16. package/dist/collection/collection-manifest.json +3 -2
  17. package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
  18. package/dist/collection/components/stripe-card-element/stripe-card-element.js +10 -2
  19. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
  20. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
  21. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +25 -0
  22. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
  23. package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
  24. package/dist/collection/components/stripe-modal/stripe-modal.js +147 -6
  25. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
  26. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +17 -10
  27. package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
  28. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
  29. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
  30. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
  31. package/dist/collection/services/express-checkout-element-manager.js +36 -2
  32. package/dist/collection/services/stripe-service.js +37 -5
  33. package/dist/collection/utils/focus.js +76 -0
  34. package/dist/collection/utils/i18n.js +6 -0
  35. package/dist/components/factory.js +1 -1
  36. package/dist/components/i18n.js +1 -0
  37. package/dist/components/stripe-address-element.js +1 -1
  38. package/dist/components/stripe-card-element-modal.js +1 -1
  39. package/dist/components/stripe-card-element2.js +1 -1
  40. package/dist/components/stripe-currency-selector.js +1 -1
  41. package/dist/components/stripe-express-checkout-element.js +1 -1
  42. package/dist/components/stripe-link-authentication-element.js +1 -1
  43. package/dist/components/stripe-modal2.js +1 -1
  44. package/dist/components/stripe-payment-element.helpers.js +1 -0
  45. package/dist/components/stripe-payment-element.js +1 -1
  46. package/dist/components/stripe-payment-request-button2.js +1 -1
  47. package/dist/components/stripe-payment-sheet.d.ts +11 -0
  48. package/dist/components/stripe-payment-sheet.js +1 -0
  49. package/dist/esm/factory-Cd6OGTWN.js +1198 -0
  50. package/dist/esm/{factory-DeqoYLf_.js → i18n-B6JoQetF.js} +7 -1131
  51. package/dist/esm/ion-icon_2.entry.js +720 -0
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/esm/stripe-address-element.entry.js +9 -1
  54. package/dist/esm/stripe-card-element-modal.entry.js +3 -2
  55. package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +13 -79
  56. package/dist/esm/stripe-currency-selector.entry.js +9 -1
  57. package/dist/esm/stripe-elements.js +1 -1
  58. package/dist/esm/stripe-express-checkout-element.entry.js +27 -1
  59. package/dist/esm/stripe-link-authentication-element.entry.js +9 -1
  60. package/dist/esm/stripe-payment-element.entry.js +98 -153
  61. package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
  62. package/dist/esm/stripe-payment-request-button.entry.js +18 -11
  63. package/dist/esm/stripe-payment-sheet.entry.js +504 -0
  64. package/dist/stripe-elements/{p-38e7b187.entry.js → p-4891edf0.entry.js} +1 -1
  65. package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
  66. package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
  67. package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
  68. package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
  69. package/dist/stripe-elements/p-B6JoQetF.js +1 -0
  70. package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
  71. package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
  72. package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
  73. package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
  74. package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
  75. package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
  76. package/dist/stripe-elements/p-f892e375.entry.js +1 -0
  77. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  78. package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
  79. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +8 -1
  80. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
  81. package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
  82. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +11 -0
  83. package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
  84. package/dist/types/components/stripe-modal/stripe-modal.d.ts +44 -0
  85. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
  86. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +7 -2
  87. package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
  88. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
  89. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
  90. package/dist/types/components.d.ts +169 -10
  91. package/dist/types/index.d.ts +2 -0
  92. package/dist/types/services/interfaces.d.ts +2 -0
  93. package/dist/types/services/stripe-service.d.ts +12 -3
  94. package/dist/types/utils/focus.d.ts +15 -0
  95. package/package.json +5 -3
  96. package/readme.md +46 -10
  97. package/dist/cjs/ion-icon.cjs.entry.js +0 -431
  98. package/dist/components/utils.js +0 -1
  99. package/dist/esm/ion-icon.entry.js +0 -429
  100. package/dist/stripe-elements/p--sA2m1ad.js +0 -1
  101. package/dist/stripe-elements/p-44495284.entry.js +0 -1
  102. package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
  103. package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
  104. package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
  105. package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
  106. package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
  107. package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
  108. package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
@@ -0,0 +1,104 @@
1
+ /**
2
+ * State machine behind `<stripe-payment-sheet>`.
3
+ *
4
+ * Pure functions only: the component feeds events in and performs the returned effects
5
+ * (loading Stripe.js, showing the modal, confirming, emitting events, resolving `present()`).
6
+ * The same rules are model-checked in Quint; see the exhaustive test next to this file.
7
+ */
8
+ /**
9
+ * Kind of intent a client secret belongs to
10
+ */
11
+ export type IntentKind = 'payment' | 'setup';
12
+ /**
13
+ * Lifecycle phase of the sheet
14
+ */
15
+ export type SheetPhase = 'idle' | 'loading' | 'ready' | 'loadFailed' | 'presented' | 'confirming' | 'completed' | 'errored';
16
+ /**
17
+ * DOM events emitted by the sheet (same names as Capacitor's PaymentSheetEventsEnum)
18
+ */
19
+ export type PaymentSheetEventName = 'paymentSheetLoaded' | 'paymentSheetFailedToLoad' | 'paymentSheetCompleted' | 'paymentSheetCanceled' | 'paymentSheetFailed';
20
+ /**
21
+ * Result of `present()` (same values as Capacitor's PaymentSheetResultInterface)
22
+ */
23
+ export type PaymentSheetResult = 'paymentSheetCompleted' | 'paymentSheetCanceled' | 'paymentSheetFailed';
24
+ export type SheetState = Readonly<{
25
+ phase: SheetPhase;
26
+ /** Incremented on every accepted secret change so that results of older loads and confirmations are ignored */
27
+ generation: number;
28
+ intentKind?: IntentKind;
29
+ /** Whether a `present()` promise is waiting for a result (at most one) */
30
+ pendingPresent: boolean;
31
+ /** Whether the sheet should open as soon as loading finishes */
32
+ openRequested: boolean;
33
+ /** Secret received while confirming; applied once the confirmation finishes */
34
+ deferredClientSecret?: string;
35
+ }>;
36
+ export type SheetEvent = {
37
+ type: 'secretChanged';
38
+ clientSecret: string;
39
+ } | {
40
+ type: 'loadSucceeded';
41
+ generation: number;
42
+ } | {
43
+ type: 'loadFailed';
44
+ generation: number;
45
+ } | {
46
+ type: 'presentRequested';
47
+ } | {
48
+ type: 'openRequested';
49
+ } | {
50
+ type: 'closeRequested';
51
+ } | {
52
+ type: 'submitted';
53
+ } | {
54
+ type: 'confirmSucceeded';
55
+ generation: number;
56
+ } | {
57
+ type: 'confirmDeclined';
58
+ generation: number;
59
+ message: string;
60
+ } | {
61
+ type: 'confirmFailed';
62
+ generation: number;
63
+ message: string;
64
+ };
65
+ export type SheetEffect = {
66
+ type: 'load';
67
+ generation: number;
68
+ clientSecret: string;
69
+ intentKind: IntentKind;
70
+ } | {
71
+ type: 'show';
72
+ } | {
73
+ type: 'hide';
74
+ } | {
75
+ type: 'confirm';
76
+ generation: number;
77
+ intentKind: IntentKind;
78
+ } | {
79
+ type: 'showError';
80
+ message: string;
81
+ } | {
82
+ type: 'emit';
83
+ event: PaymentSheetEventName;
84
+ } | {
85
+ type: 'resolvePresent';
86
+ result: PaymentSheetResult;
87
+ };
88
+ export type Transition = {
89
+ state: SheetState;
90
+ effects: SheetEffect[];
91
+ };
92
+ export declare const initialSheetState: SheetState;
93
+ /**
94
+ * Tell whether a client secret belongs to a PaymentIntent or a SetupIntent from its prefix.
95
+ * @param clientSecret - The `client_secret` of a PaymentIntent (`pi_..._secret_...`) or SetupIntent (`seti_..._secret_...`)
96
+ * @returns The intent kind, or undefined when the format is not recognized
97
+ */
98
+ export declare const intentKindFromClientSecret: (clientSecret: string) => IntentKind | undefined;
99
+ /**
100
+ * Compute the next state and the effects to perform for an event.
101
+ * @param state - Current state
102
+ * @param event - Event to handle
103
+ */
104
+ export declare const transition: (state: SheetState, event: SheetEvent) => Transition;
@@ -0,0 +1,112 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import type { PaymentIntentResult, SetupIntentResult } from '@stripe/stripe-js';
3
+ import type { StripeLoadedEvent } from '../../interfaces';
4
+ import type { SheetState } from './payment-sheet-state';
5
+ import type { PaymentSheetOptions, PaymentSheetPresentResult } from './stripe-payment-sheet.helpers';
6
+ /**
7
+ * A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
8
+ * of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix.
9
+ */
10
+ export declare class StripePaymentSheet {
11
+ el: HTMLStripePaymentSheetElement;
12
+ private stripeService;
13
+ private paymentElementManager;
14
+ /** Pending `present()` promise; at most one */
15
+ private presentPromise?;
16
+ private resolvePresent?;
17
+ /** Details for the next emitted event */
18
+ private lastError?;
19
+ private lastResult?;
20
+ private warnedUnsupportedOptions;
21
+ /**
22
+ * Your Stripe publishable API key.
23
+ */
24
+ readonly publishableKey?: string;
25
+ /**
26
+ * The client secret of a PaymentIntent (`pi_..._secret_...`) or a SetupIntent (`seti_..._secret_...`).
27
+ * The prefix decides whether `confirmPayment` or `confirmSetup` is used.
28
+ */
29
+ readonly intentClientSecret?: string;
30
+ /**
31
+ * Optional. Making API calls for connected accounts
32
+ * @info https://stripe.com/docs/connect/authentication
33
+ */
34
+ readonly stripeAccount?: string;
35
+ /**
36
+ * Whether the sheet is shown. Setting it to false closes the sheet as canceled.
37
+ */
38
+ open: boolean;
39
+ /**
40
+ * Sheet title. Translated automatically by this library.
41
+ */
42
+ readonly sheetTitle: string;
43
+ /**
44
+ * Submit button label. Translated automatically by this library.
45
+ */
46
+ readonly buttonLabel: string;
47
+ /**
48
+ * Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
49
+ */
50
+ readonly applicationName: string;
51
+ /**
52
+ * Options with the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`. JavaScript property only.
53
+ */
54
+ readonly options?: PaymentSheetOptions;
55
+ sheet: SheetState;
56
+ visible: boolean;
57
+ errorMessage: string;
58
+ /**
59
+ * Stripe.js and the Payment Element are ready
60
+ */
61
+ paymentSheetLoaded: EventEmitter<StripeLoadedEvent>;
62
+ /**
63
+ * Stripe.js or the Payment Element failed to load, or the client secret format is unknown
64
+ */
65
+ paymentSheetFailedToLoad: EventEmitter<unknown>;
66
+ /**
67
+ * The payment or setup succeeded
68
+ */
69
+ paymentSheetCompleted: EventEmitter<PaymentIntentResult | SetupIntentResult>;
70
+ /**
71
+ * The customer closed the sheet
72
+ */
73
+ paymentSheetCanceled: EventEmitter<void>;
74
+ /**
75
+ * The confirmation failed with an error the customer cannot fix in the sheet
76
+ */
77
+ paymentSheetFailed: EventEmitter<unknown>;
78
+ /**
79
+ * Show the sheet and wait for its result.
80
+ * Calling it again while a result is pending returns the same promise.
81
+ * @returns `{ paymentResult }`, where `paymentResult` is `paymentSheetCompleted`, `paymentSheetCanceled` or `paymentSheetFailed`
82
+ * @example
83
+ * ```
84
+ * const sheet = document.querySelector('stripe-payment-sheet');
85
+ * const { paymentResult } = await sheet.present();
86
+ * ```
87
+ */
88
+ present(): Promise<PaymentSheetPresentResult>;
89
+ handleSecretChange(): void;
90
+ handleOpenChange(open: boolean): void;
91
+ constructor();
92
+ /**
93
+ * Props are not yet populated inside the constructor with the custom-elements build,
94
+ * so loading starts here.
95
+ */
96
+ componentWillLoad(): void;
97
+ componentDidLoad(): void;
98
+ disconnectedCallback(): void;
99
+ private startLoading;
100
+ private dispatch;
101
+ private perform;
102
+ private load;
103
+ private confirm;
104
+ private emit;
105
+ private warnUnsupportedOptions;
106
+ private handleSubmit;
107
+ /**
108
+ * The modal closes itself on a backdrop or close button click. Keep it open when the sheet refuses to close (while confirming).
109
+ */
110
+ private handleModalClose;
111
+ render(): any;
112
+ }
@@ -0,0 +1,95 @@
1
+ import type { Appearance, StripePaymentElementOptions } from '@stripe/stripe-js';
2
+ import type { PaymentSheetResult } from './payment-sheet-state';
3
+ /**
4
+ * Value returned by `present()` (same shape as `presentPaymentSheet()` of `@capacitor-community/stripe`)
5
+ */
6
+ export type PaymentSheetPresentResult = {
7
+ paymentResult: PaymentSheetResult;
8
+ };
9
+ /**
10
+ * Address in the shape of `@capacitor-community/stripe`
11
+ */
12
+ export type PaymentSheetAddress = {
13
+ country?: string;
14
+ city?: string;
15
+ line1?: string;
16
+ line2?: string;
17
+ postalCode?: string;
18
+ state?: string;
19
+ };
20
+ /**
21
+ * Options of `<stripe-payment-sheet>`, using the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`
22
+ * (without the client secrets, which are passed as the `intent-client-secret` attribute).
23
+ * Options marked "no effect on the web" are accepted so that the same object can be passed through, and are reported once with `console.warn`.
24
+ */
25
+ export type PaymentSheetOptions = {
26
+ /** Shown as the business name in the Payment Element */
27
+ merchantDisplayName?: string;
28
+ /** `horizontal` = tabs, `vertical` = accordion, `automatic` = auto */
29
+ paymentMethodLayout?: 'horizontal' | 'vertical' | 'automatic';
30
+ /** Prefilled billing details */
31
+ defaultBillingDetails?: {
32
+ email?: string;
33
+ name?: string;
34
+ phone?: string;
35
+ address?: PaymentSheetAddress;
36
+ };
37
+ /** Where Stripe redirects after a redirect-based payment method. Defaults to the current page */
38
+ returnURL?: string;
39
+ /** `alwaysLight` = Stripe theme, `alwaysDark` = Night theme */
40
+ style?: 'alwaysLight' | 'alwaysDark';
41
+ /** Not supported yet on the web */
42
+ billingDetailsCollectionConfiguration?: {
43
+ email?: 'automatic' | 'always' | 'never';
44
+ name?: 'automatic' | 'always' | 'never';
45
+ phone?: 'automatic' | 'always' | 'never';
46
+ address?: 'automatic' | 'full' | 'never';
47
+ };
48
+ /** Not supported yet on the web */
49
+ shippingDetails?: {
50
+ name?: string;
51
+ phone?: string;
52
+ address?: PaymentSheetAddress;
53
+ };
54
+ /** Not supported yet on the web */
55
+ enableApplePay?: boolean;
56
+ /** Not supported yet on the web */
57
+ enableGooglePay?: boolean;
58
+ /** No effect on the web (the web uses CustomerSession instead) */
59
+ customerId?: string;
60
+ /** No effect on the web (the web uses CustomerSession instead) */
61
+ customerEphemeralKeySecret?: string;
62
+ /** No effect on the web */
63
+ applePayMerchantId?: string;
64
+ /** No effect on the web */
65
+ GooglePayIsTesting?: boolean;
66
+ /** No effect on the web */
67
+ countryCode?: string;
68
+ /** No effect on the web */
69
+ currencyCode?: string;
70
+ /** No effect on the web */
71
+ withZipCode?: boolean;
72
+ /** No effect on the web */
73
+ allowsDelayedPaymentMethods?: boolean;
74
+ };
75
+ /**
76
+ * Build the Payment Element options from the payment sheet options.
77
+ * @param options - Payment sheet options
78
+ */
79
+ export declare const toPaymentElementOptions: (options: PaymentSheetOptions | undefined) => StripePaymentElementOptions;
80
+ /**
81
+ * Build the Elements appearance from the payment sheet style.
82
+ * @param style - `alwaysLight` or `alwaysDark`
83
+ */
84
+ export declare const toAppearance: (style: PaymentSheetOptions["style"]) => Appearance | undefined;
85
+ /**
86
+ * List the given options that have no effect on the web (yet), sorted by name.
87
+ * @param options - Payment sheet options
88
+ */
89
+ export declare const unsupportedOptionKeys: (options: PaymentSheetOptions | undefined) => string[];
90
+ /**
91
+ * Tell whether a confirmation error lets the customer try again in the open sheet.
92
+ * Other errors (for example `invalid_request_error` for an intent that already succeeded) end the sheet with `paymentSheetFailed`.
93
+ * @param error - Error thrown while confirming
94
+ */
95
+ export declare const isRecoverableConfirmError: (error: unknown) => boolean;
@@ -7,14 +7,16 @@
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  import { AddressSubmitEvent, AddressSubmitHandler } from "./components/stripe-address-element/stripe-address-element";
9
9
  import { CurrencySelectorChangeEvent, CurrencySelectorChangeHandler, DefaultFormSubmitResult, FormSubmitEvent, FormSubmitHandler, InitStripeOptions, IntentType, LinkAuthenticationElementChangeEvent, LinkAuthenticationElementChangeHandler, PaymentRequestButtonOption, PaymentRequestPaymentMethodEventHandler, PaymentRequestShippingAddressEventHandler, PaymentRequestShippingOptionEventHandler, ProgressStatus, StripeDidLoadedHandler, StripeLoadedEvent } from "./interfaces";
10
- import { PaymentRequestOptions, PaymentRequestWallet, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent } from "@stripe/stripe-js";
10
+ import { PaymentIntentResult, PaymentRequestOptions, PaymentRequestWallet, SetupIntentResult, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent } from "@stripe/stripe-js";
11
11
  import { ExpressCheckoutElementOptions } from "./services/interfaces";
12
12
  import { CheckoutSessionFormSubmitResult, InitCheckoutSessionOptions, PaymentElementSubmitEvent, PaymentElementSubmitHandler } from "./components/stripe-payment-element/stripe-payment-element";
13
+ import { PaymentSheetOptions, PaymentSheetPresentResult } from "./components/stripe-payment-sheet/stripe-payment-sheet.helpers";
13
14
  export { AddressSubmitEvent, AddressSubmitHandler } from "./components/stripe-address-element/stripe-address-element";
14
15
  export { CurrencySelectorChangeEvent, CurrencySelectorChangeHandler, DefaultFormSubmitResult, FormSubmitEvent, FormSubmitHandler, InitStripeOptions, IntentType, LinkAuthenticationElementChangeEvent, LinkAuthenticationElementChangeHandler, PaymentRequestButtonOption, PaymentRequestPaymentMethodEventHandler, PaymentRequestShippingAddressEventHandler, PaymentRequestShippingOptionEventHandler, ProgressStatus, StripeDidLoadedHandler, StripeLoadedEvent } from "./interfaces";
15
- export { PaymentRequestOptions, PaymentRequestWallet, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent } from "@stripe/stripe-js";
16
+ export { PaymentIntentResult, PaymentRequestOptions, PaymentRequestWallet, SetupIntentResult, StripeExpressCheckoutElementClickEvent, StripeExpressCheckoutElementConfirmEvent } from "@stripe/stripe-js";
16
17
  export { ExpressCheckoutElementOptions } from "./services/interfaces";
17
18
  export { CheckoutSessionFormSubmitResult, InitCheckoutSessionOptions, PaymentElementSubmitEvent, PaymentElementSubmitHandler } from "./components/stripe-payment-element/stripe-payment-element";
19
+ export { PaymentSheetOptions, PaymentSheetPresentResult } from "./components/stripe-payment-sheet/stripe-payment-sheet.helpers";
18
20
  export namespace Components {
19
21
  interface StripeAddressElement {
20
22
  /**
@@ -150,7 +152,7 @@ export namespace Components {
150
152
  */
151
153
  "sheetTitle": string;
152
154
  /**
153
- * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
155
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`, `stripe.confirmCardSetup` when it is `'setup'`. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
154
156
  * @default true
155
157
  */
156
158
  "shouldUseDefaultFormSubmitAction": boolean;
@@ -240,7 +242,7 @@ export namespace Components {
240
242
  */
241
243
  "sheetTitle": string;
242
244
  /**
243
- * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
245
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`, `stripe.confirmCardSetup` when it is `'setup'`. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
244
246
  * @default true
245
247
  */
246
248
  "shouldUseDefaultFormSubmitAction": boolean;
@@ -581,7 +583,7 @@ export namespace Components {
581
583
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
582
584
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
583
585
  * and more via the modern Express Checkout Element API.
584
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
586
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
585
587
  */
586
588
  interface StripePaymentRequestButton {
587
589
  /**
@@ -645,6 +647,55 @@ export namespace Components {
645
647
  */
646
648
  "stripeDidLoaded"?: StripeDidLoadedHandler;
647
649
  }
650
+ /**
651
+ * A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
652
+ * of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix.
653
+ */
654
+ interface StripePaymentSheet {
655
+ /**
656
+ * Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
657
+ * @default 'stripe-pwa-elements'
658
+ */
659
+ "applicationName": string;
660
+ /**
661
+ * Submit button label. Translated automatically by this library.
662
+ * @default 'Pay'
663
+ */
664
+ "buttonLabel": string;
665
+ /**
666
+ * The client secret of a PaymentIntent (`pi_..._secret_...`) or a SetupIntent (`seti_..._secret_...`). The prefix decides whether `confirmPayment` or `confirmSetup` is used.
667
+ */
668
+ "intentClientSecret"?: string;
669
+ /**
670
+ * Whether the sheet is shown. Setting it to false closes the sheet as canceled.
671
+ * @default false
672
+ */
673
+ "open": boolean;
674
+ /**
675
+ * Options with the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`. JavaScript property only.
676
+ */
677
+ "options"?: PaymentSheetOptions;
678
+ /**
679
+ * Show the sheet and wait for its result. Calling it again while a result is pending returns the same promise.
680
+ * @returns `{ paymentResult }`, where `paymentResult` is `paymentSheetCompleted`, `paymentSheetCanceled` or `paymentSheetFailed`
681
+ * @example ``` const sheet = document.querySelector('stripe-payment-sheet'); const { paymentResult } = await sheet.present(); ```
682
+ */
683
+ "present": () => Promise<PaymentSheetPresentResult>;
684
+ /**
685
+ * Your Stripe publishable API key.
686
+ */
687
+ "publishableKey"?: string;
688
+ /**
689
+ * Sheet title. Translated automatically by this library.
690
+ * @default 'Add your payment information'
691
+ */
692
+ "sheetTitle": string;
693
+ /**
694
+ * Optional. Making API calls for connected accounts
695
+ * @info https://stripe.com/docs/connect/authentication
696
+ */
697
+ "stripeAccount"?: string;
698
+ }
648
699
  }
649
700
  export interface StripeAddressElementCustomEvent<T> extends CustomEvent<T> {
650
701
  detail: T;
@@ -682,6 +733,10 @@ export interface StripePaymentRequestButtonCustomEvent<T> extends CustomEvent<T>
682
733
  detail: T;
683
734
  target: HTMLStripePaymentRequestButtonElement;
684
735
  }
736
+ export interface StripePaymentSheetCustomEvent<T> extends CustomEvent<T> {
737
+ detail: T;
738
+ target: HTMLStripePaymentSheetElement;
739
+ }
685
740
  declare global {
686
741
  interface HTMLStripeAddressElementElementEventMap {
687
742
  "stripeLoaded": StripeLoadedEvent;
@@ -856,7 +911,7 @@ declare global {
856
911
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
857
912
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
858
913
  * and more via the modern Express Checkout Element API.
859
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
914
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
860
915
  */
861
916
  interface HTMLStripePaymentRequestButtonElement extends Components.StripePaymentRequestButton, HTMLStencilElement {
862
917
  addEventListener<K extends keyof HTMLStripePaymentRequestButtonElementEventMap>(type: K, listener: (this: HTMLStripePaymentRequestButtonElement, ev: StripePaymentRequestButtonCustomEvent<HTMLStripePaymentRequestButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -872,6 +927,31 @@ declare global {
872
927
  prototype: HTMLStripePaymentRequestButtonElement;
873
928
  new (): HTMLStripePaymentRequestButtonElement;
874
929
  };
930
+ interface HTMLStripePaymentSheetElementEventMap {
931
+ "paymentSheetLoaded": StripeLoadedEvent;
932
+ "paymentSheetFailedToLoad": unknown;
933
+ "paymentSheetCompleted": PaymentIntentResult | SetupIntentResult;
934
+ "paymentSheetCanceled": void;
935
+ "paymentSheetFailed": unknown;
936
+ }
937
+ /**
938
+ * A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
939
+ * of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix.
940
+ */
941
+ interface HTMLStripePaymentSheetElement extends Components.StripePaymentSheet, HTMLStencilElement {
942
+ addEventListener<K extends keyof HTMLStripePaymentSheetElementEventMap>(type: K, listener: (this: HTMLStripePaymentSheetElement, ev: StripePaymentSheetCustomEvent<HTMLStripePaymentSheetElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
943
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
944
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
945
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
946
+ removeEventListener<K extends keyof HTMLStripePaymentSheetElementEventMap>(type: K, listener: (this: HTMLStripePaymentSheetElement, ev: StripePaymentSheetCustomEvent<HTMLStripePaymentSheetElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
947
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
948
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
949
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
950
+ }
951
+ var HTMLStripePaymentSheetElement: {
952
+ prototype: HTMLStripePaymentSheetElement;
953
+ new (): HTMLStripePaymentSheetElement;
954
+ };
875
955
  interface HTMLElementTagNameMap {
876
956
  "stripe-address-element": HTMLStripeAddressElementElement;
877
957
  "stripe-card-element": HTMLStripeCardElementElement;
@@ -882,6 +962,7 @@ declare global {
882
962
  "stripe-modal": HTMLStripeModalElement;
883
963
  "stripe-payment-element": HTMLStripePaymentElementElement;
884
964
  "stripe-payment-request-button": HTMLStripePaymentRequestButtonElement;
965
+ "stripe-payment-sheet": HTMLStripePaymentSheetElement;
885
966
  }
886
967
  }
887
968
  declare namespace LocalJSX {
@@ -998,7 +1079,7 @@ declare namespace LocalJSX {
998
1079
  */
999
1080
  "sheetTitle"?: string;
1000
1081
  /**
1001
- * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
1082
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`, `stripe.confirmCardSetup` when it is `'setup'`. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
1002
1083
  * @default true
1003
1084
  */
1004
1085
  "shouldUseDefaultFormSubmitAction"?: boolean;
@@ -1066,7 +1147,7 @@ declare namespace LocalJSX {
1066
1147
  */
1067
1148
  "sheetTitle"?: string;
1068
1149
  /**
1069
- * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
1150
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`, `stripe.confirmCardSetup` when it is `'setup'`. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element
1070
1151
  * @default true
1071
1152
  */
1072
1153
  "shouldUseDefaultFormSubmitAction"?: boolean;
@@ -1353,7 +1434,7 @@ declare namespace LocalJSX {
1353
1434
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
1354
1435
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
1355
1436
  * and more via the modern Express Checkout Element API.
1356
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
1437
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
1357
1438
  */
1358
1439
  interface StripePaymentRequestButton {
1359
1440
  /**
@@ -1395,6 +1476,69 @@ declare namespace LocalJSX {
1395
1476
  */
1396
1477
  "stripeDidLoaded"?: StripeDidLoadedHandler;
1397
1478
  }
1479
+ /**
1480
+ * A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
1481
+ * of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix.
1482
+ */
1483
+ interface StripePaymentSheet {
1484
+ /**
1485
+ * Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
1486
+ * @default 'stripe-pwa-elements'
1487
+ */
1488
+ "applicationName"?: string;
1489
+ /**
1490
+ * Submit button label. Translated automatically by this library.
1491
+ * @default 'Pay'
1492
+ */
1493
+ "buttonLabel"?: string;
1494
+ /**
1495
+ * The client secret of a PaymentIntent (`pi_..._secret_...`) or a SetupIntent (`seti_..._secret_...`). The prefix decides whether `confirmPayment` or `confirmSetup` is used.
1496
+ */
1497
+ "intentClientSecret"?: string;
1498
+ /**
1499
+ * The customer closed the sheet
1500
+ */
1501
+ "onPaymentSheetCanceled"?: (event: StripePaymentSheetCustomEvent<void>) => void;
1502
+ /**
1503
+ * The payment or setup succeeded
1504
+ */
1505
+ "onPaymentSheetCompleted"?: (event: StripePaymentSheetCustomEvent<PaymentIntentResult | SetupIntentResult>) => void;
1506
+ /**
1507
+ * The confirmation failed with an error the customer cannot fix in the sheet
1508
+ */
1509
+ "onPaymentSheetFailed"?: (event: StripePaymentSheetCustomEvent<unknown>) => void;
1510
+ /**
1511
+ * Stripe.js or the Payment Element failed to load, or the client secret format is unknown
1512
+ */
1513
+ "onPaymentSheetFailedToLoad"?: (event: StripePaymentSheetCustomEvent<unknown>) => void;
1514
+ /**
1515
+ * Stripe.js and the Payment Element are ready
1516
+ */
1517
+ "onPaymentSheetLoaded"?: (event: StripePaymentSheetCustomEvent<StripeLoadedEvent>) => void;
1518
+ /**
1519
+ * Whether the sheet is shown. Setting it to false closes the sheet as canceled.
1520
+ * @default false
1521
+ */
1522
+ "open"?: boolean;
1523
+ /**
1524
+ * Options with the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`. JavaScript property only.
1525
+ */
1526
+ "options"?: PaymentSheetOptions;
1527
+ /**
1528
+ * Your Stripe publishable API key.
1529
+ */
1530
+ "publishableKey"?: string;
1531
+ /**
1532
+ * Sheet title. Translated automatically by this library.
1533
+ * @default 'Add your payment information'
1534
+ */
1535
+ "sheetTitle"?: string;
1536
+ /**
1537
+ * Optional. Making API calls for connected accounts
1538
+ * @info https://stripe.com/docs/connect/authentication
1539
+ */
1540
+ "stripeAccount"?: string;
1541
+ }
1398
1542
 
1399
1543
  interface StripeAddressElementAttributes {
1400
1544
  "mode": 'shipping' | 'billing';
@@ -1476,6 +1620,15 @@ declare namespace LocalJSX {
1476
1620
  "stripeAccount": string;
1477
1621
  "applicationName": string;
1478
1622
  }
1623
+ interface StripePaymentSheetAttributes {
1624
+ "publishableKey": string;
1625
+ "intentClientSecret": string;
1626
+ "stripeAccount": string;
1627
+ "open": boolean;
1628
+ "sheetTitle": string;
1629
+ "buttonLabel": string;
1630
+ "applicationName": string;
1631
+ }
1479
1632
 
1480
1633
  interface IntrinsicElements {
1481
1634
  "stripe-address-element": Omit<StripeAddressElement, keyof StripeAddressElementAttributes> & { [K in keyof StripeAddressElement & keyof StripeAddressElementAttributes]?: StripeAddressElement[K] } & { [K in keyof StripeAddressElement & keyof StripeAddressElementAttributes as `attr:${K}`]?: StripeAddressElementAttributes[K] } & { [K in keyof StripeAddressElement & keyof StripeAddressElementAttributes as `prop:${K}`]?: StripeAddressElement[K] };
@@ -1487,6 +1640,7 @@ declare namespace LocalJSX {
1487
1640
  "stripe-modal": Omit<StripeModal, keyof StripeModalAttributes> & { [K in keyof StripeModal & keyof StripeModalAttributes]?: StripeModal[K] } & { [K in keyof StripeModal & keyof StripeModalAttributes as `attr:${K}`]?: StripeModalAttributes[K] } & { [K in keyof StripeModal & keyof StripeModalAttributes as `prop:${K}`]?: StripeModal[K] };
1488
1641
  "stripe-payment-element": Omit<StripePaymentElement, keyof StripePaymentElementAttributes> & { [K in keyof StripePaymentElement & keyof StripePaymentElementAttributes]?: StripePaymentElement[K] } & { [K in keyof StripePaymentElement & keyof StripePaymentElementAttributes as `attr:${K}`]?: StripePaymentElementAttributes[K] } & { [K in keyof StripePaymentElement & keyof StripePaymentElementAttributes as `prop:${K}`]?: StripePaymentElement[K] };
1489
1642
  "stripe-payment-request-button": Omit<StripePaymentRequestButton, keyof StripePaymentRequestButtonAttributes> & { [K in keyof StripePaymentRequestButton & keyof StripePaymentRequestButtonAttributes]?: StripePaymentRequestButton[K] } & { [K in keyof StripePaymentRequestButton & keyof StripePaymentRequestButtonAttributes as `attr:${K}`]?: StripePaymentRequestButtonAttributes[K] } & { [K in keyof StripePaymentRequestButton & keyof StripePaymentRequestButtonAttributes as `prop:${K}`]?: StripePaymentRequestButton[K] };
1643
+ "stripe-payment-sheet": Omit<StripePaymentSheet, keyof StripePaymentSheetAttributes> & { [K in keyof StripePaymentSheet & keyof StripePaymentSheetAttributes]?: StripePaymentSheet[K] } & { [K in keyof StripePaymentSheet & keyof StripePaymentSheetAttributes as `attr:${K}`]?: StripePaymentSheetAttributes[K] } & { [K in keyof StripePaymentSheet & keyof StripePaymentSheetAttributes as `prop:${K}`]?: StripePaymentSheet[K] };
1490
1644
  }
1491
1645
  }
1492
1646
  export { LocalJSX as JSX };
@@ -1523,9 +1677,14 @@ declare module "@stencil/core" {
1523
1677
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
1524
1678
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
1525
1679
  * and more via the modern Express Checkout Element API.
1526
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
1680
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
1527
1681
  */
1528
1682
  "stripe-payment-request-button": LocalJSX.IntrinsicElements["stripe-payment-request-button"] & JSXBase.HTMLAttributes<HTMLStripePaymentRequestButtonElement>;
1683
+ /**
1684
+ * A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
1685
+ * of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix.
1686
+ */
1687
+ "stripe-payment-sheet": LocalJSX.IntrinsicElements["stripe-payment-sheet"] & JSXBase.HTMLAttributes<HTMLStripePaymentSheetElement>;
1529
1688
  }
1530
1689
  }
1531
1690
  }
@@ -1,3 +1,5 @@
1
1
  export { Components, JSX } from './components';
2
2
  export type { FormSubmitEvent, FormSubmitHandler, StripeLoadedEvent, StripeDidLoadedHandler, ProgressStatus, IntentType, InitStripeOptions, LinkAuthenticationElementChangeEvent, LinkAuthenticationElementChangeHandler, CurrencySelectorChangeEvent, CurrencySelectorChangeHandler, DefaultFormSubmitResult, } from './interfaces';
3
+ export type { PaymentSheetOptions, PaymentSheetPresentResult } from './components/stripe-payment-sheet/stripe-payment-sheet.helpers';
4
+ export type { PaymentSheetEventName, PaymentSheetResult } from './components/stripe-payment-sheet/payment-sheet-state';
3
5
  import 'ionicons';
@@ -75,6 +75,8 @@ export interface IStripeService {
75
75
  initialize(publishableKey: string, options?: {
76
76
  stripeAccount?: string;
77
77
  applicationName?: string;
78
+ clientSecret?: string;
79
+ elementsOptions?: import('@stripe/stripe-js').StripeElementsOptionsMode;
78
80
  }): Promise<void>;
79
81
  /**
80
82
  * Initialize Stripe.js with Checkout Session mode