#abu-zain_webhooks

1 messages ยท Page 1 of 1 (latest)

pure hedgeBOT
#

๐Ÿ‘‹ 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/1290393243044937862

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

lone vigil
#

I am integrating Stripe hooks, and this is what I am expecting:

I am allowing users to subscribe to any subscription, and they can visit the customer portal to update the payment method, change the plan, or cancel the subscription. Here is what I am currently doing:

I am listening to the checkout.session.completed event, extracting details like current_period_end, current_period_start, status, customerId, and subscriptionId, and updating the user based on the email that I set while creating the checkout session.

For the above status, I handle the case when the user subscribes to a subscription, and I am listening to the invoice.paid event to set the invoice status to paid.

To handle the payment failure case, I am listening to the invoice.payment_failed event, setting the invoice status to the one provided by Stripe, and updating the subscriptionStatus.

I am also listening to the customer.subscription.updated event in case the user updates their plan, and extracting details like:

  • subscriptionId
  • planName
  • current_period_start
  • current_period_end
  • status

Then I update the user accordingly.

Additionally, I am listening to the customer.subscription.deleted event to handle the case when the user cancels their plan.

Now, my concern is handling recurring payment failures. For this, I am listening to the invoice.payment_failed event, but I am not receiving this event. Instead, I am getting these events:

  • customer.subscription.updated
  • customer.subscription.updated
  • invoice.created
  • checkout.session.expired
sudden canyon
#

we received a 200 response from your Stripe CLI endpoints

lone vigil
#

sorry my bad i was looking into the wrong subscription.

sudden canyon
#

all good!

lone vigil
#

There is one more thing I would like to ask. I am testing the webhooks integration. Would you mind reviewing my current webhooks implementation and letting me know if I am missing something or doing anything wrong?

sudden canyon
lone vigil
#

Yes, I have checked all of those, but there are a few things that I couldn't find there.

For example, I am listening to the invoice.payment_failed event, and here I am updating the user data, such as subscription status and invoice status. However, this event is also triggered when the checkout fails during the initial subscription. How can I differentiate whether this event is triggered by a recurring payment failure or by the initial failure during subscription?

sudden canyon
lone vigil
#

Great thank you i solved it by adding check subscription_create

sudden canyon
#

๐Ÿ‘

lone vigil
#

One more thing: is it possible to manually update the billing cycle of a subscription by using the stripe dashobard? For example, I want to test which events will be triggered when a subscription enters a new billing period for testing purposes
@sudden canyon

sudden canyon
#

Yeah you can use test clocks via dashboard