If we take a step back, a new thirdPartyReference is required anytime you attempt to submit a POST request from Online Orders endpoints. This thirdPartyReference can be any string, such as a random UUID.
Let's take my current payload:
As we can see, I'm using eb9b8ffd-3aa6-4b6d-a3cd-8886048ecd23
as my thirdPartyReference
. From there, I have two options:
-
Wait for the webhook notification; which is the recommended workflow since it contains the order status (fail, success) and the outstanding amount (
"currentAmount"
minus"paidAmount"
) and the"ikentooAccountIdentifier"
(to be used with the apply payment endpoint when applicable): -
If you don't want to wait for webhook event, you can also use the
{{base_url}}/f/finance/:businessLocationId/saleByExternalReference?externalReferenceId=TASK:OO-{{businessLocationId-{{thirdPartyReference}}
The path parameter breakdown is: TASK
+:
+OO
+-
+BusinessLocationId
+-
+thirdPartyReference
Example: TASK:OO-881782555672578-eb9b8ffd-3aa6-4b6d-a3cd-8886048ecd23
(pay attention to the hyphen and colon).
Do note however that if the order fails, this endpoint will return a 404. Additionally, you need the financial-api scope in your API client.
Full API call example:
GET 'https://api.trial.lsk.lightspeed.app/f/finance/881782555672578/saleByExternalReference?externalReferenceId=TASK:OO-881782555672578-eb9b8ffd-3aa6-4b6d-a3cd-8886048ecd23' \
--header 'Authorization: Bearer {{access_token}}'
From my example above, we can see that there is $3.44 outstanding, and I can use the POST /o/op/1/pay
to settle the difference:
To reference the order/receipt I want to apply the payment to, I need use the "ikentooAccountIdentifier"
from above, which was A111584.1
. I will also need to generate a brand new thirdPartyReference; different from the thirdPartyReference I used above.
{
"iKaccountId": 0,
"iKaccountIdentifier": "A111584.1",
"thirdPartyPaymentReference": "{{$randomUUID}}",
"endpointId": "webOO",
"businessLocationId": "{{businessLocationId}}",
"taskTtlInMs": 60000,
"staffId": null,
"deviceId": null,
"paymentMethod": "APM",
"paymentAmount": 3.44,
"tipAmount": 0,
"min_TTL": 0
}
In this example, I used the same paymentMethod
used in my initial payload, but any valid payment method can be used here.
I hope this answers your question, please let me know if it's still unclear or if you have any other questions.