#fredguest-apm-future-usage
1 messages ยท Page 1 of 1 (latest)
Hello ๐
As far as I know, the elements won't render the PaymentMethod type if it doesn't support setup_future_usage parameter.
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.
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.
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?
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?
@lean juniper you need to pass setup_future_usage in payment_method_options for the ones you care about
For example: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_options-card-setup_future_usage
you pass that to save a card. You don't pass it for the ones that don't support it
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?
yes!
Awesome! Good API design ๐