#pedro-reis_api
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/1309559575363715113
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Why not just end the trial early?
That will create the first paid invoice for the sub
And you can use its client secret
I was doing that, however the subscription was getting cancelled immediately because the user doesn't have a payment method
currentl I have the following when adding the subscription to the user:
trial_settings: {
end_behavior: {
missing_payment_method: 'cancel',
},
},
so if the user doesn't add their payment details I want the subscription to cancel at the end of the trial period
but when I try to add a payment method, the subscription get cancelled right away
but when I try to add a payment method, the subscription get cancelled right away
What do you mean by this
You should be able to collect payment method first
Then end trial early
And subscription should not cancel
that's the issue I'm having: I'm trying to figure out the flow for this
I'm using the PaymentElement from Stripe Elements on the frontend
Yeah you can use pending_setup_intent on the subscription: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent
To collect payment method
Before trial ends
then how should my Elements options be? which mode should I use? setup?
and then stripe.confirmSetup()?
i believe this - pending_setup_intent - is an id?
sorry, I've read a lot of documentation but the more I read, the more lost I am
pending_setup_intent is a setup intent id
You need to retrieve it to get its client secret
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, that makes sense
You can follow step 5 and beyond in this guide: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements#collect-payment-details
For how to collect details with elements
via setupintent
ok, I will try that! thank you very much
No problem