#nine_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/1349288312010969118
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello
๐ happy to help
my question above
I want to make the product safe and secure since it's based on role assignment
first how do I identify certain subscription plan? is it by price id or product id?
instead of listening to the customer.subscription.* events, you can listen to the invoice.paid events
what is the difference?
it depends on how you're creating your plans
does it cover the case when user upgrades his or degrade his plan or when his plan gets expired
if you listen to the invoice.paid events you can know why an invoice is generated by looking at the billing_reason https://docs.stripe.com/api/invoices/object#invoice_object-billing_reason
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
which will cover these scenarios:
subscription_create: A new subscription was created.subscription_cycle: A subscription advanced into a new period.subscription_update: A subscription was updated.
ok now how do I know which plan was chosen?
I want to identify premium plans (no matter paid monthly or yearly) so the bot can give the user appropriate roles
you can look at the invoice items
or you can retrieve the subscription and look at the subscription items
if you're creating a "premium" product with 2 prices (monthly and yearly) then you can rely on the product ID
ok and in case subscription degrade and expiry?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
whether it's a downgrade or an upgrade the subscription_update would be your got to event
you can still listen to the customer.subscription.deleted for when the subscription ends
ok so these two events will be enough right?
customer.subscription.deletedinvoice.paid
yes
and how do I test this locally? because our product is live
ok thanks