Skip to content

Commit 3eedc68

Browse files
Add TS types for Bancontact/giropay/P24/EPS (stripe#66)
* confirmBancontactPayment types and tests * confirmEpsPayment types and tests * confirmGiropayPayment types and tests * confirmP24Payment types and tests
1 parent 91c36fb commit 3eedc68

File tree

3 files changed

+305
-0
lines changed

3 files changed

+305
-0
lines changed

tests/types/index.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,21 @@ stripe.confirmAuBecsDebitPayment('', {payment_method: ''});
356356

357357
stripe.confirmAuBecsDebitPayment('');
358358

359+
stripe.confirmBancontactPayment('', {
360+
payment_method: {billing_details: {name: 'Jenny Rosen'}},
361+
return_url: window.location.href,
362+
});
363+
364+
stripe.confirmBancontactPayment('', {payment_method: ''});
365+
366+
stripe.confirmBancontactPayment(
367+
'',
368+
{payment_method: ''},
369+
{handleActions: false}
370+
);
371+
372+
stripe.confirmBancontactPayment('');
373+
359374
stripe
360375
.confirmCardPayment('', {
361376
payment_method: {card: cardElement, billing_details: {name: ''}},
@@ -372,6 +387,17 @@ stripe.confirmCardPayment('');
372387

373388
stripe.confirmCardPayment('');
374389

390+
stripe.confirmEpsPayment('', {
391+
payment_method: {billing_details: {name: 'Jenny Rosen'}},
392+
return_url: window.location.href,
393+
});
394+
395+
stripe.confirmEpsPayment('', {payment_method: ''});
396+
397+
stripe.confirmEpsPayment('', {payment_method: ''}, {handleActions: false});
398+
399+
stripe.confirmEpsPayment('');
400+
375401
stripe.confirmFpxPayment('', {
376402
payment_method: {fpx: fpxBankElement},
377403
return_url: window.location.href,
@@ -385,6 +411,17 @@ stripe.confirmFpxPayment('', {payment_method: {fpx: {bank: ''}}});
385411

386412
stripe.confirmFpxPayment('');
387413

414+
stripe.confirmGiropayPayment('', {
415+
payment_method: {billing_details: {name: 'Jenny Rosen'}},
416+
return_url: window.location.href,
417+
});
418+
419+
stripe.confirmGiropayPayment('', {payment_method: ''});
420+
421+
stripe.confirmGiropayPayment('', {payment_method: ''}, {handleActions: false});
422+
423+
stripe.confirmGiropayPayment('');
424+
388425
stripe.confirmIdealPayment('', {
389426
payment_method: {ideal: idealBankElement},
390427
return_url: window.location.href,
@@ -398,6 +435,17 @@ stripe.confirmIdealPayment('', {payment_method: {ideal: {bank: ''}}});
398435

399436
stripe.confirmIdealPayment('');
400437

438+
stripe.confirmP24Payment('', {
439+
payment_method: {billing_details: {email: 'jenny@example.com'}},
440+
return_url: window.location.href,
441+
});
442+
443+
stripe.confirmP24Payment('', {payment_method: ''});
444+
445+
stripe.confirmP24Payment('', {payment_method: ''}, {handleActions: false});
446+
447+
stripe.confirmP24Payment('');
448+
401449
stripe.confirmSepaDebitPayment('', {
402450
payment_method: {
403451
sepa_debit: ibanElement,

types/stripe-js/index.d.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ declare module '@stripe/stripe-js' {
6060
data?: ConfirmAuBecsDebitPaymentData
6161
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
6262

63+
/**
64+
* Use `stripe.confirmBancontactPayment` in the [Bancontact Payments with Payment Methods](https://stripe.com/docs/payments/bancontact#web) flow when the customer submits your payment form.
65+
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
66+
* Once authorization is complete, the customer will be redirected back to your specified `return_url`.
67+
*
68+
* When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
69+
* In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
70+
* If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
71+
*
72+
* @docs https://stripe.com/docs/js/payment_intents/confirm_bancontact_payment
73+
*/
74+
confirmBancontactPayment(
75+
clientSecret: string,
76+
data?: ConfirmBancontactPaymentData,
77+
options?: ConfirmBancontactPaymentOptions
78+
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
79+
6380
/**
6481
* Use `stripe.confirmCardPayment` when the customer submits your payment form.
6582
* When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide and carry out 3DS or other next actions if they are required.
@@ -78,6 +95,23 @@ declare module '@stripe/stripe-js' {
7895
options?: ConfirmCardPaymentOptions
7996
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
8097

98+
/**
99+
* Use `stripe.confirmEpsPayment` in the [EPS Payments with Payment Methods](https://stripe.com/docs/payments/eps#web) flow when the customer submits your payment form.
100+
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
101+
* Once authorization is complete, the customer will be redirected back to your specified `return_url`.
102+
*
103+
* When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
104+
* In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
105+
* If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
106+
*
107+
* @docs https://stripe.com/docs/js/payment_intents/confirm_eps_payment
108+
*/
109+
confirmEpsPayment(
110+
clientSecret: string,
111+
data?: ConfirmEpsPaymentData,
112+
options?: ConfirmEpsPaymentOptions
113+
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
114+
81115
/**
82116
* Use `stripe.confirmFpxPayment` in the [FPX Payments with Payment Methods](https://stripe.com/docs/payments/fpx#web) flow when the customer submits your payment form.
83117
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
@@ -95,6 +129,23 @@ declare module '@stripe/stripe-js' {
95129
options?: ConfirmFpxPaymentOptions
96130
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
97131

132+
/**
133+
* Use `stripe.confirmGiropayPayment` in the [giropay Payments with Payment Methods](https://stripe.com/docs/payments/giropay#web) flow when the customer submits your payment form.
134+
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
135+
* Once authorization is complete, the customer will be redirected back to your specified `return_url`.
136+
*
137+
* When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
138+
* In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
139+
* If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
140+
*
141+
* @docs https://stripe.com/docs/js/payment_intents/confirm_giropay_payment
142+
*/
143+
confirmGiropayPayment(
144+
clientSecret: string,
145+
data?: ConfirmGiropayPaymentData,
146+
options?: ConfirmGiropayPaymentOptions
147+
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
148+
98149
/**
99150
* Use `stripe.confirmIdealPayment` in the [iDEAL Payments with Payment Methods](https://stripe.com/docs/payments/ideal) flow when the customer submits your payment form.
100151
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
@@ -112,6 +163,23 @@ declare module '@stripe/stripe-js' {
112163
options?: ConfirmIdealPaymentOptions
113164
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
114165

166+
/**
167+
* Use `stripe.confirmP24Payment` in the [Przelewy24 Payments with Payment Methods](https://stripe.com/docs/payments/p24#web) flow when the customer submits your payment form.
168+
* When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to the authorize the transaction.
169+
* Once authorization is complete, the customer will be redirected back to your specified `return_url`.
170+
*
171+
* When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
172+
* In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you.
173+
* If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
174+
*
175+
* @docs https://stripe.com/docs/js/payment_intents/confirm_p24_payment
176+
*/
177+
confirmP24Payment(
178+
clientSecret: string,
179+
data?: ConfirmP24PaymentData,
180+
options?: ConfirmP24PaymentOptions
181+
): Promise<{paymentIntent?: PaymentIntent; error?: StripeError}>;
182+
115183
/**
116184
* Use `stripe.confirmSepaDebitPayment` in the [SEPA Direct Debit Payments](https://stripe.com/docs/payments/sepa-debit) with Payment Methods flow when the customer submits your payment form.
117185
* When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide.

0 commit comments

Comments
 (0)