#jayy26

1 messages · Page 1 of 1 (latest)

narrow siloBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

  • jayy26, 46 minutes ago, 11 messages
  • jayy26, 3 days ago, 7 messages
shrewd cedar
#

I am trying to fix the flow issue that as was mentioned in the previous thread, creating the subscription which will have the setup intent.. but got the error above ..

high dust
#

Hi, let me help you with this.

#

And what would you like to achieve on the high level?

shrewd cedar
#

In my previous thread i was asking what would be the ideal way to handle payment method changes from a customer
I wrote a quick summary of our flow which is aas follows:

I add the user to stripe if they're not listed there already,
I create a setup intent for user to add their payment method
create the subscription and charge it using the payment method ID provided from stripe.
basically:

await stripe.subscriptions.create({
      customer: customerId,
      items,
      coupon: promoCode,
      default_payment_method: paymentId,
    })

Your colleague mentioned this is a bad flow and to create the subscription first and use the setup intent from that to add the payment method.

#

req_immJ7g5vMFs5Ki

high dust
#

Ok, you need to either set the default_payment_method when creating the Subscription or set invoice_settings.default_payment_method on the Customer

shrewd cedar
#

ok but how would i get the default payment method if the customer hasn't set it up yet? I usually do a setupIntent

checkout.sessions.create({
      mode: 'setup',
      success_url: successUrl,
      cancel_url: cancelUrl,
      customer: stripeId,
      payment_method_types: ['card'],
    });

which after the payment method is added, i use the webhooks to record the default payment method id and use it, then stripe redirects to my processing payment page which will run the create subscription

#

just trying to resolve the "bad flow" issue basically

high dust
shrewd cedar
#

Can you refer to my other thread please? https://discord.com/channels/841573134531821608/1180083246256627712
I was asking a question regarding changing payment methods on subscriptions, i was told that the flow we currently have is bad as Soma said:

Note that this is a pretty bad flow, since it can result in two 3DS in a row. So we don't recommend doing this.

I'm just trying to find a way to resolve this according to what they recommended

high dust
#

If you set up the Payment Method correctly, it shouldn't require another 3DS when you perform off-session payments

#

Is it working if you specify the default_payment_method?

shrewd cedar
#

yes, but that gets me to my other issue, which is when the user changes their default payment method. do i have to do it for the subscription? or is there a way to have it done on addition of the method??

high dust
#

You have to update the Subscription.default_payment_method or Customer.invoice_sessions.default_payment_method. The former takes precedence.

shrewd cedar
#

and if i use invoice_settings.default_payment_method to set the default payment method on the customer and not include the Subscription.default_payment_method in the subscription when creating it, the subscription will then use the customer's default payment? and updates it accordingly when i update the customer?

high dust
#

Yes

shrewd cedar
#

ok thanks vanya.

high dust
#

Happy to help.