Discount to sale before tax

jbrownjbrown Member Posts: 14

I'm using the api to push sales from prestashop to LightSpeed and running into an issue with discounts.

Our requirement is as follows:

A customer purchases an item and is granted a value ($) discount on the price before tax.

So the final amount to pay is the price of the item - discount * tax%.

I have the following request JSON:


{

  "completed": "true",

  "completeTime": "2020-03-08T21:58:49-04:00",

  "referenceNumber": "ZXNZZVHIM",

  "customerID": "37",

  "employeeID": "1",

  "registerID": "3",

  "shopID": "1",

  "SaleLines": [

    {

      "SaleLine": {

        "unitQuantity": "1",

        "unitPrice": "650",

        "itemID": "402",

        "Note": {

          "note": ""

        }

      }

    }

  ],

  "SalePayments": [

    {

      "SalePayment": {

        "amount": "672.49",

        "paymentTypeID": "3"

      }

    }

  ],

  "Discount": {

    "name": "Rent-To-Own Voucher",

    "discountAmount": "65.10"

  }

}


And the customer has a taxCategoryID based on their invoiced province. This example is Québec (14.975%)


I get the following error:

{

    "httpCode": "400",

    "httpMessage": "Bad Request",

    "message": "Cannot complete an out of balance sale. Payments are insufficient.",

    "errorClass": "OutOfBalanceError",

    "saleID": "147",

    "balance": "74.85"

}


Which seems to be as if the discount is applied after the tax is calculated.


How can I apply the discount to the entire sale before the tax is applied ?

Tags:

1 comment

  • AzTAzT Member Posts: 21

    I'm not a programmer but there are two problems I think I may have noticed. First, I believe that the discount must be the payments entry so it is applied before the payment amount is generated. Second, the discount amount should be negative, currently it is an additional charge. Reasoning: 65.10*1.14975=74.85

Sign In or Register to comment.