#donut_code

1 messages ยท Page 1 of 1 (latest)

violet hearthBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1430471775820709908

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

brave valve
#

hey there, looking into this now

#

ok so it sounds like you're using SetupIntents and subscriptions, but sometimes the payment method isn't set as default

would you be able to share an example where it was, and an example where it wasn't, so we can compare? (either the subscription IDs or SetupIntent IDs are perfect)

shadow tide
#

sub_1SKxOORvd0kOjiXVmtJzmjuM
sub_1SKxODRvd0kOjiXVpKw2Fi0A

brave valve
#

thanks, taking a look at these now

shadow tide
#

is it possible that i should first

#

confirm

#

Setup

#

before creating the subscription

#

?

brave valve
#

it can be either before or after, depending on your integration flow - I'll explain the difference between these two examples ๐Ÿ™‚

#
  1. sub_1SKxOORvd0kOjiXVmtJzmjuM
    a. SetupIntent (seti_1SKxO4Rvd0kOjiXVOyMFNIHK) created via the API before the subscription: https://dashboard.stripe.com/acct_1NkVdERvd0kOjiXV/test/logs/req_k1QY4GOspUHITR
    b. SetupIntent confirmed
    c. Subscription created, passing the payment method ID generated in (b) indefault_payment_method: https://dashboard.stripe.com/acct_1NkVdERvd0kOjiXV/test/logs/req_KYYJ4HYAwDJu2S

  2. sub_1SKxODRvd0kOjiXVpKw2Fi0A
    a. Subscription created before a SetupIntent (not passing default_payment_method): https://dashboard.stripe.com/acct_1NkVdERvd0kOjiXV/test/logs/req_Ixj0gtwVdLMPNi
    b. Stripe automatically generates a pending_setup_intent on the subscription object: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent

#

this can be done after creating the subscription

since you set payment_settings.save_default_payment_method: 'on_subscription', once the pending SetupIntent is confirmed succesfully, the customer's payment method will be set as the default for the subscription

shadow tide
#

so you are saying that 'on_subscription' means that if i confirm setup after creating the subscription it should automatically link the costumers payment method to the subscription but in my case it is not doing that

#

I always call confirm setup after creatingthe subscriptions with ayment_settings.save_default_payment_method: 'on_subscription'

#

but only after i created a subscription with an already confirmed setup the payment method was linked

#

even though it was the same setup intent

brave valve
#

yes exactly, and the reason it's not doing that for the example above is because the pending_setup_intent wasn't confirmed

#

since this subscription is for a customer that already has a card saved (from the previous SetupIntent), it makes more sense to pass default_payment_method when creating the second subscription

shadow tide
#

but this is the same customer in both subscriptions and the setup intent which was confirmed after the first subscription creation

#

why is it pending_setup_intent for the first subscription

brave valve
#

because when a card is saved to a customer, that card isn't automatically set as the default for future subscriptions

you either need to set it in invoice_settings.default_payment_method on the Customer object (to make the card default for all invoices/subscriptions for that customer), or else pass it to default_payment_method explicitly when creating a new subscription

shadow tide
#

ah

#

okay

#

thanks a lot

#

I really appreciate your help

violet hearthBOT