stripe-pwa-elements 4.0.1 → 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 (100) hide show
  1. package/dist/cjs/factory-tenFFIul.js +1200 -0
  2. package/dist/cjs/{factory-Cd2VI_N2.js → i18n-FhEOc8vz.js} +6 -1149
  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 +5 -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} +8 -93
  8. package/dist/cjs/stripe-currency-selector.cjs.entry.js +4 -3
  9. package/dist/cjs/stripe-elements.cjs.js +1 -1
  10. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +24 -5
  11. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +4 -3
  12. package/dist/cjs/stripe-payment-element.cjs.entry.js +12 -124
  13. package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
  14. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +2 -2
  15. package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
  16. package/dist/collection/collection-manifest.json +2 -1
  17. package/dist/collection/components/stripe-card-element/stripe-card-element.js +3 -2
  18. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
  19. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +18 -0
  20. package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
  21. package/dist/collection/components/stripe-modal/stripe-modal.js +130 -1
  22. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +3 -3
  23. package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
  24. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
  25. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
  26. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
  27. package/dist/collection/services/express-checkout-element-manager.js +36 -2
  28. package/dist/collection/services/stripe-service.js +20 -6
  29. package/dist/collection/utils/focus.js +76 -0
  30. package/dist/collection/utils/i18n.js +6 -0
  31. package/dist/components/factory.js +1 -1
  32. package/dist/components/i18n.js +1 -0
  33. package/dist/components/stripe-address-element.js +1 -1
  34. package/dist/components/stripe-card-element-modal.js +1 -1
  35. package/dist/components/stripe-card-element2.js +1 -1
  36. package/dist/components/stripe-currency-selector.js +1 -1
  37. package/dist/components/stripe-express-checkout-element.js +1 -1
  38. package/dist/components/stripe-link-authentication-element.js +1 -1
  39. package/dist/components/stripe-modal2.js +1 -1
  40. package/dist/components/stripe-payment-element.helpers.js +1 -0
  41. package/dist/components/stripe-payment-element.js +1 -1
  42. package/dist/components/stripe-payment-request-button2.js +1 -1
  43. package/dist/components/stripe-payment-sheet.d.ts +11 -0
  44. package/dist/components/stripe-payment-sheet.js +1 -0
  45. package/dist/esm/factory-Cd6OGTWN.js +1198 -0
  46. package/dist/esm/{factory-VTa1Gc94.js → i18n-B6JoQetF.js} +7 -1149
  47. package/dist/esm/ion-icon_2.entry.js +720 -0
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/stripe-address-element.entry.js +2 -1
  50. package/dist/esm/stripe-card-element-modal.entry.js +3 -2
  51. package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +6 -90
  52. package/dist/esm/stripe-currency-selector.entry.js +2 -1
  53. package/dist/esm/stripe-elements.js +1 -1
  54. package/dist/esm/stripe-express-checkout-element.entry.js +20 -1
  55. package/dist/esm/stripe-link-authentication-element.entry.js +2 -1
  56. package/dist/esm/stripe-payment-element.entry.js +4 -116
  57. package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
  58. package/dist/esm/stripe-payment-request-button.entry.js +2 -2
  59. package/dist/esm/stripe-payment-sheet.entry.js +504 -0
  60. package/dist/stripe-elements/{p-ae0c336e.entry.js → p-4891edf0.entry.js} +1 -1
  61. package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
  62. package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
  63. package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
  64. package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
  65. package/dist/stripe-elements/p-B6JoQetF.js +1 -0
  66. package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
  67. package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
  68. package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
  69. package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
  70. package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
  71. package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
  72. package/dist/stripe-elements/p-f892e375.entry.js +1 -0
  73. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  74. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +2 -1
  75. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
  76. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +5 -0
  77. package/dist/types/components/stripe-modal/stripe-modal.d.ts +43 -0
  78. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +1 -1
  79. package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
  80. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
  81. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
  82. package/dist/types/components.d.ts +169 -10
  83. package/dist/types/index.d.ts +2 -0
  84. package/dist/types/services/interfaces.d.ts +1 -0
  85. package/dist/types/services/stripe-service.d.ts +7 -2
  86. package/dist/types/utils/focus.d.ts +15 -0
  87. package/package.json +5 -3
  88. package/readme.md +42 -6
  89. package/dist/cjs/ion-icon.cjs.entry.js +0 -431
  90. package/dist/components/utils.js +0 -1
  91. package/dist/esm/ion-icon.entry.js +0 -429
  92. package/dist/stripe-elements/p-1bd46766.entry.js +0 -1
  93. package/dist/stripe-elements/p-1c6e0a45.entry.js +0 -1
  94. package/dist/stripe-elements/p-3f42ca0c.entry.js +0 -1
  95. package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
  96. package/dist/stripe-elements/p-74de1556.entry.js +0 -1
  97. package/dist/stripe-elements/p-76e57d78.entry.js +0 -1
  98. package/dist/stripe-elements/p-840d499f.entry.js +0 -1
  99. package/dist/stripe-elements/p-CrjrbGJ3.js +0 -1
  100. package/dist/stripe-elements/p-cfd8e081.entry.js +0 -1
@@ -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';
@@ -76,6 +76,7 @@ export interface IStripeService {
76
76
  stripeAccount?: string;
77
77
  applicationName?: string;
78
78
  clientSecret?: string;
79
+ elementsOptions?: import('@stripe/stripe-js').StripeElementsOptionsMode;
79
80
  }): Promise<void>;
80
81
  /**
81
82
  * Initialize Stripe.js with Checkout Session mode
@@ -1,4 +1,4 @@
1
- import { Stripe, StripeElements, StripeCheckoutElementsSdk } from '@stripe/stripe-js';
1
+ import { Stripe, StripeElements, StripeElementsOptionsMode, StripeCheckoutElementsSdk } from '@stripe/stripe-js';
2
2
  import type { IStripeService, StripeServiceState, CheckoutSessionOptions } from './interfaces';
3
3
  /**
4
4
  * Core Stripe Service
@@ -8,6 +8,8 @@ import type { IStripeService, StripeServiceState, CheckoutSessionOptions } from
8
8
  declare class StripeServiceClass implements IStripeService {
9
9
  private store;
10
10
  private intentClientSecret?;
11
+ /** Serialized `elementsOptions` of the last init, used to detect real changes */
12
+ private elementsOptionsKey?;
11
13
  /** Incremented on every init so that a slower, older call cannot overwrite newer state */
12
14
  private initGeneration;
13
15
  private changeListeners;
@@ -26,12 +28,15 @@ declare class StripeServiceClass implements IStripeService {
26
28
  /**
27
29
  * Initialize Stripe.js client with Payment Intent mode
28
30
  * @param publishableKey - Your Stripe publishable API key
29
- * @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
31
+ * @param options - Optional configuration. `clientSecret` is the PaymentIntent / SetupIntent client secret;
32
+ * `elementsOptions` (mode / amount / currency) is used to create Elements when there is no client secret.
33
+ * `clientSecret` takes priority when both are given.
30
34
  */
31
35
  initialize(publishableKey: string, options?: {
32
36
  stripeAccount?: string;
33
37
  applicationName?: string;
34
38
  clientSecret?: string;
39
+ elementsOptions?: StripeElementsOptionsMode;
35
40
  }): Promise<void>;
36
41
  /**
37
42
  * Initialize Stripe.js client with Checkout Session mode
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Whether the element can be reached with the Tab key.
3
+ * Elements hidden with `display: none` / `visibility: hidden` are excluded when the browser supports `checkVisibility()`.
4
+ */
5
+ export declare const isTabbable: (element: Element) => element is HTMLElement;
6
+ /**
7
+ * Collect tabbable elements under `root` in DOM order, following the composed (flattened) tree:
8
+ * open shadow roots are entered and `<slot>` elements are replaced by their assigned elements.
9
+ * Positive `tabindex` ordering is not taken into account.
10
+ */
11
+ export declare const getTabbableElements: (root: Element | ShadowRoot) => HTMLElement[];
12
+ /**
13
+ * Return the focused element, descending into open shadow roots.
14
+ */
15
+ export declare const getDeepActiveElement: (doc?: Document) => Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe-pwa-elements",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Framework-agnostic Stripe Payment Elements as Web Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -60,6 +60,7 @@
60
60
  },
61
61
  "license": "MIT",
62
62
  "devDependencies": {
63
+ "@changesets/cli": "^3.0.3",
63
64
  "@eslint/eslintrc": "^3.3.3",
64
65
  "@eslint/js": "^9.39.2",
65
66
  "@jsr/circleci__jest-circleci-coverage": "^0.4.0",
@@ -76,7 +77,6 @@
76
77
  "jest": "^29.7.0",
77
78
  "jest-cli": "^29.7.0",
78
79
  "jest-junit": "^17.0.0",
79
- "np": "^10.2.0",
80
80
  "prettier": "^3.6.2",
81
81
  "prettier-eslint": "^16.4.2",
82
82
  "prettier-eslint-cli": "^8.0.1",
@@ -104,6 +104,8 @@
104
104
  "format": "prettier --write src",
105
105
  "example:copy": "stencil build --docs && cp -R dist/stripe-elements example/",
106
106
  "example:serve": "pnpm dlx serve example",
107
- "release": "np"
107
+ "changeset": "changeset",
108
+ "changeset:version": "changeset version",
109
+ "changeset:publish": "pnpm run build && pnpm -F hono-stripe-elements run build && changeset publish"
108
110
  }
109
111
  }