#nugax_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1239581687969484842
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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-email, 3 days ago, 54 messages
Hello there
Hi bismarck
Hmm the request you provided is an erroring Price creation request since you didn't pass an amount
Can you tell me more about the issue you are having?
So i will probably need to explain my issue
I have code written for stripe api that creates an item, then creates a price_id as well as prod_id. Then it adds invoice items to the invoice.
When the calc is done, it is only (seemling) attaching tax to one of the items even if you set the item qty > 1
Can you provide an example Invoice ID that you tested with where you saw this?
yes
I am probably not creating it all correctly. just an FYI so thats why i chatted in
look at ref: req_erBRaEs8LxAItT
then the product call, price call, the invoiceitem call
Looking
invlice item: req_ysHkH9T0jX71Mx
and you will see quantity 3:
and a tax rate added
{
"id": "txr_1PEfaWRvXSuLCvvAcFGYxiTT",
"object": "tax_rate",
"active": true,
"country": null,
"created": 1715294240,
"description": null,
"display_name": "Local Sales Tax",
"effective_percentage": 8.5,
"inclusive": false,
"jurisdiction": null,
"jurisdiction_level": null,
"livemode": false,
"metadata": {
},
"percentage": 8.5,
"state": null,
"tax_type": null
} ````
8/5 %
8.5 %
and finally the draft finalized
Looks like it charged 8.5% tax on $89.95 which is $7.64 which all seems correct
one sec
im creating one right now. TEST ITEM, QTY 3, PRICE 10, TAX 8.5%
This is my program and how it shows
Just finlaized
wait never mind
i think its right
'wtf..
I know tis title wrong
but, the tax is a collective tax.
i think the tax shoiws correctly.
Because this is all your own UI here
Right. yes
And it looks like the Stripe side of things is working as expected
Local tax is
$invoice->tax
Is there a way for each lineitem in the invoiceitem array to show just the tax on that one item?
//Create Draft Invoice
$invoice = $stripe->invoices->retrieve($stripe_invoice_id_given);
$lineitem->tax_amounts[0]->amount;
Yep seems right
well
sorry for wasting your time. evidently i had it correct. I have no idea why i thought it wasnt correct.
Yep
i have one more question if you have a moment
Sure
this is unrelated
That's fine
ok, so when I create an invoice, I get a paymentintent, corret
correct.
when i finalize it
Yes
Assuming I have a payment id for a payment method, i think its a pm_ - how do you actually apply the payment to the open invoice?
is the payment intent all i need?
have the pms entered into stripe account and also keep their default PM in my database.
ive seen so many articles on accepting payments, its confused me on exactly what I need to do to iniate payment.
Easiest way is to just use the Invoice /pay endpoint: https://docs.stripe.com/api/invoices/pay
You can do this in place of finalization
As using that endpoint will both finalize and attempt to charge in one API request
cant do it that way. some of these may be pre-billed invoices
which do not need to collect right then
im making a apply payment call
You can finalize and then use that endpoint later
Not if you finalize?
If you use that endpoint and don't specify payment_method then it will attempt to charge the Customer's invoice_settings.default_payment_method
Otherwise, you can specify the PM ID you want to charge
Yes
That is assuming you already collected the PaymentMethod ID
That would be the way to charge
If you need to collect a payment method then you would go a different route
But I thought you said you already had payment methods above
$stripe->invoices->pay('in_1MtGmCLkdIwHu7ix6PgS6g8S', [payment_method => $payment_method_i_want]);
i do
it would look like that above
my next question would be cash and check, and this is the answer i assume: paid_out_of_band
boolean
Boolean representing whether an invoice is paid outside of Stripe. This will result in no charge being made. Defaults to false.
Yep
Nope just out_of_band but you can set metadata if you want to indicate that
i didnt see metadata in the parameters
so metadata on the invoice, not payment
Either
Up to you
metadata is your own arbitrary data
That you can use how you want
true, but how doI find it. if there are so many objects.
i assume it would go on invoice
because this doesnt create a seperate object
its part of invoice.
ok, so if i do this function, pass a valid payment method, I will get back a status if card or bank account?>
Not sure what you mean by "how do I find it"? Do you mean how would you retrieve that metadata?
i was thinking this created a new object. but its part of invoice.
Yes you set metadata on the objects themselves
If you want details about the Charge then when you call /pay you expand payment_intent.latest_charge
Are you familiar with expansion?
no sir
If not, take a look at: https://docs.stripe.com/expand
so, $stripe->paymentIntents->all([
'customer' => '{{CUSTOMER_ID}}',
'expand' => ['data.payment_method'],
]);
would create an object llike $payment_intent that has all the data in a list format of the payment
Well that method lists PaymentIntents
It doesn't create them
But it would list them and expand the properties for the PaymentMethod object, yes.
it would return the info on the poayment intent linked to that object
i mean
and what property would show approved, declined, etc
You want the latest_charge for the PaymentIntent
That is the Charge object: https://docs.stripe.com/api/charges/object
Which has all the details for both what happened with the Charge and it includes a payment_method_details property as well
Best thing for you to do at this point is test this stuff out
It will give you a better understanding than I can
thats what im doing, but I have to know what to code to make it work. what properties to include.
there only a billion properties. lol
Yep and I just explained above what you want to look at
so is this charge object created automatically when pay is called?
Yes
so pseduo code would be like this. 1) call pay on invoice, 2) get payment intent id 3) retrieve charge details from charge
You can do that all in one request using expansion
When you call /pay you also use expand => ['payment_intent.latest_charge']
Yes
It returns the full Charge object
At this point we should pause and you should just test it!
ok, leave this open or chat back in later?
It will close automatically after a time of inactivity but you can always chat back in later if that happens!
and one last question, when i expand something, like payment_intent, that is calling the payment _info info attached to the object (invoice) that is referenced in original call
i would only work in that specfic call
so you can exapand anything related to get info?
expand
If you look at our API reference for an object you will see a little expandable label next to properties that can be expanded. Ex: https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent