#nine_webhooks

1 messages ยท Page 1 of 1 (latest)

mortal graniteBOT
#

๐Ÿ‘‹ 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.

small spoke
#

hello

mortal graniteBOT
dense marsh
#

๐Ÿ‘‹ happy to help

small spoke
#

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?

dense marsh
#

instead of listening to the customer.subscription.* events, you can listen to the invoice.paid events

small spoke
#

what is the difference?

dense marsh
small spoke
#

does it cover the case when user upgrades his or degrade his plan or when his plan gets expired

dense marsh
#

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.
small spoke
#

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

dense marsh
#

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

small spoke
#

ok and in case subscription degrade and expiry?

dense marsh
#

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

small spoke
#

ok so these two events will be enough right?

  • customer.subscription.deleted
  • invoice.paid
dense marsh
#

yes

small spoke
#

and how do I test this locally? because our product is live

dense marsh
small spoke
#

ok thanks