#krishna-awate_webhooks

1 messages · Page 1 of 1 (latest)

teal pondBOT
#

👋 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/1354678443786109049

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

drowsy creek
drifting onyx
#

Yes I am using that customer.subscription.paused for puase & customer.subscription.resumed for resume but event.type getting is customer.subscription.updated for both

#

When subscription is charged for cycle at that time also I am getting same event. How can I identify which is for resume and which is charged

#

Hello

#

Are you there?

drowsy creek
#

Thanks for waiting! Discord is busy at the moment, and will take some time to reply.

drifting onyx
#

ohh. I will use invoice.paid. How can I know subscription is paused or resume as both have same event i.e. customer.subscription.updated

Shall I depend on pause_collection property?

drowsy creek
#

Is there any reason why you would like to find out why a subscription is paused or resumed using customer.subscription.updated event when there are corresponding events for both actions?

drifting onyx
#

Yes I am using

Pause: customer.subscription.paused event
Resume: customer.subscription.resumed event

but when I pause & resume from dashboard (refrence image attached) I am getting customer.subscription.updated as event type in code not getting customer.subscription.paused for puase & customer.subscription.resumed for resume.

#

There should be event.type like customer.subscription.paused/customer.subscription.resumed

but getting customer.subscription.updated

drowsy creek
#

What is the issue here? It's expected that customer.subscription.updated event will be changed when there is a change on this specific subscription

#

If you're looking for pause and resume related changes, you shouldn't need to handle customer.subscription.updated event since they have corresponding events sent

drifting onyx
#

If i removed customer.subscription.updated from webhook and kept only

Pause: customer.subscription.paused event
Resume: customer.subscription.resumed event

then these events are not being triggered

drowsy creek
#

Do you have the example subscription (sub_xxx) for the situation described?

drifting onyx
#

Yes

sub_1R79TdDBfYojrB0W0iDiLKmL

drowsy creek
#

I don't see any attempt to pause the subscription. That's why no customer.subscription.paused event wasn't triggered.

#

This is expected

drifting onyx
#

Collection paused

#

Isn't it to pause subscription?

drowsy creek
#

Ah! I know what the gap here is.

In https://docs.stripe.com/billing/subscriptions/pause-payment:

Subscriptions with paused collection can’t move into status=paused. Only ending free trial periods without a payment method cause subscriptions to enter a paused status.

In the case when you attempt to set the pause_collection, it doesn't change the subscription status to paused, so no customer.subscription.paused event will be sent.

So yes, you're right - customer.subscription.updated event should be used instead. You can monitor pause_collection field for the flow like this. Take https://dashboard.stripe.com/test/events/evt_1R79ZvDBfYojrB0W0frL6ubS as an example, you can see the changes in pause_collection field by comparing previous_attributes field

drifting onyx
#

Okay but inovice.paid is also not triggering webhook

#

I will handle pause and resume as per pause_collection. Now I want to hit subscription charge webhook for each month. As you told I am using invoice.paid for it but webhook is not being triggerd when event occured.

drowsy creek
#

However, the event delivery failed due to the timeout from your server

drifting onyx
#

I have hit many request but not able to trigger this event.

#

Did not hit webhook. When I charge next invoice.

#

Cancelld event is working

#

Update event is working but invoice.paid not working

drowsy creek
#

Which request/action did you perform?

#

invoice.paid event will only be sent when an open invoice is paid / charged sucessfully

#

There was only one invoice on this subscription

#

And it has been paid

drifting onyx
drowsy creek
#

Which subscription was this?

#

Could yo share the subscription ID (sub_xxx)?

drifting onyx
#

sub_1R79HmDBfYojrB0WIuzq8SnK

#

shall I do for this ---> sub_1R79TdDBfYojrB0W0iDiLKmL

drowsy creek
#
#

They were working expected as what I said that invoice.paid event was sent

drifting onyx
#

Let me check.

one more question, will that event work when subscription is created first time?

#

And will this event hit for one time payment also?

#

I want only that event which will trigger when subscription payment is charged.

drowsy creek
drifting onyx
#

Let me check.

#

Sir, Actully I was getting below data in subscriptio.updated event

subscription_start: sub_data?.start_date,
subscription_end: sub_data?.cancel_at,
next_due: sub_data?.current_period_end,
current_cycle_start: sub_data?.current_period_start,
current_cycle_end: sub_data?.current_period_end,

how can I get this data in invoice.paid

#

Getting empty object in subscription_deatils for event.data.object

drowsy creek
#

Which specific data are you looking at, so that I can recommend how to achieve the same in invoice.paid event?

drifting onyx
#

start_date, cancel_at, current_period_end, current_period_start, current_period_end, plan id, order_id

#

This data I want

drowsy creek
#

What are you going to use these fields start_date, cancel_at, current_period_end, current_period_start for?

drifting onyx
#

For each transaction I want to send email to customer and there is also report in csv. So I want to send this data to customer

drowsy creek
#

Sorry! We are going to need to step away and will be closing this thread now. Discord will be reopened at 13:00 UTC. You can come back later and ask a new question from #help to continue the conversation, otherwise, you can also reach out to Support at https://support.stripe.com/contact