#geimsdin

1 messages · Page 1 of 1 (latest)

royal waveBOT
clear lake
torpid olive
#

Hi Alex, I can only rely on the event "customer.subscription.deleted"? My automation is now configured to be triggered on invoice.paid and I would like to not rewrite all the code but just adding maybe an API call to get that info, do you have any suggestion?

clear lake
#

relying on the customer.subscription.deleted event is really the easiest way

#

the only other way i can think of is if you don't receive an invoice.paid subscription at a expected period

torpid olive
#

I didn't specify is a scheduled subscription

#

makes no difference I guess

clear lake
torpid olive
#

I try to give you more details

#

I noticed that if I manually resend the invoice paid event, my webhook will store a new payment locally on that subscription even if it is the same payment as before.

#

Then I need to understand if I did already collected (locally) that payment or not

#

Is the invoice id different for every phase? Can I rely on that?

#

First idea was to store the phase number and overwrite in case it is the same as one already stored for that subscription

clear lake
#

i'm not sure i understand the question here, are you attempting to prevent saving duplicate invoices? If so, you should just refer to the invoice id : https://stripe.com/docs/api/invoices/object#invoice_object-id. If you already have that id in that DB, and the invoice is paid, then you don't need to save it again

torpid olive
#

ok, just to be sure, every phase has a different invoide_id, the invoice_id is not tied to the subscription itself

#

correct?

clear lake
#

every time payment is collected, the invoice id is different. It's neither tied to the phase, nor is it tied to the subscription.