#jandom-ib_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. Thank you for your patience!
âąď¸ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
đ 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/1212997692326940693
đ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
To clarify , we are using payment_behavior's attribute default value.
Hi, I am terribly sorry, we somehow missed this thread. Let me help you with this now.
First of all, you can access the PaymentIntent of the first Invoice by expanding it in the POST /v1/subscriptions response: expand: ["latest_invoice.payment_intent"], and access it via Subscription.latest_invoice.payment_intent.client_secret. No need for an additional GET call: https://docs.stripe.com/billing/subscriptions/build-subscriptions?ui=elements#create-subscription
Now, in some cases, the first Invoice will be $0 and therefore contain no PaymentIntent, because no payment is required.
One of such cases is if the Subscription starts with a trial. Was it the case for you?
Instead, in those situations, the Subscription will automatically create a SetupIntent, to collect a Payment Method for future Invoices. It is accessible via pending_setup_intent: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent
You can then use the pending_setup_intent.client_secret as you would with PaymentIntent client secret, except you will need to call confirmSetup() on your frontend: https://docs.stripe.com/js/setup_intents/confirm_setup
You can read more about SetupIntents here: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
Overall, it's best to expand both: expand: ["latest_invoice.payment_intent", "pending_setup_intent"], and use the client_secret of the object that's present, depending on the situation.
One note, there's a know bug with Subscription Schedules, where it doesn't create a pending_setup_intent automatically. It's best to then create a regular Subscription and then turn it into a Subscription Schedule with from_subscription property: https://docs.stripe.com/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
I hope this helps.
I will have to close the thread after some time, but feel free to create a new one, and one of my colleagues will pick it up quickly.
Hi, this is huge help. Thanks very much!
Happy to help. Sorry for delay again, this is not the experience we usually strive to provide.