can we have an example order in which tax on inline item ,discount and tip are included and amount of payment matches with actual payment
Hi @arjun_sailesh welcome to the forums!
Most of our APIs have walkthroughs, here is Orders API including taxes/discounts: https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts. You can see the requests and responses that are used on the docs. The CreatePayment
request has to be the same amount as the order, so you can simply retrieve the order’s total amount after creating it, and pass that amount to the CreatePayment
request. Please let me know if I misunderstood or if you have additional questions!
I am facing an issue where I have to apply custom tax to each line item ,discount and tip amount ,These have to be reflected in bill . is there any example for this
In the above documentation, it shows how to add taxes to a line item specifically. We do not have other examples besides the long form docs, but I’m happy to help. Can you clarify what trouble you’re currently running into?
Basically you need to have something like this at the root level of your CreateOrder
request:
"taxes": [
{
"uid": "STATE_SALES_TAX_UID",
"catalog_object_id": "STATE_SALES_TAX_CATALOG_ID",
"scope": "LINE_ITEM"
}
]
...
and then in your line items, reference the tax:
"line_items": [
{
"catalog_object_id": "{COFFEE_ITEM_ID}",
"quantity": "1",
"applied_taxes": [
{
"tax_uid": "STATE_SALES_TAX_UID"
}
]
},
...
This will ensure that the tax is only applied to that single line item.