#Derek Lance

1 messages · Page 1 of 1 (latest)

red bronzeBOT
misty lance
#

hello! i don't think there's a great way to go about this other than storing and querying for that data in your own DB

keen pike
#

ok that's what i figured, thanks

#

was hoping to not have to set up our own DB but that makes sense

#

@misty lance so currently, we have a server set up using a webhook to listen to stripe.checkout.completed, is that the best time to store the discord account to subscription association? doesn't the webhook have the same issue as the stripe.subscriptions.search API where updates are not immediate and could take a few minutes to propagate?

misty lance
#

i mean, everything needs at least some time, it could be milliseconds, but it's still going to take time

keen pike
#

milliseconds is better than a few minutes though, that I can live with

#

just want to make sure a user doesn't somehow subscribe twice

misty lance
#

i think something you need to keep in mind is that you should always be prepared to handle exceptional scenarios e.g. webhooks could be delayed as well, or your server could be down/having trouble processing.

If you want to be certain, i would say using their email as the unique id may be a worth considering instead

keen pike
misty lance
#

yes, that's fine

keen pike
#

ok awesome, thank you!

misty lance
keen pike
#

good to know 👍

misty lance
#

to add on

#

you could save the discord id, map it to a Customer id in your DB (i'm assuming that the customer is already created). Then retrieve the customer with the Customer Id

#

well...anyway, i'm sure you'll be playing around with the API to figure out what works best, feel free to reach out if you have any other questions