From d91639eff2358a962958ecc86dfa28175ef4fc51 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Thu, 18 Jul 2019 21:05:57 +0200 Subject: [PATCH] [stripe-v3] Add typings for paymentRequestButton.on('paymentmethod') (#36871) * [stripe-v3] Add typings for paymentRequestButton.on('paymentmethod') Relevant documentation: https://stripe.com/docs/stripe-js/reference#payment-response-object * Update index.d.ts * Fix linting error --- types/stripe-v3/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/stripe-v3/index.d.ts b/types/stripe-v3/index.d.ts index 3aa0607bdd..1c6775aab7 100644 --- a/types/stripe-v3/index.d.ts +++ b/types/stripe-v3/index.d.ts @@ -623,12 +623,17 @@ declare namespace stripe { source: Source; } + interface StripePaymentMethodPaymentResponse extends StripePaymentResponse { + paymentMethod: paymentMethod.PaymentMethod; + } + interface StripePaymentRequest { canMakePayment(): Promise<{ applePay?: boolean } | null>; show(): void; update(options: StripePaymentRequestUpdateOptions): void; on(event: 'token', handler: (response: StripeTokenPaymentResponse) => void): void; on(event: 'source', handler: (response: StripeSourcePaymentResponse) => void): void; + on(event: 'paymentmethod', handler: (response: StripePaymentMethodPaymentResponse) => void): void; on(event: 'cancel', handler: () => void): void; on(event: 'shippingaddresschange', handler: (response: { updateWith: (options: UpdateDetails) => void, shippingAddress: ShippingAddress }) => void): void; on(event: 'shippingoptionchange', handler: (response: { updateWith: (options: UpdateDetails) => void, shippingOption: ShippingOption }) => void): void;