#devparry
1 messages · Page 1 of 1 (latest)
Hello, apologies for the delay. There will be an initial invoice for the free trial that gets created along with the subscription and then there will be a paid invoice when the subscription renews
Are you running in to some behavior with this that you are having trouble figuring out?
This is what i am getting right now so according to this no invoice will generate ?
I am not immediately sure what the dashboard means by that. It might just mean we don't have a draft invoice or an upcoming invoice according to your "Upcoming renewal events" setting https://dashboard.stripe.com/settings/billing/automatic#:~:text=Upcoming renewal events
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you tell me more about what you are trying to do here?
okay, we have an admin dashboard under which we have to display a list of upcoming invoices of all the subscriptions. who's status is not cancel yet so now we have approx 100 subscriptions who's status is trialing but we dnt get any data under it.
so based on the screen-shot most of subscriptions will expire next year, so I want to know if trailing subscriptions don't have any upcoming invoice till next year I'll ignore the trialing subscription and get active status related subscriptions only from my local database.
Are you using the API to get the data for this dashboard?
This sounds sensible. Yes, those subscriptions won't have another invoice until their trial ends, so they won't have another invoice until next year in this case
thanks for confirming @clever haven
first, we get a list of subscriptions form our local database after that with the help of stripe API code
$subscription = \Stripe\Invoice::upcoming( ['customer' => $stripe_customer_id, ] ); $ReturnDueInvoiceData['data'] = $subscription->jsonSerialize();
we get upcoming invoices based on coustomer_id which we store under local db subscription table
now we get issue
which is: if record is more the 200 then the page hang becz \Stripe\Invoice::upcoming() function call is under loop which means each time system hit to \Stripe\Invoice::upcoming() API and page become too slow or sometimes it hangs
do you have any solution on how we can increase the speed of the page?
Can you explain more of what you mean by "if record is more the 200 "? Are you saying that something loops if there are too many invoice items?
no
let me explain again
under the dashboard, we have to display a list of upcoming invoices only.
- So first we get all the records from our local database where subscription status is
active - now we have a list of 200 records so we run for-each loop on the subscription list and we find upcoming invoices by using under mentioned code :
$subscription = \Stripe\Invoice::upcoming( ['customer' => $stripe_customer_id, ] ); $ReturnDueInvoiceData['data'] = $subscription->jsonSerialize();
now if we get invoice data returned by Stripe API we put the invoice value into a new array.
and print a list of the new array under the dashboard.
but now for 200 records, it takes too much time to display data on the dashboard.
Ah gotcha, not sure if there is a good way to speed that up. that upcoming invoice call needs to be called for each subscription and I am guessing that making that call 200 times is the bulk of your load time here.
Maybe you can try making that call for each invoice beforehand and store the upcoming invoice so that when you load the page you are just loading the data that you already have instead of retrieving new data?