question

Prasad avatar image
Prasad asked chanel Deactivated answered

Tip Adding Twice to the Order Total in Webpanel and Deducting from Cash Total which Leading to Partially paid

Hi,

Tip is Creating Issue .. adding to the total Twice .. Adding Screenshots and code Merchant Id :- B8P24PC7NNJ7PWe are sending the Totals in Cents from our side to the Clover Apis . Addin the Code :- Payment Code :-
request.post({
                
headers: {'content-type' : 'application/json'},
url: config.clover.baseUrl +merchantId+'/orders/'+jsonString.id+'/payments'+'?access_token='+token,body: JSON.stringify({
"order": {
"id": id},
"tender": {
"id": cashTenderId},
"employee": {
"id":cloverEmpId},
"lineItems":[itemCloverIds], "taxRates": [
{
"isDefault": isDefault,
"rate": rate,
"name": name,
"id": id,
"taxableAmount":tax*100}
],
"taxAmount":tax*100,
"tipAmount":tip*100, // When Tip Commented all order is coming Precise but tip missing totals are precise"amount": total*100 - order.summary.tip*100 // When Tip Deducted Reciept coming Good but the Web panel stuff is Deducting tip and Not Precise})
Order Locking Code :-
request.post({
                
headers: {'content-type' : 'application/json'},
url: config.clover.baseUrl +merchantId+'/orders/'+jsonString.id+'?access_token='+tokenbody: JSON.stringify({
"orderType":
{
"id": cloverOrderType.id},
"total":payment.amount+payment.tipAmount, // this is updating the Top Payment and tip deducts from it if you do it"payments": [payment], // Testing What happens when you just commnet this"discounts":[discount],// Testing what happens when un commented"state":"lock"})

Could you guys Clarify how to Handle tip amount in a precise way ?
Taxes
malfunction.jpg (144.1 KiB)
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

chanel avatar image
chanel Deactivated answered
Tips are not meant to be part of a total of an order. Instead it is part of the Payment object. Here, you're adding the tip as "an extra fee", then applying the payment, which also includes the tip.

So your order total should be ITEM_SUBTOTAL - ORDER_DISCOUNT + TAX.
Your payment object should have AMOUNT (amount paying for the order) + TIP_AMOUNT (the amount the customer will tip).

I hope this was helpful!
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community