#fredguest-apm-future-usage

1 messages ยท Page 1 of 1 (latest)

open stagBOT
livid current
#

Hello ๐Ÿ‘‹
As far as I know, the elements won't render the PaymentMethod type if it doesn't support setup_future_usage parameter.

lean juniper
#

Ah, I was afraid of that. So if you create a PaymentIntent using setup_future_usage, the possible automatically generated payment method types will reduced, so for example wallets like Apple Pay or Google Pay will never be displayed to the user.

livid current
#

I believe the wallets are considered as cards so they should show up ๐Ÿค”

#

However, Apple does recommend having the user present for Apple Pay transactions if its not related to a subscription. So you may see declines but it is possible.

lean juniper
#

But in general, using setup_future_usage when the PaymentIntent is created will reduce the possible options that automatic_payment_methods will display to the user, correct?

livid current
#

yes that's correct

#

fredguest-apm-future-usage

lean juniper
#

Got it. So what is the recommended implementation if you want to use automatic_payment_methods to display ALL possible payment method types to the user, and then IF they happen to choose a payment method that does support setup_future_usage, add setup_future_usage to that same PaymentIntent?

warped kernel
#

@lean juniper you need to pass setup_future_usage in payment_method_options for the ones you care about

lean juniper
#

Oh perfect! So just to make sure I understand correctly, the following code:

const paymentIntent = await stripe.paymentIntents.create({
  customer: customer.id,
  amount: 1099,
  currency: 'usd',
  automatic_payment_methods: {
    enabled: true,
  },
  payment_method_options: {
    card: {
      setup_future_usage: 'off_session'
    }
  }
});

will display ALL possible payment method types to the user, even types that don't support setup_future_usage, and then IF the user happens to pay with a card type, then setup_future_usage will be in effect for that PaymentIntent, correct?

warped kernel
#

yes!

lean juniper
#

Awesome! Good API design ๐Ÿ‘