#Atish

1 messages · Page 1 of 1 (latest)

safe islandBOT
upbeat cobalt
#

Could you share what your objective is? If you would like to confirm whether the subscription is created and paid successfully for the first invoice, checkout.session.completed event should be sufficient

kind ether
#

I have just two plans: FREE and PRO
For PRO plan user needs to subscribe to pro plan and we have two subscription model: monthly $10 or yearly $100
Once the checkout.session.completed is completed I can upgrade the user to pro plan
I need to know if the payment fails in the next invoice, in that case I need to downgrade the user to free plan again

#

In short, if the user is paying for monthly or yearly subscription he can get access to pro features else he will be using free features

upbeat cobalt
#

I see! checkout.session.completed event is only for initial subscription invoice. It won't be sent for remaining future cycles. If you wish to check for the invoice payment failure for next billing cycle, you may listen to invoice.payment_failed event and apply your custom logic accordingly: https://stripe.com/docs/billing/subscriptions/webhooks#payment-failures

safe islandBOT
kind ether
#

How can I test it right now? Is there any way to send invoice.payment_failed?

lilac island
#

Hi @kind ether I'm taking over

kind ether
#

Thank you!

lilac island
#

You can use Stripe CLI to simulate a invoice.payment_failed event

#

stripe trigger invoice.payment_failed

kind ether
#

Is it the way to trigger?

#

Got it, thank you

#

Also will you please list out the event I need to listen to for the below scenario. Payment is sensitive and I don't want to miss out anything

#
I have just two plans: FREE and PRO
For PRO plan user needs to subscribe to pro plan and we have two subscription model: monthly $10 or yearly $100
Once the checkout.session.completed is completed I can upgrade the user to pro plan
I need to know if the payment fails in the next invoice, in that case I need to downgrade the user to free plan again
In short, if the user is paying for monthly or yearly subscription he can get access to pro features else he will be using free features
lilac island
kind ether
#

Thank you! Also stripe will periodically send the event until 200 response is provided right? In case my service is down, we might miss some events and might encounter some bugs

lilac island
kind ether
#

Also how the subscription ends? Is it related to something like 6 months subscription on monthly basis or when payment fails and current subscription ends?

lilac island
#

The subscription will continue unless you cancel it

#

Or you can use subscription schedule to automatic the process and make the subscription cancelled after 6 months

kind ether
lilac island
#

Yes, this event happens when the subscription is canceled.

kind ether
#

checkout.session.completed
customer.subscription.deleted
invoice.payment_failed

I only found 3 events useful in my context.

lilac island
#

You can listen to the events that you think that's helpful to your application.

kind ether
#

I just cancelled my plan, but got only customer.subscription.updated, when customer.subscription.deleted will be triggered?

lilac island
#

Subscription ID?

kind ether
#

Even if I cancelled now, It will be cancelled on may 19

#

This is the id probably: sub_1MyTmjDfJAkpzIQT4zfzKQ5f

lilac island
#

Share with me the subscription ID so that I can take a look

kind ether
#

sub_1MyTmjDfJAkpzIQT4zfzKQ5f

lilac island
kind ether
#

Is there any way to test all these, by making subscription interval of 5 mins?

lilac island
#

what do mean by a subscription interval of 5 mins?

kind ether
#

I need to test all those webhooks and my code, how can we test it? One option might be to create 5 mins subscription instead of monthly subscription

#

I don't know how to test this code