#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, 22 minutes ago, 146 messages
- 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/1235301827592065055
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Hi!
I'm not seeing a tax rate applied to the Invoice Item
You can see the creation request for your Invoice Item here: https://dashboard.stripe.com/test/logs/req_vysUGIRoxsDB4R
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sure
ok its php. one moment.
oh wiat. one sec
that may be wrong code.
i apologize.
I ma yhave put it in the code that creates the product id.
$product = \Stripe\Product::create([
'name' => $invoice_item['item_desc'],
'tax_rates' => [$local_tax_rate],
]);```
would that be correct, when creating the DRAFT invoice?
assuming $local_tax_rate is the id of the tax rate previously created.
txr_1PBi1xH0hGHXsp6rjqJ026p1
Yeah that looks fine
Warning: Undefined variable $local_tax_rate in /opt/karate-monkey/core/add_invoice_item_engine.php on line 44
Error creating invoice item: Received unknown parameter: tax_rates. Did you mean tax_code?
Can you clear your cache and save your code again and then retry?
is it supposed to be tax_rates?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But that error indicates an issue with $local_tax_rate
So I'd try hardcoding the ID to start
one moment.
yes i didnt pull the rate form MySQL.
fixing it.
oh that was wrong
that was on the PRODUCT.
it needs to be on the InvoiceItem create.
Oh sorry I didn't even look at what method you were calling in your code
$invoiceItem = \Stripe\InvoiceItem::create([
'invoice' => $invoice_item['stripe_invoice_id'],
'price' => $price->id,
'description' => $invoice_item['item_desc'],
'customer' => $invoice_item['stripe_customer_id'],
'quantity' => $invoice_item['item_qty'],
'tax_rates' => [$local_tax_rate],
]); ```
like that.
Yes correct
one moment
hmm
close to working!
so when you retrieve line item, what is the property for taxes?
When you retrieve the Invoice you mean?
Oh you specifically said line item
Which you can retreive as well
But it should have a tax_rates property too: https://docs.stripe.com/api/invoices/line_item#invoice_line_item_object-tax_rates
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
just wanted to show tax collected in a particular line item
its not: $lineitem->tax
tax_amounts in that case
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So really $lineitem -> tax_amounts -> amount
Yeah assuming $lineitem is a line item object
its pulling other lineitem data.
it gave this error:
Warning: Attempt to read property "amount" on array in /opt/karate-monkey/core/edit_invoice.php on line 101
which was the above code
$taxes = ConvertCentsToDollars($lineitem->tax_amounts->amount);
Ah sorry tax_amounts is an array
ooh
Warning: Undefined array key "amount" in /opt/karate-monkey/core/edit_invoice.php on line 101
is it assoc?
What are you doing? It should just be $lineitem->tax_amounts[0]->amount if you only have one tax rate
ah ok
your right
i didnt realize tax_amounts was an array
didnt see that listed, probably overlooked it
One more question, is there a fee or charge that can be added to an invoice, not a product.
to the total/subtotal (like passing on the stripe processing fee of 3%)
You would just add an invoice item for that fee but you would have to calculate the amount yourself: https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
Dang you even have an article for that
๐
That's a pretty common question, thus why we have an article ๐
so you add an invoiceitem for this specific charge?
Yep
Like "Processing Fee"
Yep you can add any description you want
I need a math degree to understand how to calculate it
๐
My recommendation is don't try to calculate it perfectly
Just use an arbitrary amount (like 3%)
why cant it just be total_amount * percent + .35 cents or whatever
(100 * .03) + .35
would be for 100 dollars
Because that is the amount that is then going to be assessed fees
So then the fee would be higher than $0.65
Because the fee would be calculated based on $100.65
Good luck