stripe-pwa-elements 4.0.1 → 4.0.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/dist/cjs/factory-Cm6zUD7R.js +1206 -0
- package/dist/cjs/{factory-Cd2VI_N2.js → i18n-lBbOeQt4.js} +12 -1149
- package/dist/cjs/ion-icon_2.cjs.entry.js +725 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stripe-address-element.cjs.entry.js +5 -4
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
- package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +8 -93
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +4 -3
- package/dist/cjs/stripe-elements.cjs.js +1 -1
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +24 -5
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +4 -3
- package/dist/cjs/stripe-payment-element.cjs.entry.js +12 -124
- package/dist/cjs/stripe-payment-element.helpers-CvAhIqLt.js +119 -0
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +2 -2
- package/dist/cjs/stripe-payment-sheet.cjs.entry.js +987 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +2 -2
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +3 -2
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +18 -0
- package/dist/collection/components/stripe-modal/stripe-modal.css +27 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js +132 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +4 -7
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +4 -4
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +3 -3
- package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +193 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.checkout.js +94 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +274 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +763 -0
- package/dist/collection/services/express-checkout-element-manager.js +36 -2
- package/dist/collection/services/link-authentication-element-manager.js +5 -0
- package/dist/collection/services/stripe-service.js +20 -6
- package/dist/collection/utils/focus.js +76 -0
- package/dist/collection/utils/i18n.js +12 -0
- package/dist/components/factory.js +1 -1
- package/dist/components/i18n.js +1 -0
- package/dist/components/stripe-address-element.js +1 -1
- package/dist/components/stripe-card-element-modal.js +1 -1
- package/dist/components/stripe-card-element2.js +1 -1
- package/dist/components/stripe-currency-selector.js +1 -1
- package/dist/components/stripe-express-checkout-element.js +1 -1
- package/dist/components/stripe-link-authentication-element.js +1 -1
- package/dist/components/stripe-modal2.js +1 -1
- package/dist/components/stripe-payment-element.helpers.js +1 -0
- package/dist/components/stripe-payment-element.js +1 -1
- package/dist/components/stripe-payment-request-button2.js +1 -1
- package/dist/components/stripe-payment-sheet.d.ts +11 -0
- package/dist/components/stripe-payment-sheet.js +1 -0
- package/dist/esm/factory-BaGv8K_i.js +1203 -0
- package/dist/esm/{factory-VTa1Gc94.js → i18n-CL5n3bOb.js} +13 -1149
- package/dist/esm/ion-icon_2.entry.js +722 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stripe-address-element.entry.js +2 -1
- package/dist/esm/stripe-card-element-modal.entry.js +3 -2
- package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +6 -90
- package/dist/esm/stripe-currency-selector.entry.js +2 -1
- package/dist/esm/stripe-elements.js +1 -1
- package/dist/esm/stripe-express-checkout-element.entry.js +20 -1
- package/dist/esm/stripe-link-authentication-element.entry.js +2 -1
- package/dist/esm/stripe-payment-element.entry.js +4 -116
- package/dist/esm/stripe-payment-element.helpers-Bu9RfxS4.js +114 -0
- package/dist/esm/stripe-payment-request-button.entry.js +2 -2
- package/dist/esm/stripe-payment-sheet.entry.js +985 -0
- package/dist/stripe-elements/p-2e41699e.entry.js +1 -0
- package/dist/stripe-elements/p-3fc4583a.entry.js +1 -0
- package/dist/stripe-elements/{p-ae0c336e.entry.js → p-4891edf0.entry.js} +1 -1
- package/dist/stripe-elements/p-7e826964.entry.js +1 -0
- package/dist/stripe-elements/p-BhKXGROE.js +1 -0
- package/dist/stripe-elements/p-CL5n3bOb.js +1 -0
- package/dist/stripe-elements/p-DlMEZwSe.js +1 -0
- package/dist/stripe-elements/p-a395a5d1.entry.js +1 -0
- package/dist/stripe-elements/p-b62c9dae.entry.js +1 -0
- package/dist/stripe-elements/p-b7c20e8e.entry.js +1 -0
- package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
- package/dist/stripe-elements/p-bec62526.entry.js +1 -0
- package/dist/stripe-elements/p-f5552c81.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -1
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +2 -1
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
- package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +5 -0
- package/dist/types/components/stripe-modal/stripe-modal.d.ts +43 -0
- package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +7 -2
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +1 -1
- package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +121 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.checkout.d.ts +39 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +157 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +153 -0
- package/dist/types/components.d.ts +182 -10
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/interfaces.d.ts +3 -0
- package/dist/types/services/stripe-service.d.ts +7 -2
- package/dist/types/utils/focus.d.ts +15 -0
- package/package.json +7 -3
- package/readme.md +59 -6
- package/dist/cjs/ion-icon.cjs.entry.js +0 -431
- package/dist/components/utils.js +0 -1
- package/dist/esm/ion-icon.entry.js +0 -429
- package/dist/stripe-elements/p-1bd46766.entry.js +0 -1
- package/dist/stripe-elements/p-1c6e0a45.entry.js +0 -1
- package/dist/stripe-elements/p-3f42ca0c.entry.js +0 -1
- package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
- package/dist/stripe-elements/p-74de1556.entry.js +0 -1
- package/dist/stripe-elements/p-76e57d78.entry.js +0 -1
- package/dist/stripe-elements/p-840d499f.entry.js +0 -1
- package/dist/stripe-elements/p-CrjrbGJ3.js +0 -1
- package/dist/stripe-elements/p-cfd8e081.entry.js +0 -1
|
@@ -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, StripeCheckoutConfirmResult, 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, StripeCheckoutConfirmResult, 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
|
|
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
|
|
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://
|
|
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,60 @@ 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
|
+
* a Checkout Session is used when `checkout-session-client-secret` is set.
|
|
654
|
+
*/
|
|
655
|
+
interface StripePaymentSheet {
|
|
656
|
+
/**
|
|
657
|
+
* Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
|
|
658
|
+
* @default 'stripe-pwa-elements'
|
|
659
|
+
*/
|
|
660
|
+
"applicationName": string;
|
|
661
|
+
/**
|
|
662
|
+
* Submit button label. Translated automatically by this library.
|
|
663
|
+
* @default 'Pay'
|
|
664
|
+
*/
|
|
665
|
+
"buttonLabel": string;
|
|
666
|
+
/**
|
|
667
|
+
* The client secret of a Checkout Session created with `ui_mode: 'elements'` (named `custom` in older Stripe API versions). Its format is not inspected. When it is set, it is used instead of `intent-client-secret` (the same rule as `stripe-payment-element`). Create the session with `customer_email` or `customer`, or pass `options.defaultBillingDetails.email`, because the sheet has no email field.
|
|
668
|
+
*/
|
|
669
|
+
"checkoutSessionClientSecret"?: string;
|
|
670
|
+
/**
|
|
671
|
+
* The client secret of a PaymentIntent (`pi_..._secret_...`) or a SetupIntent (`seti_..._secret_...`). The prefix decides whether `confirmPayment` or `confirmSetup` is used.
|
|
672
|
+
*/
|
|
673
|
+
"intentClientSecret"?: string;
|
|
674
|
+
/**
|
|
675
|
+
* Whether the sheet is shown. Setting it to false closes the sheet as canceled.
|
|
676
|
+
* @default false
|
|
677
|
+
*/
|
|
678
|
+
"open": boolean;
|
|
679
|
+
/**
|
|
680
|
+
* Options with the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`. JavaScript property only.
|
|
681
|
+
*/
|
|
682
|
+
"options"?: PaymentSheetOptions;
|
|
683
|
+
/**
|
|
684
|
+
* Show the sheet and wait for its result. Calling it again while a result is pending returns the same promise.
|
|
685
|
+
* @returns `{ paymentResult }`, where `paymentResult` is `paymentSheetCompleted`, `paymentSheetCanceled` or `paymentSheetFailed`
|
|
686
|
+
* @example ``` const sheet = document.querySelector('stripe-payment-sheet'); const { paymentResult } = await sheet.present(); ```
|
|
687
|
+
*/
|
|
688
|
+
"present": () => Promise<PaymentSheetPresentResult>;
|
|
689
|
+
/**
|
|
690
|
+
* Your Stripe publishable API key.
|
|
691
|
+
*/
|
|
692
|
+
"publishableKey"?: string;
|
|
693
|
+
/**
|
|
694
|
+
* Sheet title. Translated automatically by this library.
|
|
695
|
+
* @default 'Add your payment information'
|
|
696
|
+
*/
|
|
697
|
+
"sheetTitle": string;
|
|
698
|
+
/**
|
|
699
|
+
* Optional. Making API calls for connected accounts
|
|
700
|
+
* @info https://stripe.com/docs/connect/authentication
|
|
701
|
+
*/
|
|
702
|
+
"stripeAccount"?: string;
|
|
703
|
+
}
|
|
648
704
|
}
|
|
649
705
|
export interface StripeAddressElementCustomEvent<T> extends CustomEvent<T> {
|
|
650
706
|
detail: T;
|
|
@@ -682,6 +738,10 @@ export interface StripePaymentRequestButtonCustomEvent<T> extends CustomEvent<T>
|
|
|
682
738
|
detail: T;
|
|
683
739
|
target: HTMLStripePaymentRequestButtonElement;
|
|
684
740
|
}
|
|
741
|
+
export interface StripePaymentSheetCustomEvent<T> extends CustomEvent<T> {
|
|
742
|
+
detail: T;
|
|
743
|
+
target: HTMLStripePaymentSheetElement;
|
|
744
|
+
}
|
|
685
745
|
declare global {
|
|
686
746
|
interface HTMLStripeAddressElementElementEventMap {
|
|
687
747
|
"stripeLoaded": StripeLoadedEvent;
|
|
@@ -856,7 +916,7 @@ declare global {
|
|
|
856
916
|
* `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
|
|
857
917
|
* Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
|
|
858
918
|
* and more via the modern Express Checkout Element API.
|
|
859
|
-
* Migration guide: https://
|
|
919
|
+
* Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
|
|
860
920
|
*/
|
|
861
921
|
interface HTMLStripePaymentRequestButtonElement extends Components.StripePaymentRequestButton, HTMLStencilElement {
|
|
862
922
|
addEventListener<K extends keyof HTMLStripePaymentRequestButtonElementEventMap>(type: K, listener: (this: HTMLStripePaymentRequestButtonElement, ev: StripePaymentRequestButtonCustomEvent<HTMLStripePaymentRequestButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -872,6 +932,32 @@ declare global {
|
|
|
872
932
|
prototype: HTMLStripePaymentRequestButtonElement;
|
|
873
933
|
new (): HTMLStripePaymentRequestButtonElement;
|
|
874
934
|
};
|
|
935
|
+
interface HTMLStripePaymentSheetElementEventMap {
|
|
936
|
+
"paymentSheetLoaded": StripeLoadedEvent;
|
|
937
|
+
"paymentSheetFailedToLoad": unknown;
|
|
938
|
+
"paymentSheetCompleted": PaymentIntentResult | SetupIntentResult | StripeCheckoutConfirmResult;
|
|
939
|
+
"paymentSheetCanceled": void;
|
|
940
|
+
"paymentSheetFailed": unknown;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
|
|
944
|
+
* of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix;
|
|
945
|
+
* a Checkout Session is used when `checkout-session-client-secret` is set.
|
|
946
|
+
*/
|
|
947
|
+
interface HTMLStripePaymentSheetElement extends Components.StripePaymentSheet, HTMLStencilElement {
|
|
948
|
+
addEventListener<K extends keyof HTMLStripePaymentSheetElementEventMap>(type: K, listener: (this: HTMLStripePaymentSheetElement, ev: StripePaymentSheetCustomEvent<HTMLStripePaymentSheetElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
949
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
950
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
951
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
952
|
+
removeEventListener<K extends keyof HTMLStripePaymentSheetElementEventMap>(type: K, listener: (this: HTMLStripePaymentSheetElement, ev: StripePaymentSheetCustomEvent<HTMLStripePaymentSheetElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
953
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
954
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
955
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
956
|
+
}
|
|
957
|
+
var HTMLStripePaymentSheetElement: {
|
|
958
|
+
prototype: HTMLStripePaymentSheetElement;
|
|
959
|
+
new (): HTMLStripePaymentSheetElement;
|
|
960
|
+
};
|
|
875
961
|
interface HTMLElementTagNameMap {
|
|
876
962
|
"stripe-address-element": HTMLStripeAddressElementElement;
|
|
877
963
|
"stripe-card-element": HTMLStripeCardElementElement;
|
|
@@ -882,6 +968,7 @@ declare global {
|
|
|
882
968
|
"stripe-modal": HTMLStripeModalElement;
|
|
883
969
|
"stripe-payment-element": HTMLStripePaymentElementElement;
|
|
884
970
|
"stripe-payment-request-button": HTMLStripePaymentRequestButtonElement;
|
|
971
|
+
"stripe-payment-sheet": HTMLStripePaymentSheetElement;
|
|
885
972
|
}
|
|
886
973
|
}
|
|
887
974
|
declare namespace LocalJSX {
|
|
@@ -998,7 +1085,7 @@ declare namespace LocalJSX {
|
|
|
998
1085
|
*/
|
|
999
1086
|
"sheetTitle"?: string;
|
|
1000
1087
|
/**
|
|
1001
|
-
* The component will
|
|
1088
|
+
* 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
1089
|
* @default true
|
|
1003
1090
|
*/
|
|
1004
1091
|
"shouldUseDefaultFormSubmitAction"?: boolean;
|
|
@@ -1066,7 +1153,7 @@ declare namespace LocalJSX {
|
|
|
1066
1153
|
*/
|
|
1067
1154
|
"sheetTitle"?: string;
|
|
1068
1155
|
/**
|
|
1069
|
-
* The component will
|
|
1156
|
+
* 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
1157
|
* @default true
|
|
1071
1158
|
*/
|
|
1072
1159
|
"shouldUseDefaultFormSubmitAction"?: boolean;
|
|
@@ -1353,7 +1440,7 @@ declare namespace LocalJSX {
|
|
|
1353
1440
|
* `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
|
|
1354
1441
|
* Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
|
|
1355
1442
|
* and more via the modern Express Checkout Element API.
|
|
1356
|
-
* Migration guide: https://
|
|
1443
|
+
* Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
|
|
1357
1444
|
*/
|
|
1358
1445
|
interface StripePaymentRequestButton {
|
|
1359
1446
|
/**
|
|
@@ -1395,6 +1482,74 @@ declare namespace LocalJSX {
|
|
|
1395
1482
|
*/
|
|
1396
1483
|
"stripeDidLoaded"?: StripeDidLoadedHandler;
|
|
1397
1484
|
}
|
|
1485
|
+
/**
|
|
1486
|
+
* A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
|
|
1487
|
+
* of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix;
|
|
1488
|
+
* a Checkout Session is used when `checkout-session-client-secret` is set.
|
|
1489
|
+
*/
|
|
1490
|
+
interface StripePaymentSheet {
|
|
1491
|
+
/**
|
|
1492
|
+
* Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
|
|
1493
|
+
* @default 'stripe-pwa-elements'
|
|
1494
|
+
*/
|
|
1495
|
+
"applicationName"?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Submit button label. Translated automatically by this library.
|
|
1498
|
+
* @default 'Pay'
|
|
1499
|
+
*/
|
|
1500
|
+
"buttonLabel"?: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* The client secret of a Checkout Session created with `ui_mode: 'elements'` (named `custom` in older Stripe API versions). Its format is not inspected. When it is set, it is used instead of `intent-client-secret` (the same rule as `stripe-payment-element`). Create the session with `customer_email` or `customer`, or pass `options.defaultBillingDetails.email`, because the sheet has no email field.
|
|
1503
|
+
*/
|
|
1504
|
+
"checkoutSessionClientSecret"?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* The client secret of a PaymentIntent (`pi_..._secret_...`) or a SetupIntent (`seti_..._secret_...`). The prefix decides whether `confirmPayment` or `confirmSetup` is used.
|
|
1507
|
+
*/
|
|
1508
|
+
"intentClientSecret"?: string;
|
|
1509
|
+
/**
|
|
1510
|
+
* The customer closed the sheet
|
|
1511
|
+
*/
|
|
1512
|
+
"onPaymentSheetCanceled"?: (event: StripePaymentSheetCustomEvent<void>) => void;
|
|
1513
|
+
/**
|
|
1514
|
+
* The payment or setup succeeded. In Checkout Session mode the detail is the result of `confirm` (`{ type: 'success', session }`)
|
|
1515
|
+
*/
|
|
1516
|
+
"onPaymentSheetCompleted"?: (event: StripePaymentSheetCustomEvent<PaymentIntentResult | SetupIntentResult | StripeCheckoutConfirmResult>) => void;
|
|
1517
|
+
/**
|
|
1518
|
+
* The confirmation failed with an error the customer cannot fix in the sheet
|
|
1519
|
+
*/
|
|
1520
|
+
"onPaymentSheetFailed"?: (event: StripePaymentSheetCustomEvent<unknown>) => void;
|
|
1521
|
+
/**
|
|
1522
|
+
* Stripe.js or the Payment Element failed to load, or the client secret format is unknown
|
|
1523
|
+
*/
|
|
1524
|
+
"onPaymentSheetFailedToLoad"?: (event: StripePaymentSheetCustomEvent<unknown>) => void;
|
|
1525
|
+
/**
|
|
1526
|
+
* Stripe.js and the Payment Element are ready
|
|
1527
|
+
*/
|
|
1528
|
+
"onPaymentSheetLoaded"?: (event: StripePaymentSheetCustomEvent<StripeLoadedEvent>) => void;
|
|
1529
|
+
/**
|
|
1530
|
+
* Whether the sheet is shown. Setting it to false closes the sheet as canceled.
|
|
1531
|
+
* @default false
|
|
1532
|
+
*/
|
|
1533
|
+
"open"?: boolean;
|
|
1534
|
+
/**
|
|
1535
|
+
* Options with the same keys as `CreatePaymentSheetOption` of `@capacitor-community/stripe`. JavaScript property only.
|
|
1536
|
+
*/
|
|
1537
|
+
"options"?: PaymentSheetOptions;
|
|
1538
|
+
/**
|
|
1539
|
+
* Your Stripe publishable API key.
|
|
1540
|
+
*/
|
|
1541
|
+
"publishableKey"?: string;
|
|
1542
|
+
/**
|
|
1543
|
+
* Sheet title. Translated automatically by this library.
|
|
1544
|
+
* @default 'Add your payment information'
|
|
1545
|
+
*/
|
|
1546
|
+
"sheetTitle"?: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* Optional. Making API calls for connected accounts
|
|
1549
|
+
* @info https://stripe.com/docs/connect/authentication
|
|
1550
|
+
*/
|
|
1551
|
+
"stripeAccount"?: string;
|
|
1552
|
+
}
|
|
1398
1553
|
|
|
1399
1554
|
interface StripeAddressElementAttributes {
|
|
1400
1555
|
"mode": 'shipping' | 'billing';
|
|
@@ -1476,6 +1631,16 @@ declare namespace LocalJSX {
|
|
|
1476
1631
|
"stripeAccount": string;
|
|
1477
1632
|
"applicationName": string;
|
|
1478
1633
|
}
|
|
1634
|
+
interface StripePaymentSheetAttributes {
|
|
1635
|
+
"publishableKey": string;
|
|
1636
|
+
"intentClientSecret": string;
|
|
1637
|
+
"checkoutSessionClientSecret": string;
|
|
1638
|
+
"stripeAccount": string;
|
|
1639
|
+
"open": boolean;
|
|
1640
|
+
"sheetTitle": string;
|
|
1641
|
+
"buttonLabel": string;
|
|
1642
|
+
"applicationName": string;
|
|
1643
|
+
}
|
|
1479
1644
|
|
|
1480
1645
|
interface IntrinsicElements {
|
|
1481
1646
|
"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 +1652,7 @@ declare namespace LocalJSX {
|
|
|
1487
1652
|
"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
1653
|
"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
1654
|
"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] };
|
|
1655
|
+
"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
1656
|
}
|
|
1491
1657
|
}
|
|
1492
1658
|
export { LocalJSX as JSX };
|
|
@@ -1523,9 +1689,15 @@ declare module "@stencil/core" {
|
|
|
1523
1689
|
* `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
|
|
1524
1690
|
* Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
|
|
1525
1691
|
* and more via the modern Express Checkout Element API.
|
|
1526
|
-
* Migration guide: https://
|
|
1692
|
+
* Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
|
|
1527
1693
|
*/
|
|
1528
1694
|
"stripe-payment-request-button": LocalJSX.IntrinsicElements["stripe-payment-request-button"] & JSXBase.HTMLAttributes<HTMLStripePaymentRequestButtonElement>;
|
|
1695
|
+
/**
|
|
1696
|
+
* A payment sheet: the Payment Element in a modal, with the same events and results as the native PaymentSheet
|
|
1697
|
+
* of `@capacitor-community/stripe`. PaymentIntent and SetupIntent are told apart by the client secret prefix;
|
|
1698
|
+
* a Checkout Session is used when `checkout-session-client-secret` is set.
|
|
1699
|
+
*/
|
|
1700
|
+
"stripe-payment-sheet": LocalJSX.IntrinsicElements["stripe-payment-sheet"] & JSXBase.HTMLAttributes<HTMLStripePaymentSheetElement>;
|
|
1529
1701
|
}
|
|
1530
1702
|
}
|
|
1531
1703
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -59,6 +59,8 @@ export type AddressElementState = {
|
|
|
59
59
|
export type LinkAuthenticationElementState = {
|
|
60
60
|
errorMessage: string;
|
|
61
61
|
email?: string;
|
|
62
|
+
/** `complete` of the latest change event: whether the email is valid. Undefined until the element reports a change */
|
|
63
|
+
complete?: boolean;
|
|
62
64
|
};
|
|
63
65
|
/**
|
|
64
66
|
* Core Stripe service interface
|
|
@@ -76,6 +78,7 @@ export interface IStripeService {
|
|
|
76
78
|
stripeAccount?: string;
|
|
77
79
|
applicationName?: string;
|
|
78
80
|
clientSecret?: string;
|
|
81
|
+
elementsOptions?: import('@stripe/stripe-js').StripeElementsOptionsMode;
|
|
79
82
|
}): Promise<void>;
|
|
80
83
|
/**
|
|
81
84
|
* 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
|
|
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.
|
|
3
|
+
"version": "4.0.3",
|
|
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,9 +60,11 @@
|
|
|
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",
|
|
67
|
+
"@playwright/test": "1.56.1",
|
|
66
68
|
"@stencil-community/eslint-plugin": "^0.10.0",
|
|
67
69
|
"@stencil/sass": "^3.2.3",
|
|
68
70
|
"@stencil/store": "^2.2.1",
|
|
@@ -76,7 +78,6 @@
|
|
|
76
78
|
"jest": "^29.7.0",
|
|
77
79
|
"jest-cli": "^29.7.0",
|
|
78
80
|
"jest-junit": "^17.0.0",
|
|
79
|
-
"np": "^10.2.0",
|
|
80
81
|
"prettier": "^3.6.2",
|
|
81
82
|
"prettier-eslint": "^16.4.2",
|
|
82
83
|
"prettier-eslint-cli": "^8.0.1",
|
|
@@ -104,6 +105,9 @@
|
|
|
104
105
|
"format": "prettier --write src",
|
|
105
106
|
"example:copy": "stencil build --docs && cp -R dist/stripe-elements example/",
|
|
106
107
|
"example:serve": "pnpm dlx serve example",
|
|
107
|
-
"
|
|
108
|
+
"changeset": "changeset",
|
|
109
|
+
"changeset:version": "changeset version",
|
|
110
|
+
"changeset:publish": "pnpm run build && pnpm -F hono-stripe-elements run build && changeset publish",
|
|
111
|
+
"test:e2e:stripe": "playwright test -c e2e/stripe/playwright.config.ts"
|
|
108
112
|
}
|
|
109
113
|
}
|
package/readme.md
CHANGED
|
@@ -11,6 +11,18 @@ Framework-agnostic Stripe payment components built with Web Components. Works wi
|
|
|
11
11
|
> **Note:** The current npm package is **`stripe-pwa-elements`** (this repo).
|
|
12
12
|
> The old package `@stripe-elements/stripe-elements` (v2.0.2) is deprecated and superseded — please use `stripe-pwa-elements` instead.
|
|
13
13
|
|
|
14
|
+
## Try it first
|
|
15
|
+
|
|
16
|
+
[](https://codesandbox.io/p/devbox/github/hideokamoto/stripe-pwa-elements/tree/main/examples/codesandbox)
|
|
17
|
+
|
|
18
|
+
Open the live demo in CodeSandbox (Stripe test mode, no setup or API keys needed) before installing anything. The demo covers:
|
|
19
|
+
|
|
20
|
+
- `<stripe-card-element>` — card number / expiry / CVC with a PaymentIntent confirm flow
|
|
21
|
+
- `<stripe-address-element>` — billing address form
|
|
22
|
+
- `<stripe-express-checkout-element>` — Apple Pay / Google Pay / Link (device-dependent)
|
|
23
|
+
|
|
24
|
+
There is no `<stripe-payment-element>` demo yet. See [`examples/codesandbox`](examples/codesandbox) for details.
|
|
25
|
+
|
|
14
26
|
## Used in production
|
|
15
27
|
|
|
16
28
|
[](https://github.com/capacitor-community/stripe)
|
|
@@ -308,22 +320,39 @@ See the [example/](./example) directory for complete working examples:
|
|
|
308
320
|
- [Address Element](./example/address-example.html) — Address collection
|
|
309
321
|
- [Express Checkout](./example/example-express-checkout.html) — Apple Pay, Google Pay, etc.
|
|
310
322
|
|
|
311
|
-
## Use with
|
|
323
|
+
## Use with coding agents (Agent Skill)
|
|
324
|
+
|
|
325
|
+
This repo ships an [Agent Skill](https://agentskills.io/specification) that teaches
|
|
326
|
+
coding agents how to integrate `stripe-pwa-elements` correctly — picking the right
|
|
327
|
+
component, wiring the publishable key + client secret, handling the
|
|
328
|
+
submit/confirm flow, and asking before anything that changes your Stripe account.
|
|
329
|
+
The skill lives in [`plugins/stripe-pwa-elements/skills/stripe-pwa-elements/`](./plugins/stripe-pwa-elements/skills/stripe-pwa-elements/SKILL.md).
|
|
312
330
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
331
|
+
Install it with the [`skills`](https://www.npmjs.com/package/skills) CLI:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
npx skills add hideokamoto/stripe-pwa-elements
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Or, in [Claude Code](https://claude.com/claude-code), install it as a plugin:
|
|
317
338
|
|
|
318
339
|
```text
|
|
319
340
|
/plugin marketplace add hideokamoto/stripe-pwa-elements
|
|
320
341
|
/plugin install stripe-pwa-elements@stripe-pwa-elements
|
|
321
342
|
```
|
|
322
343
|
|
|
323
|
-
Once installed, the skill activates automatically when Claude detects you are
|
|
344
|
+
Once installed in Claude Code, the skill activates automatically when Claude detects you are
|
|
324
345
|
working with the library, or you can invoke it explicitly with
|
|
325
346
|
`/stripe-pwa-elements:stripe-pwa-elements`.
|
|
326
347
|
|
|
348
|
+
The documentation site also serves the skill over HTTP, built from the same file:
|
|
349
|
+
|
|
350
|
+
| URL | Purpose |
|
|
351
|
+
| --- | --- |
|
|
352
|
+
| [`/skill.md`](https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/skill.md) | The skill's `SKILL.md` |
|
|
353
|
+
| [`/.well-known/agent-skills/index.json`](https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/.well-known/agent-skills/index.json) | Discovery index ([Agent Skills Discovery RFC](https://github.com/cloudflare/agent-skills-discovery-rfc), draft v0.2.0) with a SHA-256 digest per skill |
|
|
354
|
+
| [`/.well-known/agent-skills/stripe-pwa-elements/SKILL.md`](https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/.well-known/agent-skills/stripe-pwa-elements/SKILL.md) | The skill at the path the discovery index points to |
|
|
355
|
+
|
|
327
356
|
## Contribution
|
|
328
357
|
|
|
329
358
|
### Getting Started
|
|
@@ -345,6 +374,30 @@ To run the unit tests for the components, run:
|
|
|
345
374
|
npm test
|
|
346
375
|
```
|
|
347
376
|
|
|
377
|
+
### Real-browser checks against Stripe test mode
|
|
378
|
+
|
|
379
|
+
`e2e/stripe/` holds Playwright checks that drive the built components in Chromium against the real Stripe.js, in Stripe **test mode**. They use the docs site's demo API (`https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/api`) for the `pk_test_` key and for new PaymentIntents, so no keys are needed. They need network access to `js.stripe.com` and to that API, so they are not part of CI.
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
pnpm run build # the harness serves www/build
|
|
383
|
+
pnpm exec playwright install chromium # once, if Playwright has no Chromium yet
|
|
384
|
+
pnpm run test:e2e:stripe
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
- The harness is served on `http://localhost:4321`, an origin the demo API allows. Set `STRIPE_E2E_PORT` only if the demo API allows that origin too.
|
|
388
|
+
- To use an already installed Chromium, set `PLAYWRIGHT_BROWSERS_PATH`, or point `STRIPE_E2E_CHROMIUM_PATH` at the executable.
|
|
389
|
+
- Traces and screenshots of failed tests go to `test-reports/stripe-e2e/`.
|
|
390
|
+
- Type-check the suite with `pnpm exec tsc -p e2e/stripe/tsconfig.json`.
|
|
391
|
+
|
|
392
|
+
To add a check: add a scenario to `e2e/stripe/*.pw.ts` using `PaymentSheetHarness` (`e2e/stripe/support/payment-sheet.ts`) and the demo API helpers (`e2e/stripe/support/demo-api.ts`). Element options and attributes go through `harness.mount({ publishableKey, clientSecret, options, attributes })`. For a different page, add an HTML file to `e2e/stripe/pages/` that exposes the same `window.harness` contract and open it with `harness.goto('/e2e/<file>.html')`.
|
|
393
|
+
|
|
394
|
+
### Keep the Agent Skill up to date
|
|
395
|
+
|
|
396
|
+
When you add, rename or remove a component, or change its props, events, methods or how it is loaded,
|
|
397
|
+
update the Agent Skill in [`plugins/stripe-pwa-elements/skills/stripe-pwa-elements/`](./plugins/stripe-pwa-elements/skills/stripe-pwa-elements/)
|
|
398
|
+
in the same pull request. `src/agent-skill.unit.spec.ts` fails when the skill's component tags,
|
|
399
|
+
CDN bundle path or i18n languages no longer match the code.
|
|
400
|
+
|
|
348
401
|
## Security & PCI DSS SAQ-A
|
|
349
402
|
|
|
350
403
|
Card data **never** passes through this library's DOM, JavaScript state, or network requests.
|