#discorrduser_webhooks
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/1217277394977820753
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! Subsequent invoices (other than the first invoice) are finalized and the customer is charged after around an hour or so. If you want to check if the invoice is paid, you would want to listen for the invoice.paid event instead
Hi Alex, thanks for the response.
Let's say I want to know if the customer renews the subscription (monthly subscription)
Is it correct to listen the "customer.subscription.updated" event?
I mean is that the best practice?
It really depends on what information you're looking for. You can use the invoice.paid event and look at the billing _reason to know if it's a renewal. You might find this useful : https://docs.stripe.com/billing/subscriptions/webhooks - it covers some of the common use cases and our recommendations
Great.
What is the difference between? "invoice.payment_succeeded" and "invoice.paid"?
Okay. So here is one thing I need to emphasize.
Invoice.payment_succeeded means that the customer was charged. I don't recommend using that since if you mark the invoice as paid out of band, or the final amount of the invoice is $0 due to a discount for example, you wouldn't receive this event
I know the "customer.subscription.updated" event is triggered very soon after the customer makes payment (new buy or renewal)
but when the "invoice.paid" event is triggered?
If there is time delay between these 2 events, should I save the "customer.subsription.updated" events in our database?
So my intention is to catch if there is "update" attempt on the subscription by listening the "customer.subscription.updated" event.
And to know if the customer really made payment, I can check "invoice.paid" webhook.
Is this right path?
In other hand, is it possible the "customer.subscription.updated" event can be triggered if the customer attempt to renewal but failed to pay the price? (Means the customer tried to pay but didn't actually paid)
So my intention is to catch if there is "update" attempt on the subscription by listening the "customer.subscription.updated" event.
And to know if the customer really made payment, I can check "invoice.paid" webhook.
Is this right path?
Sounds about right yes, but really though, you'll want to test it out to see whether it fits your needs/requirements
In other hand, is it possible the "customer.subscription.updated" event can be triggered if the customer attempt to renewal but failed to pay the price? (Means the customer tried to pay but didn't actually paid)
I would say so yes, if the customer failed to pay, after a period of time and depending on your billing settings, the subscription might change into past_due status
in case you haven't seen this yet, you can use test clocks to mimic the passing of time : https://stripe.com/docs/billing/testing/test-clocks
okay. So I need to listen a webhook event.
To know if the customer actually paid, and the subscription is still active.
So far I used "customer.subscription.updated", but it's not good, I think
what would you suggest to use?
There, I put the logic of new buy and renewal. But error is happening on renewal since I check the 'latest_invoice". status together to check if the payment is acutally made.
Since the latest invoice status is marked as paid status after 2 hours of this webhook signal, the paid users are often marked "not paid"
only happens for renewal, not new buy
Do you think I need to use "invoice.paid" webhook event instead of it?
like what you mentioned before, you really need both events both, customer.subscription.updated and invoice.paid events. You would want to go through the sections of https://docs.stripe.com/billing/subscriptions/webhooks#active-subscriptions to see how we recommend you keep track of active subscriptions
similarly, we mention in https://docs.stripe.com/billing/subscriptions/webhooks#state-changes
When a subscription changes to canceled or unpaid, revoke access to your product.```