#nugax_api

1 messages · Page 1 of 1 (latest)

ruby quailBOT
cerulean wadiBOT
#

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.

ruby quailBOT
#

👋 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/1235257939397181441

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

half lagoon
#

Hi Rubeus. Good morning.

next gust
#

Hello! This Invoice is in test mode, and we mostly don't send emails in test mode.

half lagoon
#

That would make sense.

#

I had the collection method as send invoice

#

then, finalized it, but no email.

#

that would be, collection_method = "send_invoice" in the create invoice functionality that opens as a draft, i might say

#

while I have you can I ask one additional question, or should I chat back in.

#

?

next gust
#

Yep, in live mode we would have sent an email when the Invoice was finalized.

#

Yep, you can ask another question!

half lagoon
#

thank you my friend.

#

ok, so when i create the draft invoice, i create a days_until_due => 0. This works perfectly if I have that number some value, other than 0. If I give it a value of 0, the due date is the next day. Is that expected behavior. This would be for like invoices that are due immediately.

#

And i have 1 additonal question about payments, and payment intent.

next gust
#

To clarify, you're saying that if you set days_until_due to 0 it acts the same way as setting it to 1?

half lagoon
#

that is correct.

#

I can show you an example refernece id.

#

one moment.

next gust
#

Yeah, if you could give me a couple of example Invoices to compare that would help. I just tried it and I'm seeing different due dates on the resulting Invoices.

half lagoon
#

if you set it to 0, you see it due that same day?

#

req_8ab21Zjwx9qND0 this would be the creation of the draft invoice, but I do not see a response body

#

req_8ab21Zjwx9qND0

#

I basically created a customer, a draft invoice, then finalized it with one product and price id

#

today

next gust
#

That first request is a GET request to retrieve an Invoice that's already been created.

#

So is the second.

half lagoon
#

Well i dont know where the inital create went. because i just created it and created the customer account. at 10:46:33 am

#

10:47:33 am

next gust
half lagoon
#

there you go

#

sure s

#

here is relavant info:

#

Request POST body
{
"collection_method": "send_invoice",
"description": "New Draft Invoice Created On 05-01-2024 @ 15:47",
"auto_advance": "false",
"days_until_due": "0",
"customer": "cus_Q1ipHAl4wuR1o8"
}

next gust
#

Oh, wait, those are the same.

#

Wha'ts the other Invoice ID?

half lagoon
#

i just notifced my time stamp is off too.. lol

next gust
#

This one is the one with days_until_due set to 0.

#

What's one with days_until_due set to 1?

half lagoon
#

i dont have one

#

but i can quickly create one using api

#

one sec

#

setting it to days until due 1

#

left it in draft.

#

req_oDVk1kg2JVMijm

#

"due_date": 1714666356,

#

that timestamp is Epoch right?

#

This is how it is calculated into a readable date. Maybe its wrong.

#

date('m/d/Y', $invoice->due_date)

next gust
#

You can do that, but it only gives you the date, not the time. The time is going to be different.

half lagoon
#

yea i could add the time as well i assume to date()

next gust
#

Try date('c', $invoice->due_date);

half lagoon
#

ISO timestamp

#

well iSO formatting

next gust
#

You could also do 'r' for something that's a bit easier to read.

half lagoon
#

uploading one second

#

Date Due: Thu, 02 May 2024 16:12:36 +0000

#

Thats 'r'

next gust
#

Okay, so now create one with the other days_until_due value to compare.

half lagoon
#

like dyas 5

#

days 5

#

Date Due: Mon, 06 May 2024 16:23:51 +0000

#

Days=5

#

That doesnt look like 5 days to me.

#

well i guess it is

#

so yes, that is correct.

#

but days=0 produces thu may 2

next gust
#

Can you create one with days_until_due set to 1 so we can see what that's set to and compare it to the one with it set to 0?

half lagoon
#

yes sir. also, you think my timezone settings have any thing to do with this?

#

or is the dates all handled by stripe

#

Thu, 02 May 2024 16:27:55 +0000

#

Day =1

#

so effectively day 0 or day 1 produces same due date.

#

Here is the screen

#

I generate

#

Just so you can see it

#

you can see it has the invoice id on there as well

#

from stripe

next gust
#

Okay, so I found the Invoices you created. The one with days_until_due set to 0 has a due_date of 1714625999 which is 2024-05-02 04:59:59. The one with days_until_due set to 1 has a due_date of 1714666356 which is 2024-05-02 16:12:36. That's a difference of 12 hours which, while not an entire day, is a significant gap.

half lagoon
#

why such a gap when they were created less than an hour apart?

next gust
#

When you set days_until_due to 0 I believe we set the due_date to the earliest possible time, but let me see if I can find more specific details about how that works.

#

Because you set days_until_due to 0 for one and 1 for the other.

half lagoon
#

i see.

#

So - when that date/time is reached, stripe with automatically attempt payment via the default payment method. Is that correct?

#

if the invoice is open.finialized. i should ask

next gust
#

No. The Customer has that long to pay it before it becomes overdue. You have collection_method set to send_invoice to the Customer has to take action to pay it.

half lagoon
#

or i have to take manual action to collect

next gust
#

Yes.

half lagoon
#

so. if I set to a different method, it will auto charge?

#

i could make a setting to allow automatic collection if so.

next gust
#

If you switched to charge_automatically we would attempt to collect payment immediately, but you couldn't set a due date in that case.

half lagoon
#

ah

#

still could be a setting that would be handy

#

ok, one last question for you and I promise ill leavge you alone! 🙂

#

your just so helpful Rubeus!

#

when I create a open invoice. I get a payment intent id. Im a little fuzzy on how I then use that to create a payment. If i have a card on file, how do I intiate payment

next gust
#

That depends on many variables. Is the customer present or not? Do you have a Payment Method on file for the customer or not?

half lagoon
#

lets say customer is not present. I have card on file, previously saved.

#

that would be the normal scenario

next gust
half lagoon
#

And do you have a page reference for setting a payment method as "default"

#

like a card or bank account

next gust
#

Do you want to set it as the default on a specific Subscription or on the Customer?

half lagoon
#

well the question for today is for the customer's default method of payment. I assume if I set an invoice to charge_auto it will attempt on the default method of payment. Correct?

#

When i get into subscriptions, which I have not yet, I will look at that portion

#

im wanting to get invoicing, payments, voids, etc, all working prior to delving into subscriptions

next gust
#

To clarify, are you trying to set up one-time payments with individual Invoices? You're not working on recurring payments at all now, right?

half lagoon
#

ah thats it!

#

no , this is not recurring. manually created invoices at this time.

#

but i plan on the future to have subscriptions, for karate program memberships

#

that would be monthly, or yearly charged memberships (subscriptions)

next gust
#

Gotcha.

half lagoon
#

so I just need to update a customer, on that setting to set the default payment method

#

invoice_settings.default_payment_method

next gust
#

Yep.

half lagoon
#

and to clear, you set to NULL

#

easy enough, i can write a php function to quickly do that, passing it the payment method id

next gust
#

To clear you set it to an empty string.

half lagoon
#

right.

#

so for an auto payment on an invoice, it will attempt on the default?

#

when you finalize invoice?

next gust
half lagoon
#

ok, last question and I am done. Promise. I have 2 tax ids created. How do you apply those to the product?

#

or is it applied to the invoice?

next gust
half lagoon
#

That automatic charging doesnt really specific if it uses the default, or if i just uses one on file. It says this:

#

With the API, set the invoice’s collection_method property to charge_automatically to automatically charge the payment method on file.

next gust
#

It says the one on file because it can be set in various places. One of those places is the invoice_settings.default_payment_method we previously discussed.

half lagoon
#

ok, so short answer is yes. I have ti seutp so a customer can add a "wallet" of multiple cards, or accounts

#

to save

#

I wanted during a manual payment for them to use whatever card they like, that has been saved.

#

it setup*

next gust
half lagoon
#

ok

#

Thank you

#

you have been very helpful

next gust
#

Happy to help!

ruby quailBOT
half lagoon
#

I have no other questions at this time. thanks you

#

thank you.