diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 1b31b9ab92ee23..4bf080a2deafd3 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -13902,6 +13902,14 @@ declare namespace Stripe { readonly detail?: any; readonly params?: string; readonly type: string; + readonly statusCode?: number; + + readonly charge?: string; + readonly decline_code?: string; + readonly payment_intent?: paymentIntents.IPaymentIntent; + readonly payment_method?: paymentMethods.IPaymentMethod; + readonly setup_intent?: setupIntents.ISetupIntent; + readonly source?: sources.ISource; } class StripeCardError extends StripeError { readonly type: 'StripeCardError'; diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 7d8fca1502cb18..1713a262c57dc6 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -2065,6 +2065,30 @@ stripe.charges if (err instanceof Stripe.errors.StripeCardError) { const type = err.type; } + + if (err instanceof Stripe.errors.StripeError) { + if (err.charge) { + const charge: string = err.charge; + } + if (err.payment_intent) { + const payment_intent: Stripe.paymentIntents.IPaymentIntent = err.payment_intent; + } + if (err.payment_method) { + const payment_method: Stripe.paymentMethods.IPaymentMethod = err.payment_method; + } + if (err.setup_intent) { + const setup_intent: Stripe.setupIntents.ISetupIntent = err.setup_intent; + } + if (err.source) { + const source: Stripe.sources.ISource = err.source; + } + if (err.decline_code) { + const decline_code: string = err.decline_code; + } + if (err.statusCode) { + const statusCode: number = err.statusCode; + } + } }); //#endregion Errors