#dragon.frost

1 messages · Page 1 of 1 (latest)

wary ravineBOT
odd ferry
#

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.

mystic cipher
#

so do we have to use the setup intent API as well for this?

odd ferry
#

The SetupIntent is created for you, you just need to confirm it on the frontend.

mystic cipher
#

do I have to add additional parameters in the "expand" property?

odd ferry
#

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.

mystic cipher
#

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?

odd ferry
#

You would only get one of those.

mystic cipher
#

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?

odd ferry
#

Could you please share the Subscription ID?

mystic cipher
#

'sub_1NuYNcAm3EUKVZDomUmAjmdj'

odd ferry
#

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

wary ravineBOT
mystic cipher
#

so if pending_setup_intent.client_secret is available it should take precendance?

vast thistle
#

Hey! Taking over for my colleague. Yes and you collect the PaymentMethod of the customer using that setup_intent's secret

mystic cipher
#

ok thank you for your help.