#kado-kaelan-subscription-trial

1 messages ยท Page 1 of 1 (latest)

mental stone
#

Where are you trying to access that client secret?

brazen slate
#

subscription.latest_invoice.payment_intent.client_secret,

#

this worked before i added trial_period

#

I looked in the subscription object and couldnt find it anywhere. may have missed it though

mental stone
#

If you have a trial there is no payment due immediately, so there is no payment intent on the trial invoice.

Instead, the subscription should have a pending_setup_intent with a client_secret you can use with confirmCardSetup

brazen slate
#

got it, so instead of using confirmCardPayment I use confirmCardSetup. and will charging the card be taken care of on your side? or do I have to set up a webhook

mental stone
#

like that, but based on the successful setup intent

#

you can do this by listening to webhooks, or from the response from confrimCardSetup. We recommend webhooks, but it's up to you.

brazen slate
#

gotcha thanks! let me give this a try

#

I see this

#

thats the client_secret?

mental stone
#

That's the setup intent -- when you create the subscription you can expand it like you're doing wiht the invoice & payment intent

brazen slate
#

ahhhh got it!

mental stone
#

Are you all set here, or need more help?

brazen slate
#

I've gotten to the point where a customer is created, subscription is created with trial and associated with customer, card payment is collected

#

now they will be billed at end of trial correct? unless they cancel

#

and those two actions can be handled with webhooks?

mental stone
#

assuming you set the default payment method, then yes

#

(note there is always the chance they hit an extra 3ds authentication and you'll need a recovery flow for that)

#

and those two actions can be handled with webhooks?

which tow actions, specifically?

brazen slate
#

subscription cancellation and the user payment confirmation

mental stone
#

Gotcha. The cancellation has a webhook, yes: customer.subscription.deleted https://stripe.com/docs/api/events/types#event_types-customer.subscription.deleted
and you can use Stripes automatic help for invoice payment recovery: https://stripe.com/docs/invoicing/automatic-collection
but if you need to manage payment authentication yourself: invoice.payment_action_required (or payment_failed) https://stripe.com/docs/api/events/types#event_types-invoice.payment_action_required

Learn about Stripe's automatic recovery features.

brazen slate
#

Awesome, thanks for all the help. AMAZING service! I'm going to set the default payment method, look into 3d authentication, and webhooks

mental stone
#

You're very welcome! Glad I was able to help ๐Ÿ™‚