#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_invoice-php, 1 day ago, 116 messages
- nugax_invoice-email, 4 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/1235257939397181441
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi Rubeus. Good morning.
Hello! This Invoice is in test mode, and we mostly don't send emails in test mode.
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.
?
Yep, in live mode we would have sent an email when the Invoice was finalized.
Yep, you can ask another question!
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.
To clarify, you're saying that if you set days_until_due to 0 it acts the same way as setting it to 1?
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.
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
That first request is a GET request to retrieve an Invoice that's already been created.
So is the second.
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
Looks like the creation requests are here: https://dashboard.stripe.com/test/logs/req_FrLHq5kYJSyIvJ
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"
}
i just notifced my time stamp is off too.. lol
This one is the one with days_until_due set to 0.
What's one with days_until_due set to 1?
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)
You can do that, but it only gives you the date, not the time. The time is going to be different.
yea i could add the time as well i assume to date()
Try date('c', $invoice->due_date);
You could also do 'r' for something that's a bit easier to read.
Okay, so now create one with the other days_until_due value to compare.
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
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?
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
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.
why such a gap when they were created less than an hour apart?
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.
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
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.
or i have to take manual action to collect
Yes.
so. if I set to a different method, it will auto charge?
i could make a setting to allow automatic collection if so.
If you switched to charge_automatically we would attempt to collect payment immediately, but you couldn't set a due date in that case.
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
That depends on many variables. Is the customer present or not? Do you have a Payment Method on file for the customer or not?
lets say customer is not present. I have card on file, previously saved.
that would be the normal scenario
In that case, if the Invoice's collection_method is set to charge_automatically, the Invoice will automatically charge the Customer on its own. Have a look here: https://docs.stripe.com/billing/collection-method
And do you have a page reference for setting a payment method as "default"
like a card or bank account
Do you want to set it as the default on a specific Subscription or on the Customer?
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
Customers have an invoice_settings.default_payment_method property you can set to the Payment Method you want to be the default for Invoice payments: https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
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?
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)
Gotcha.
so I just need to update a customer, on that setting to set the default payment method
invoice_settings.default_payment_method
Yep.
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
To clear you set it to an empty string.
right.
so for an auto payment on an invoice, it will attempt on the default?
when you finalize invoice?
Yes. This page might clarify how it works: https://docs.stripe.com/invoicing/integration/automatic-advancement-collection
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?
Sounds like you want account_tax_ids I think? https://docs.stripe.com/api/invoices/create#create_invoice-account_tax_ids
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.
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.
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*
You can build a UI that lets them select the one they want to use, then you can specify that one and call the pay endpoint on the Invoice: https://docs.stripe.com/api/invoices/pay#pay_invoice-payment_method
Happy to help!