#dragon.frost
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
Yes, when there's a trial period, there's nothing to pay immediately, so there's no Invoice and no PaymentIntent. What you get instead is a pending_setup_intent that you can use to collect the Payment Method for future use - it will be charged when the trial ends.
so do we have to use the setup intent API as well for this?
The SetupIntent is created for you, you just need to confirm it on the frontend.
do I have to add additional parameters in the "expand" property?
Yes, it's good to expand the pending_setup_intent to get the client_secret that you will use on the frontend to confirm the SetupIntent.
If I have a trial period and both pending_setup_intent and latest_invoice.payment_intent returns a client secret then which client secret should I pass on to the frontend?
You would only get one of those.
I'm getting both right now while testing. I'm fetching them like this:
const latestInvoice = stripeSubscription.latest_invoice as Stripe.Invoice;
const setupIntent = stripeSubscription.pending_setup_intent as Stripe.SetupIntent;
can there be a reason why this can happen?
Could you please share the Subscription ID?
'sub_1NuYNcAm3EUKVZDomUmAjmdj'
I see that the latest_invoice has amount of 0, and therefore, no payment_intent
You can still expand both ["pending_setup_intent", "latest_invoice.payment_intent"] and see what's available for a given Subscription. In this case, you should use the pending_setup_intent.client_secret
so if pending_setup_intent.client_secret is available it should take precendance?
Hey! Taking over for my colleague. Yes and you collect the PaymentMethod of the customer using that setup_intent's secret
ok thank you for your help.