#devparry
1 messages · Page 1 of 1 (latest)
Hi
For each subscription you'll have one upcoming Invoice at the time, so you can refer to the Subscription Id as an Id
but the problem is invoice.paid event trigger in so many other cases like user payment failed due to card expiration and meanwhile new invoice will generated if we are talking about weekly subscription or daily based subscriptions...
then how i can find which invoice status update?
but the problem is invoice.paid event trigger in so many other cases like user payment failed due to card expiration
No, invoice.paid is triggered only if the payment was successful
You need to handle this exclusivity in your integration... keep only one upcoming invoice per subscription ... but why do you want to store upcoming invoice in your database ?
and what about under invoice.updated and invoice.created
when you have invoice.created then there is an upcoming invoice that you need to convert to an invoice.... for invoice.updated you must have an invoice created already.
actually we have to display to admin about all the upcoming invoice list
so when we fetch list in realtime we have more then 500 subscriptions and under loop
the logic is like this....
You receive an invoice.upcoming event => create an invoice A
invoice.created => match invoice A by its subscriptionID
invoice.update => you have the id here ...
and our server overload and stoped
thanks for idea.
but as i have notice when new subscription is created on same time one onvoice is created which is already paid at same time
So my question is after this how much time invoice.upcoming event will fire by stripe
so that i will modify my code while save and update invoice data ?
https://stripe.com/docs/api/events/types#event_types-invoice.upcoming
Sent a few days prior to the renewal of the subscription. The number of days is based on the number set for Upcoming renewal events in the Dashboard. You can still add extra invoice items, if needed.
the upcoming event is sent one time before the renewal of the subscription.
okay
Could you please also let me know about these parameters
Could you please let meaning of these
"number": "CF2B5C78-0036"
"period_end": 1681743176
"period_start": 1681138376
as these are always returned under invoice.upcoming
You can learn about all attribute of the invoice here:
https://stripe.com/docs/api/invoices
For example number is uniq yes
https://stripe.com/docs/api/invoices/object#invoice_object-number
so based on this Number we can easliy find the invoice we have to update under the local database. Right ? as it is a unique invoice_prefix
?
if you have it yeah you can rely on it...
Welcome!