How to handle taxes and fees with the online ordering API?

Hello,
I’m using the online ordering API endpoint to import online orders from a 3rd party service into LightSpeed.
I’m POSTing the following request to /rest/onlineordering/customer/123/order:
{
"customerId":123,
"deliveryDate":"2020-09-17T12:05:00Z",
"type":"takeaway",
"status":"ACCEPTED",
"description":"SPILLOVER: BH order #53. Automatically imported on 09/18/2020 08:42:35 AM CDT.",
"orderItems":[
{
"productId":123,
"amount":"1",
"totalPrice":8.66,
"totalPriceWithoutVat":8.0,
"unitPrice":8.66,
"unitPriceWithoutVat":8.0,
"modifiers":[
{
"description":"Rosemary Sourdough",
"modifierId":123,
"modifierName":"Bread",
"modifierValueId":123,
"price":0.54,
"priceWithoutVat":0.5
},
{
"description":"Cheddar Cheese",
"modifierId":123,
"modifierName":"Veggies \u0026 Toppings",
"modifierValueId":123,
"price":0.0,
"priceWithoutVat":0
},
{
"description":"Mayo",
"modifierId":123,
"modifierName":"Veggies \u0026 Toppings",
"modifierValueId":123,
"price":0.0,
"priceWithoutVat":0
},
{
"description":"Red Onion",
"modifierId":123,
"modifierName":"Veggies \u0026 Toppings",
"modifierValueId":123,
"price":0.0,
"priceWithoutVat":0
},
{
"description":"Avocado",
"modifierId":123,
"modifierName":"Veggies \u0026 Toppings",
"modifierValueId":123,
"price":0.54,
"priceWithoutVat":0.5
},
{
"description":"Pesto",
"modifierId":123,
"modifierName":"Veggies \u0026 Toppings",
"modifierValueId":123,
"price":0.54,
"priceWithoutVat":0.5
},
{
"description":"Steak",
"modifierId":123,
"modifierName":"Protein",
"modifierValueId":123,
"price":1.08,
"priceWithoutVat":1.0
},
{
"description":"Toasted",
"modifierId":123,
"modifierName":"Options",
"modifierValueId":123,
"price":0.0,
"priceWithoutVat":0
},
{
"description":"French Fries",
"modifierId":123,
"modifierName":"Sides",
"modifierValueId":123,
"price":0.0,
"priceWithoutVat":0
}
],
"subitems": []
}
],
"orderPayments":[
{
"amount":"14.26",
"paymentTypeId":123,
"paymentTypeTypeId":4
}
]
}
I’m using all the fields that the API documentation says can be used. You can see that I’m sending both price fields for each item/modifier, the “unitPriceWithoutVat/priceWithoutVat” fields (which I assume should not include taxes) and the “unitPrice/price” fields (which I then assume should include taxes).
The order posts successfully and shows up in the app:
But I have some questions:
- The tax rate shows as 0, even though the items and subtotal include taxes. What is the correct way to handle taxes/the tax rate with the online ordering API? Is there a way to associate the correct tax rate to online orders when posting the request? I looked through the docs but couldn’t find anything.
- It is unusual to show the item price with taxes included in the US, like shown in the app. Is this configurable?
- You can see that the order has a total due of -2.89, that because the paid amount that I’m sending (14.26) includes:
- The items without taxes: 10.50;
- The taxes: 0.87;
- The online ordering fee: 1.00;
- The delivery fee: in this case 0.00 because it’s a takeaway order;
- The tip: 1.89.
This adds up to the 14.26 total, but I couldn’t find a way to send the fees and tip (c, d, e) to the online ordering API, hence the total due of -2.89 (11.37 – 14.26). How should these fees be handled? I see that I can add a tip in the app, but I see no such field on the API.
Regards,
Felipe Zavan.
Answers
How we can implement the service Fee, Delivery fee through API
Sharing a sample JSON which I am using for placing an order. Like I send a tip in the tip key under orderPayment, somewhere I want to add a key to manage Service fee and delivery fee for Online Orders.
{
customerId: 123,
deliveryDate: 2022-02-08T08:54:26.445Z,
type: 'delivery',
status: 'ACCEPTED',
description: 'order',
note: 'foobar',
orderItems: [
{
productId: 32,
amount: 1,
unitPrice: 11.3,
unitPriceWithoutVat: 10,
subitems: [],
totalPrice: 11.3,
totalPriceWithoutVat: 10,
modifiers: []
},
{
productId: 33,
amount: 1,
unitPrice: 2.16,
unitPriceWithoutVat: 2,
subitems: [],
totalPrice: 2.16,
totalPriceWithoutVat: 2,
modifiers: []
},
{
productId: 35,
amount: 1,
unitPrice: 0,
unitPriceWithoutVat: 0,
subitems: [],
totalPrice: 20.34,
totalPriceWithoutVat: 18,
modifiers: [Array]
}
],
orderPayment: {
amount: 46.309999999999995,
paymentTypeId: 12019,
paymentTypeTypeId: 4,
tip: 6
},
orderTaxInfo: [
{
id: 0,
tax: 0,
taxRate: 0,
totalWithTax: 6.51,
totalWithoutTax: 6.51
}
]
}
I am using this API.
https://developers.lightspeedhq.com/resto-api/endpoints/onlineordering/#post-create-a-new-order-for-an-establishment-for-a-customer