From a9acb48fc6fd45463b5f25ca0ecf3a83624fb00b Mon Sep 17 00:00:00 2001 From: Sebastian Rindom Date: Sun, 30 Oct 2022 14:32:00 +0200 Subject: [PATCH] feat(stripe): Support automatic payment methods (#2492) --- packages/medusa-payment-stripe/README.md | 5 +++++ .../medusa-payment-stripe/src/services/stripe-provider.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/packages/medusa-payment-stripe/README.md b/packages/medusa-payment-stripe/README.md index 78b2ed7ee0..a52504cac4 100644 --- a/packages/medusa-payment-stripe/README.md +++ b/packages/medusa-payment-stripe/README.md @@ -10,5 +10,10 @@ Learn more about how you can use this plugin in the [documentaion](https://docs. { api_key: "STRIPE_API_KEY", webhook_secret: "STRIPE_WEBHOOK_SECRET", + automatic_payment_methods: true } ``` + +## Automatic Payment Methods + +If you wish to use [Stripe's automatic payment methods](https://stripe.com/docs/connect/automatic-payment-methods) set the `automatic_payment_methods` flag to true. diff --git a/packages/medusa-payment-stripe/src/services/stripe-provider.js b/packages/medusa-payment-stripe/src/services/stripe-provider.js index f9a38b23ab..b3f96e1803 100644 --- a/packages/medusa-payment-stripe/src/services/stripe-provider.js +++ b/packages/medusa-payment-stripe/src/services/stripe-provider.js @@ -148,6 +148,10 @@ class StripeProviderService extends AbstractPaymentService { metadata: { cart_id: `${cart.id}` }, } + if (this.options_?.automatic_payment_methods) { + intentRequest.automatic_payment_methods = { enabled: true } + } + if (customer_id) { const customer = await this.customerService_ .withTransaction(this.manager_)