Out of balance sale with balance -0

david_dotdevdavid_dotdev Member Posts: 5

Hi, I'm trying to put up a Sale to Lightspeed via the API, and the sale consists of a gift card top up, with a rounding misc line item (whose value is negative) to account for currency conversion rounding error. The total of the amounts correctly sums to 0 (as is testified by the returned payload, below), however, the Lightspeed API refused with an out of balance error. Can somebody help out with this issue?

The request payload is roughly like the following:

{

"employeeID": "123",

"registerID": "1",

"shopID": "1",

"customerID": "123456",

"completed": true,

"taxCategoryID": "1",

"SaleLines": {

"SaleLine": [

{

"unitQuantity": "1",

"unitPrice": "-0.51",

"discountAmount": "0",

"employeeID": "123",

"taxClassID": "0",

"tax": "false",

"customerID": "234567",

"avgCost": "0",

"fifoCost": "0",

"Note": {

"note": "Rounding adjustment due to currency conversion",

"isPublic": "false"

}

}

]

},

"SalePayments": {

"SalePayment": [

{

"amount": "30.49",

"paymentTypeID": "1"

},

{

"amount": "-31",

"creditAccountID": "34567",

"paymentTypeID": "2"

}

]

}

}


And the response from the API is as follows:

{

"httpCode": "400",

"httpMessage": "Bad Request",

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

"errorClass": "OutOfBalanceError",

"saleID": "1234",

"balance": "-0"

}

3 comments

  • gregaricangregarican Member Posts: 625 

    I don't see the "real" sale line, just the rounding one. Where is the other sale line?

  • david_dotdevdavid_dotdev Member Posts: 5

    The sale is actually a gift card sale, which is why there is no other sale line entry. If you look at the payments section of the payload, you'll see an entry for the credit account top up for the gift card.

  • vishaldjanioutlookvishaldjanioutlook Member Posts: 5

    Hi,

    I got the error when i filter the record with total=0 in Sale.json api call.

    PFA snapshot for the same.

    Looking for your prompt reply.

    Thanks,

    Vishal Jani


Sign In or Register to comment.