#ahhim_unexpected
1 messages · Page 1 of 1 (latest)
👋 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/1395680141539147898
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
in the latest API version, the PaymentIntent is no longer included in the Invoice object.
what are you trying to do exactly? get the client secret of the PaymentIntent? or get the PaymentIntent itself?
I need the client secret to be exact. Do I not need the payment_intent object to get the client secret?😲
Btw thanks for answering!
got it, and last question: which API version are you using?
also it's expected you don't get a PaymentIntent if you are using a free trial. instead you should use the pending_setup_intent in the subscription: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent
I am not exactly sure, but it is probably 12.2.0? As I saw this number stated as folder name. I downloaded it on 30/5/2025. Thanks!
that's not an API version. you can see it listed here: https://dashboard.stripe.com/test/workbench/overview
subscription = stripe.Subscription.create( customer=customer_id, items=[{"price": price_id}], # collection_method="charge_automatically", default_payment_method=payment_method_id, # trial_period_days=trial_days, # payment_behavior="default_incomplete", # Use default_incomplete to handle payment authentication expand=["latest_invoice.payment_intent"] )
This is how I define create subscription
can yuo replace this: expand=["latest_invoice.payment_intent"] with this: expand=["pending_setup_intent"] with this? and the SetupIntent will contain a client secret.
since you use a trial, there's nothing to pay upfront. and if there's nothign to pay, as expected there's no PaymentIntent.
It's the latest 2025-06-39.basil version!
got it! so in this version, even if you didn't use a free trial, you wouldn't see the PaymentIntent either. you would need to expand latest_invoice.confirmation_secret instead (if you didn't use a free trial) to get the client secret.
I just tried this but the "pending_setup_intent" is null 😭
can you share the Subscription ID (sub_xxx)?
Sure just a sec.
sub_1Rm9gSIq5ykFnKUPsauJh9J6
Sorry I think I am actually using 2022-11-15 version instead of 2025-06-30 version. Really sorry for the confusion...🙇🏻
okay. so you actually did use 2025-05-28.basil for that API request. however you didn't set any free trials, so there is an amount to pay on the first invoice!
so in this case there's no pending_setup_intent as expected.
instead you need to expand latest_invoice.confirmation_secret
Ohhhhh. This worked!!😭 Thank you so much! I literally have been trying to solve this for the whole afternoon...
I recommend reading our doc that covers all of this: https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements
May I know does the version of this changes for each API request?
Thanks! Will definitely take a look!
looks like you are usingthe stripe-pythong SDK version 12.2.x, which automatically set the API version to the latest version for you.
Does this kind of changes (e.g. payment intent no longer exist under invoice) happen often? Since I plan to use it in production environment, changes like this could break the code 🤔 Is it possible for me to just keep using the same version?
every time you update your SDK, there may be breaking changes. you'll need to read https://docs.stripe.com/changelog to learn more about this
so if I don't update my SDK, it should stay the same version even for the API, right?
yes
Thanks!
last question, I also want to deal with payment that require extra authenication as well. I believe I will have to return a property called "next_action" under payment_intent is legacy version, I am guessing this has been changed as well. May I ask where would it be in version 2025-05-28.basil?
Stripe handles authentication for you, you shouldn't need to do anything.
you can try some of our 3DS test cards to see how it works in test mode: https://docs.stripe.com/testing#authentication-and-setup
Got it! Thanks a lot! You really are a life saver!🥹
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
Thanks! I am not very familiar with the latest version that I am using (as most documentation I read are for the legacy version). I would like to ask is there extra steps that are required for 3DS required cards? Soma mentioned that I do not have to do anything but how exactly does it work? Thanks in advance for answering!