#discorrduser_webhooks

1 messages ¡ Page 1 of 1 (latest)

halcyon laurelBOT
#

👋 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.

slim nexus
#

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

cyan blaze
#

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?

slim nexus
cyan blaze
#

Great.

#

What is the difference between? "invoice.payment_succeeded" and "invoice.paid"?

#

Okay. So here is one thing I need to emphasize.

slim nexus
#

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

cyan blaze
#

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)

slim nexus
#

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

cyan blaze
#

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?

slim nexus