#caze_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1262440003464724564
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- caze_api, 2 days ago, 12 messages
These are the events my webhook is listening to:
Hi ๐
What have you tested out?
Nothing was triggered on my tests. I bought a plan, and then went on the dashboard and refunded it to the client, but no event triggered
IDK if I did that correctly, just a genuine question to what to do in these cases
When you generated the refund, it should have created a request in your account logs. Can you take a look in your dashoard? If you find it, can you share the request ID here? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Okay, just a moment
/v1/charges/ch_3PYeZ0IcGGZP425o2z2TINNS/refund
req_rVRGtByoFBYLQf
Thanks. Taking a look now
Okay that request generated one event. A charge.refunded event here: https://dashboard.stripe.com/test/events/evt_3PYeZ0IcGGZP425o2tMfWFyz
Oh thats perfect!
Thanks a lot
But in cases where I pause the subscription from the dashboard theres no webhook event generated, right?
No you showd get a customer.subscription.paused event. https://docs.stripe.com/api/events/types#event_types-customer.subscription.paused
Oh thats even nice
I've tried this event before when pausing a subscription via client side, where the user was pausing it manually, not the owner of the dashboard. pausing the payment collection, but this does not trigger a webhook event
Sorry I'm not sure what you mean by that. I would need more requests to identify what you are referring to
I talked with another support member last week
So in cases where I call your api directly to pause it, it does not trigger an webhook, but if I pause it manually (via dashboard) it does trigger
I just paused from the dashboard, can you check if any event was triggered?
req_QMZkhlJLRMGniB
POST /v1/subscriptions/sub_1PVQkCIcGGZP425oxIjHO9Ww
In this case the customer.subscription.updated event was fired. https://dashboard.stripe.com/test/events/evt_1PcrpsIcGGZP425o8uutXhxT
const subscription = await stripe.subscriptions.update(subscriptionId, {
pause_collection: {
behavior: 'mark_uncollectible',
},
});
in this case, no event is triggered
Can you find that request in your dashboard? I'd like to take a look
one second
Just paused via api
POST /v1/subscriptions/sub_1PVQkCIcGGZP425oxIjHO9Ww
req_76b14ax5q8K8sM
Thanks, looking
Okay I still see the same event type being fired. https://dashboard.stripe.com/test/events/evt_1PcsIXIcGGZP425oMpUC8MKb
Okay, thanks a lot
I'll try that in my webhook
what element in each event, charge.refunded and customer.subscription.paused make me know if it was a success or not? I think the charfe.refunded is always after a successfull refund so I shouldn't mind. but in customer.subscription.paused, if I reactivate it, do it call the same event?
For all the changes to the subscription, the event that was fired was customer.subscription.updated
For any .updated event, the property you want to pay special attention to is the previous_attributes. This will tell you want fields changed and what the old values were. You can compare these against what the values currently are to understand how things changed
For that last event, we had
previous_attributes: {
pause_collection: null
}
and in the Subscription object we can see the current value of pause_collection is
pause_collection: {
behavior: "mark_uncollectible",
resumes_at: null
},
Thanks!
Do you know why my webhook is not receiving these events?
we_1PT6MPIcGGZP425oXvZtiQ8X
Just unpaused one subscription and it wasn't called
You are listening for the wrong event
Please add this event: customer.subscription.updated
no way๐คก
Sorry
So if I want to only check the event customer.subscription.updated in cases where the subscription is paused/unpaused I should only check if the "previous_attributes" includes pause_collection?
If it does not I cann call an res.status(304 or 200) for example
- You should always respond with a 200 to webhook request.
- You can check what the current and previous values are for
pause_collectionto understand what happened
-
Ok, thanks!
-
But I think more events from
customer.subscription.updatedare going to trigger my webhook, but I only want to check the ones related to pausing/unpausing subscriptions, so in theses cases theprevious_attributeswill always have thepause_collectionprop, right? so if it does not contain this prop, I can return an 200 right after
Correct.
You can use the presence of pause_collection in the previous attributes to indicate it's a pause/unpause event
I'm happy to shed what ๐ก I can ๐
If I got any further issues, I contact you guys again