Query by PaymentType

Is it possible to query by PaymentType?
I would like to do something like https://api.lightspeedapp.com/API/Account/{accountID}/DisplayTemplate/Sale.json?timeStamp=%3E%3C,2019-08-02,2019-08-03&paymentType=9
Is this possible?
Or I could do something like https://api.lightspeedapp.com/API/Account/{accountID}/Sale.json?timeStamp=%3E%3C,2019-08-02,2019-08-03&paymentType=9
Is there anything like that?
Best Answers
-
Adrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator
Hey @jaloway,
Great question!
If you look on our documentation for Payment type here:
You'll find each payment type is referenced by its primary key "paymentTypeID". When we look on the Sale object we can
You can thus query the Sale endpoint and see that when you load the SalePayments relation the paymentTypeID appears as a nested object in the SalePayments object.
An example query of how to write this would be so:
https://api.lightspeedapp.com/API/Account/{accountID}/Sale.json?load_relations=["SalePayments"]&SalePayments.paymentTypeID={{paymentTypeID}}
or in your specific case:
Hope this helps!
Adrian Samuel
Software Developer
Lightspeed HQ
Answers
Thank you! That works!
For some reason it seems like this is no longer working. Did something change? I am getting back all the Sales between the two dates and the payment type id is no longer filtering. https://api.lightspeedapp.com/API/Account/{accountID}/Sale.json?timeStamp=><,2020-10-05,2020-10-09&load_relations=["SalePayments"]&=SalePayments.paymentTypeID=20
Hi @jaloway,
I see you're having an = which isn't correct.
Please try this:
https://api.lightspeedapp.com/API/Account/{accountID}/Sale.json?timeStamp=><,2020-10-05,2020-10-09&load_relations=["SalePayments"]&SalePayments.paymentTypeID=20