#kosherslayer

1 messages · Page 1 of 1 (latest)

cerulean stirrupBOT
tawdry swallow
#

I guess I would have to somehow distinguish in invoice.payment_failed if it was a failed payment on upgrade / downgrade but how would I do that?

obsidian cypress
#

I don't fully understand the question. Can you give a step-by-step explanation of what you're doing now vs. what you're wanting to do?

tawdry swallow
#

sure

#
  • customer is on tier 2
  • customer wants to downgrade to tier 1
  • subscription_schedule created to downgrade customer at end of billing cycle
    *downgrade takes place in a month
    *1 month later
  • card declines
  • on stripe the user's subscription is updated to tier 1 with past due
  • internally, the user is still on tier 2 because i only update a customer's 'tier' in the db on invoice.paid and customer.subscription.deleted events
#

i basically just want to sync my internal db with stripe in this case. Because i only sync it on payment successes, it doesn't sync it on payment failures

#

does that make sense

obsidian cypress
#

Why not just listen for invoice.payment_failed webhooks so that your system is always synced?

tawdry swallow
#

i use invoice.payment_failed for some stuff

#

but that's got me thinking hm

#

i can just update the db and set the customer to the tier of the subscription that failed anytime I receive that event?

#

wondering if there's anything that could fail cause of that

obsidian cypress
tawdry swallow
#

yeah i alr set that up