#Nadiya-invoice

1 messages · Page 1 of 1 (latest)

sour rock
#

hi! not directly but you can get it yes

fallen ibex
#

i see, ok.
actually i wanted to get the previous charge id from the current invoice.
so should i check in previous invoice? or it's available in subscription object?

sour rock
#

just to make sure I'm understanding, what does "previous charge" mean to you, what exactly is the use case?

fallen ibex
#

i creating payment log in a table on our db. The first payment log will be created when subscription is created.
Payment log table contain many useful other fields like page id, user id, etc...
I'm also storing payment_id and charge_id into this record.
So, on the webhook ( invoice.paid ) for the recurring payments, i would like to check any previous invoice and get the charge_id or payment_id , and then search our local table for that id . Using that charge_id, i'm planning to fetch other column values, and insert new record with those value

sour rock
#

would it not be easier to store something like the recurring subscription ID in the table and then look that up on each invoice.paid event, instead of looking for individual charges?

fallen ibex
#

you mean to store subscription_id (which will be same for all recurring invoice)?

sour rock
#

yes