#nugax_api

1 messages ยท Page 1 of 1 (latest)

red coveBOT
worn crowBOT
#

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.

red coveBOT
#

๐Ÿ‘‹ 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.

stray knot
#

Hello

maiden quest
#

hi

stray knot
#

In the request you provided you passed status: open

#

Ah sorry one moment

#

I see what you are saying

maiden quest
#
        $invoices = \Stripe\Invoice::all(
            [
                'customer' => $customerID,
                'status'   => 'open',
                'due_date' => ['<' => time()],
            ]
        );
#

I need all invoices that are past due_date

#

as of time - time();

stray knot
#

Are these charge_automatically Invoices?

maiden quest
#

no

#

send_invoice

stray knot
#

Okay then yeah you list all open and check if past the due_date on the Invoice

#

You have to filter this yourself

maiden quest
#

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

stray knot
#

Yeah

maiden quest
#

// 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;
            }   
            
        }```
stray knot
#

Seems fine to me but I'm not a PHP dev

#

Test it out

maiden quest
#

lol oh why not bismarck! ๐Ÿ™‚

stray knot
#

๐Ÿ˜‚

maiden quest
#

i think it works

#

check it out!

#

right side, past due

#

here is list of invoices

stray knot
#

๐ŸŽ‰

maiden quest
#

so for an invoice that is charge automatically,

#

does it send a receipt immediately?

stray knot
#

A receipt for a successful payment?

maiden quest
#

so when I finalize, it charges, and does it send a receipt email

#

yes

stray knot
#

Yes if you have receipt emails turned on in your settings

maiden quest
#

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

stray knot
#

Not for charge_automatically no. You would send the Invoice PDF yourself in this case if you want

maiden quest
#

send_invoice

#

i mean

stray knot
#

send_invoice does automatically send the Invoice...

#

I'm not sure what you mean at this point

maiden quest
#

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

stray knot
#

Ah I see

maiden quest
#

on an open invoice

stray knot
maiden quest
#

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?

stray knot
maiden quest
#

alrighty

#

thank you yet again!

stray knot
#

Sure thing

maiden quest
#

oh one last question

#

whats easiest way to determine if a invoice exists?

stray knot
#

That mostly depends on your integration

#

What is the scenario?

maiden quest
#

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

stray knot
#

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

maiden quest
#

maybe this?:

#
             //Send E-Mail Invoice
            $stripe->invoices->sendInvoice($stripe_invoice_id_given, []);
        }```
#

$invoice = $stripe->invoices->retrieve($stripe_invoice_id_given, []);

stray knot
#

Yeah you can do that. You could also just handle the error from Stripe if the Invoice doesn't exist.

#

But that works

maiden quest
#

thanks