#Nadiya-invoice
1 messages · Page 1 of 1 (latest)
hi! not directly but you can get it yes
easiest way is to look at the subscription ID (invoice.subscription) and then list all invoices for that subscription with https://stripe.com/docs/api/invoices/list#list_invoices-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
just to make sure I'm understanding, what does "previous charge" mean to you, what exactly is the use case?
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
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?
you mean to store subscription_id (which will be same for all recurring invoice)?
yes