Sale API creates a sale for a diffferent customer

E_G_E_G_ Member Posts: 2

Hi community, so here is my problem. I've used this tutorial to create a new Sale in my store.

https://developers.lightspeedhq.com/retail/tutorials/sales/

Based on this tutorial I've create the following payload:

{
  "employeeID": 27,
  "registerID": 1,
  "shopID": 1,
  "customerID": 4638,
  "completed": true,
  "SaleLines": {
    "SaleLine": [
      {
        "itemID": 10692,
        "unitQuantity": 1
      }
    ]
  },
  "SalePayments": {
    "SalePayment": {
      "amount": 727.94,
      "paymentTypeID": 3
    }
  },
  "completeTime": "2020-04-23T17:50:53.000Z",
  "referenceNumber": 103
}

However, the response from the API Sale, came different than what I expected. The client details and price are from another order.


Sales created: { '@attributes': { count: '1' },
  Sale:
   { saleID: '113373',
     timeStamp: '2020-04-23T19:30:59+00:00',
     discountPercent: '0',
     completed: 'true',
     archived: 'false',
     voided: 'false',
     enablePromotions: 'false',
     isTaxInclusive: 'false',
     createTime: '2020-04-27T18:50:52+00:00',
     updateTime: '2020-04-27T18:50:52+00:00',
     completeTime: '2020-04-23T19:30:59+00:00',
     referenceNumber: '104',
     referenceNumberSource: '',
     tax1Rate: '0.05',
     tax2Rate: '0.07',
     change: '0',
     receiptPreference: 'printed',
     displayableSubtotal: '122.97',
     ticketNumber: '220000113373',
     calcDiscount: '0',
     calcTotal: '131.92',
     calcSubtotal: '122.97',
     calcTaxable: '122.97',
     calcNonTaxable: '0',
     calcAvgCost: '36',
     calcFIFOCost: '36',
     calcTax1: '6.15',
     calcTax2: '2.8',
     calcPayments: '131.92',
     total: '131.92',
     totalDue: '131.92',
     displayableTotal: '131.92',
     balance: '0',
     customerID: '756',
     discountID: '0',
     employeeID: '27',
     quoteID: '0',
     registerID: '1',
     shipToID: '0',
     shopID: '1',
     taxCategoryID: '1',
     Customer:
      { customerID: '756',
        firstName: 'Fiona',
        lastName: 'Shrek',
        dob: '2019-02-08T08:00:00+00:00',
        archived: 'false',
        title: '',
        company: '',
        companyRegistrationNumber: '',
        vatNumber: '',
        createTime: '2017-03-04T18:51:16+00:00',
        timeStamp: '2019-02-09T01:21:00+00:00',
        contactID: '817',
        creditAccountID: '2440',
        customerTypeID: '0',
        discountID: '0',
        employeeID: '0',
        noteID: '3284',
        taxCategoryID: '0' },
     Shop:
      { shopID: '1',
        name: 'Baby    Square',
        serviceRate: '0',
        timeZone: 'US/Pacific',
        taxLabor: 'false',
        labelTitle: 'Shop Name',
        labelMsrp: 'false',
        archived: 'false',
        timeStamp: '2019-04-20T22:40:04+00:00',
        companyRegistrationNumber: '',
        vatNumber: '',
        zebraBrowserPrint: 'true',
        contactID: '2',
        taxCategoryID: '1',
        receiptSetupID: '1',
        vendorID: '0',
        ccGatewayID: '1',
        gatewayConfigID: '',
        priceLevelID: '1' },
     TaxCategory:
      { taxCategoryID: '1',
        isTaxInclusive: 'false',
        tax1Name: 'Sales Tax ',
        tax2Name: '',
        tax1Rate: '0.05',
        tax2Rate: '0.07',
        timeStamp: '2016-11-22T16:45:32+00:00',
        TaxCategoryClasses: [Object] },
     SaleLines: { SaleLine: [Array] },
     SalePayments: { SalePayment: [Object] },
     taxTotal: '8.95' } } 


And it happens often when creating a new Sale through the API. I was wondering if there is a sort of queue, when I place a request, the first item on that queue is placed instead?


Any suggestions or ideas on why I don't see a response with customerID 4638?


Thanks!

1 comment

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator

    Hi

    Thank you for contacting us.

    Could you please send me the request URL and the accountID? So I can do a test.

Sign In or Register to comment.