question

stevenblakemore avatar image
stevenblakemore asked ·

Identifying paid line items when orders is split by item

Let's say an order is paid for by line item, and 2 of 4 line items are paid for (for example), leaving 2 line items unpaid. How would I go about identifying which 2 line items that payments has paid for?

From the API documentation I would have imagined the 'lineItemPayments' block via the Payments endpoint would list which line item that payment has paid for (assuming the payType of 'SPLIT_ITEM'), but even though I'm expanding it, it never returns anything. Is this a bug?

10 |2000 characters needed characters left characters exceeded

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

1 Answer

Dan avatar image
Dan answered ·

I made an order with some line items then paid for 4 of the 16 line items with a split by item payment, hit the endpoint and got:

curl "http://<insert server here>/v3/merchants/{mId}/payments?access_token=<insert token here>&expand=lineItemPayments"
{"elements": [ {"id": "1K030TV6TRRRC", "order": {"id": "2J4BFHHF76P10"}, "device": {"id": "8b5d9149-1d12-4532-a786-cfe6bf9eca88"}, "tender": {"href": "http://10.249.24.40:9001/v3/merchants/1RXK2PBVRGCDA/tenders/EYKW6RZDGQ75P", "id": "EYKW6RZDGQ75P"}, "amount": 88000, "tipAmount": 0, "taxAmount": 8000, "cashbackAmount": 0, "employee": {"id": "K3KXSTZE7D7T8"}, "createdTime": 1488485053000, "clientCreatedTime": 1488485052000, "modifiedTime": 1488485061000, "offline": false, "result": "SUCCESS", "lineItemPayments": {"elements": [ {"id": "CFH5QS793BCPP", "paymentRef": {"id": "1K030TV6TRRRC"}, "percentage": 10000000}, {"id": "J5DHYECR9D0MG", "paymentRef": {"id": "1K030TV6TRRRC"}, "percentage": 10000000}, {"id": "KYAGJS14FQ024", "paymentRef": {"id": "1K030TV6TRRRC"}, "percentage": 10000000}, {"id": "QGHHZ0AZJRH8P", "paymentRef": {"id": "1K030TV6TRRRC"}, "percentage": 10000000}]}}, {"id": "R9W3T852ATYB8", "order": {"id": "WM2MJPDS3V3F8"}, "device": {"id": "cdfb129c-880b-d1b7-cf5a-5c4294bcfe5a"}, "tender": {"href": "http://10.249.24.40:9001/v3/merchants/1RXK2PBVRGCDA/tenders/EYKW6RZDGQ75P", "id": "EYKW6RZDGQ75P"}, "amount": 7510, "taxAmount": 0, "cashbackAmount": 0, "employee": {"id": "K3KXSTZE7D7T8"}, "createdTime": 1488396945000, "clientCreatedTime": 1488396945000, "modifiedTime": 1488396946000, "offline": false, "result": "SUCCESS"}, {"id": "JC6MTSASPHCQ2", "order": {"id": "A1V95FK2WH1GP"}, "device": {"id": "cdfb129c-880b-d1b7-cf5a-5c4294bcfe5a"}, "tender": {"href": "http://10.249.24.40:9001/v3/merchants/1RXK2PBVRGCDA/tenders/5EQ85YMCVP0KT", "id": "5EQ85YMCVP0KT"}, "amount": 1277050, "taxAmount": 115664, "cashTendered": 1277050, "employee": {"id": "K3KXSTZE7D7T8"}, "createdTime": 1488243754000, "clientCreatedTime": 1488243702000, "modifiedTime": 1488243754000, "result": "SUCCESS"}, ...
1 comment Share
10 |2000 characters needed characters left characters exceeded

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

Thank you for replying. I have no idea what was going on with my API call but I did a localised test and got the same results as you. Sorry to waste your time but I really appreciate your help as I seemed to have a blind spot here.

0 Likes 0 · ·

Welcome to the
Clover Developer Community