#nugax_api
1 messages ยท Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nugax_api, 1 day ago, 99 messages
- nugax_api, 1 day ago, 146 messages
- nugax_invoice-php, 3 days ago, 116 messages
- nugax_invoice-email, 6 days ago, 104 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1235988453179789387
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
hi
In the request you provided you passed status: open
Ah sorry one moment
I see what you are saying
$invoices = \Stripe\Invoice::all(
[
'customer' => $customerID,
'status' => 'open',
'due_date' => ['<' => time()],
]
);
I need all invoices that are past due_date
as of time - time();
Are these charge_automatically Invoices?
Okay then yeah you list all open and check if past the due_date on the Invoice
You have to filter this yourself
how do I do that in the api?
oh
you mean load all invoices into an arrray, then filter via php on the due date
Yeah
// Iterate through the invoices and sum up the amount due
foreach ($invoices->data as $invoice) {
$totalPastDueAmount += $invoice->amount_due;
}
like this:
$current_time = time();
foreach ($invoices->data as $invoice) {
if ($invoice->due_date < $current_time) {
//Add Sum
$totalPastDueAmount += $invoice->amount_due;
}
}```
lol oh why not bismarck! ๐
๐
i think it works
check it out!
right side, past due
here is list of invoices
๐
so for an invoice that is charge automatically,
does it send a receipt immediately?
A receipt for a successful payment?
Yes if you have receipt emails turned on in your settings
This would be at https://dashboard.stripe.com/settings/emails
ok, and is there a way using the email to force stripe to send an email for a open invoice? a payment email?
using the API
i meant
not email
Not for charge_automatically no. You would send the Invoice PDF yourself in this case if you want
send_invoice does automatically send the Invoice...
I'm not sure what you mean at this point
say Its been 4 days and i want to send another payment email.
i want to create a button to make stripe send another email
Ah I see
on an open invoice
Yes sorry. You can use https://docs.stripe.com/api/invoices/send
ok last question
the invoice pdf, stripe hosts it? correct? how do I get a link to it? And can I make stripe email that?
Yes we host it. If you retrieve https://docs.stripe.com/api/invoices/object#invoice_object-invoice_pdf then you get a URL where it can be downloaded. No you can't force Stripe to email it
Sure thing
I am writing a function passing it the stripe invoice id
I want to verify the invoice exists, then use the code to send an email
Hmm well if you have the Invoice ID then the Invoice exists, no? Unless you are deleting draft Invoices?
Anyway, you can always retrieve the Invoice to check before sending if you want using: https://docs.stripe.com/api/invoices/retrieve
maybe this?:
//Send E-Mail Invoice
$stripe->invoices->sendInvoice($stripe_invoice_id_given, []);
}```
$invoice = $stripe->invoices->retrieve($stripe_invoice_id_given, []);
Yeah you can do that. You could also just handle the error from Stripe if the Invoice doesn't exist.
But that works
thanks