From fb65a58e28b518dcad358ab6fe7f1386a5ba43d1 Mon Sep 17 00:00:00 2001 From: martinalong-stripe <102928571+martinalong-stripe@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:10:16 -0700 Subject: [PATCH] Add onLoadError to card and cardNumber elements (#488) * Add onLoadError to card and cardNumber elements * Run lint --- src/types/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/types/index.ts b/src/types/index.ts index c447732..b02e68d 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -80,6 +80,11 @@ export interface CardElementProps extends ElementProps { * For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_networkschange?type=cardElement). */ onNetworksChange?: (event: {elementType: 'card'}) => any; + + /** + * Triggered when the Element fails to load. + */ + onLoadError?: (event: {elementType: 'card'; error: StripeError}) => any; } export type CardElementComponent = FunctionComponent; @@ -112,6 +117,11 @@ export interface CardNumberElementProps extends ElementProps { * For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_networkschange?type=cardNumberElement). */ onNetworksChange?: (event: {elementType: 'cardNumber'}) => any; + + /** + * Triggered when the Element fails to load. + */ + onLoadError?: (event: {elementType: 'cardNumber'; error: StripeError}) => any; } export type CardNumberElementComponent = FunctionComponent<