#landfight_webhooks

1 messages Ā· Page 1 of 1 (latest)

steel rockBOT
#

šŸ‘‹ 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. Thank you for your patience!

ā±ļø We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

šŸ”— 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/1213017673076572180

šŸ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

floral roseBOT
#

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.

slim jetty
#

hello! you would probably want to listen for the invoice.paid event : https://stripe.com/docs/billing/subscriptions/webhooks#events and check the billing_reason : https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason - subscription_cycle is probably what you want to check for

Learn to use webhooks to receive notifications of subscription activity.

serene gorge
#

one more question @slim jetty would i implement that like this in the webhook code?

and so when the billing reason is subscription cycle, thats when i would add credits right?

if (stripeEvent.type === "invoice.created") {
    const invoice = stripeEvent.data.object as Stripe.Invoice;
    if (invoice.billing_reason === "subscription_cycle") {
      // add credits here
    }
  }
slim jetty
serene gorge
#

didnt know this thanks!

serene gorge
slim jetty
#

šŸ¤¦ā€ā™‚ļø oh yeah, sorry, totally missed that in your code