diff --git a/tests/types/src/valid.ts b/tests/types/src/valid.ts index 664fd0a..a7f7145 100644 --- a/tests/types/src/valid.ts +++ b/tests/types/src/valid.ts @@ -2004,6 +2004,24 @@ stripe ) .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); +stripe + .confirmMultibancoPayment('', { + payment_method: {billing_details: {email: 'jenny@example.com'}}, + }) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmMultibancoPayment('', {payment_method: ''}) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmMultibancoPayment('', {payment_method: ''}, {handleActions: false}) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmMultibancoPayment('') + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + stripe .confirmOxxoPayment('', {payment_method: ''}) .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); @@ -2256,6 +2274,25 @@ stripe .confirmSofortPayment('', {}, {handleActions: false}) .then(({paymentIntent}: {paymentIntent?: PaymentIntent}) => {}); +stripe + .confirmTwintPayment('', { + payment_method: {billing_details: {name: 'Jenny Rosen'}}, + return_url: window.location.href, + }) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmTwintPayment('', {payment_method: ''}) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmTwintPayment('', {payment_method: ''}, {handleActions: false}) + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + +stripe + .confirmTwintPayment('') + .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); + stripe .confirmWechatPayPayment('', {}, {handleActions: false}) .then((result: {paymentIntent?: PaymentIntent; error?: StripeError}) => null); diff --git a/types/stripe-js/payment-intents.d.ts b/types/stripe-js/payment-intents.d.ts index 507937f..eb62d7c 100644 --- a/types/stripe-js/payment-intents.d.ts +++ b/types/stripe-js/payment-intents.d.ts @@ -269,6 +269,21 @@ export interface CreatePaymentMethodMobilepayData type: 'mobilepay'; } +export interface CreatePaymentMethodMultibancoData + extends PaymentMethodCreateParams { + type: 'multibanco'; + + /** + * The customer's billing details. + * `email` is required. + * + * @docs https://stripe.com/docs/api/payment_methods/create#create_payment_method-billing_details + */ + billing_details: PaymentMethodCreateParams.BillingDetails & { + email: string; + }; +} + export interface CreatePaymentMethodOxxoData extends PaymentMethodCreateParams { type: 'oxxo'; @@ -370,6 +385,11 @@ export interface CreatePaymentMethodSofortData billing_details?: PaymentMethodCreateParams.BillingDetails; } +export interface CreatePaymentMethodTwintData + extends PaymentMethodCreateParams { + type: 'twint'; +} + export interface CreatePaymentMethodAuBecsDebitData extends PaymentMethodCreateParams { /** @@ -1076,6 +1096,36 @@ export interface ConfirmMobilepayPaymentOptions { handleActions?: boolean; } +/** + * Data to be sent with a `stripe.confirmMultibancoPayment` request. + * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. + */ +export interface ConfirmMultibancoPaymentData + extends PaymentIntentConfirmParams { + /** + * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with. + * This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`. + * + * @recommended + */ + payment_method?: string | Omit; + + /** + * The url your customer will be directed to after they complete authentication. + * + * @recommended + */ + return_url?: string; +} + +export interface ConfirmMultibancoPaymentOptions { + /** + * Set this to `false` if you want to [manually handle the authorization redirect](https://stripe.com/docs/payments/sofort/accept-a-payment?platform=web#handle-redirect). + * Default is `true`. + */ + handleActions?: boolean; +} + /** * Data to be sent with a `stripe.confirmOxxoPayment` request. * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. @@ -1278,6 +1328,35 @@ export interface ConfirmSofortPaymentOptions { handleActions?: boolean; } +/** + * Data to be sent with a `stripe.confirmTwintPayment` request. + * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. + */ +export interface ConfirmTwintPaymentData extends PaymentIntentConfirmParams { + /** + * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with. + * This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`. + * + * @recommended + */ + payment_method?: string | Omit; + + /** + * The url your customer will be directed to after they complete authentication. + * + * @recommended + */ + return_url?: string; +} + +export interface ConfirmTwintPaymentOptions { + /** + * Set this to `false` if you want to [manually handle the authorization redirect](https://stripe.com/docs/payments/sofort/accept-a-payment?platform=web#handle-redirect). + * Default is `true`. + */ + handleActions?: boolean; +} + /** * Data to be sent with a `stripe.confirmWechatPayPayment` request. * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters. diff --git a/types/stripe-js/stripe.d.ts b/types/stripe-js/stripe.d.ts index a1c296f..b3ea005 100644 --- a/types/stripe-js/stripe.d.ts +++ b/types/stripe-js/stripe.d.ts @@ -437,6 +437,24 @@ export interface Stripe { options?: paymentIntents.ConfirmMobilepayPaymentOptions ): Promise; + /** + * Use `stripe.confirmMultibancoPayment` in the [Multibanco Payment](https://stripe.com/docs/payments/multibanco) with Payment Methods flow when the customer submits your payment form. + * When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide. + * Note that there are some additional requirements to this flow that are not covered in this reference. + * Refer to our [integration guide](https://stripe.com/docs/payments/multibanco) for more details. + * + * When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods). + * In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you. + * If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. + * + * @docs https://stripe.com/docs/js/payment_intents/confirm_multibanco_payment + */ + confirmMultibancoPayment( + clientSecret: string, + data?: paymentIntents.ConfirmMultibancoPaymentData, + options?: paymentIntents.ConfirmMultibancoPaymentOptions + ): Promise; + /** * Use `stripe.confirmOxxoPayment` in the [OXXO Payment](https://stripe.com/docs/payments/oxxo) with Payment Methods flow when the customer submits your payment form. * When called, it will confirm the [PaymentIntent](https://stripe.com/docs/api/payment_intents) with `data` you provide. @@ -579,6 +597,23 @@ export interface Stripe { options?: paymentIntents.ConfirmSofortPaymentOptions ): Promise; + /** + * Use `stripe.confirmTwintPayment` in the [TWINT Payments with Payment Methods](https://stripe.com/docs/payments/twint) flow when the customer submits your payment form. + * When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction. + * Once authorization is complete, the customer will be redirected back to your specified `return_url`. + * + * When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods). + * In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new `PaymentMethod` for you. + * If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data. + * + * @docs https://stripe.com/docs/js/payment_intents/confirm_twint_payment + */ + confirmTwintPayment( + clientSecret: string, + data?: paymentIntents.ConfirmTwintPaymentData, + options?: paymentIntents.ConfirmTwintPaymentOptions + ): Promise; + /** * Requires beta access: * Contact [Stripe support](https://support.stripe.com/) for more information.