Closing
Register Closing
Closing the register via the API, just like in our Lightspeed Retail (X-Series) apps, takes a couple of steps.
1. Getting the payments data
The first step is getting all the payments data associated with the register. It is done with a GET
request to /api/2.0/registers/:id/payments_summary
and it returns a payload containing payment totals for all payments types defined in the account. This payload will look like this:
{
"data": {
"register_open_time": "2016-10-12T22:03:45+00:00",
"register_closure_sequence_number": 25,
"payments": [
{
"payment_type_id": "b1e1d70e-f019-11e3-a0f5-b8ca3a64f8f4",
"payment_type_name": "Cash",
"total": "25.30"
},
{
"payment_type_id": "0adaafb3-6583-11e5-fb60-fd093076e9d3",
"payment_type_name": "Gift Card",
"total": "0.00"
},
{
"payment_type_id": "b1e231c1-f019-11e3-a0f5-b8ca3a64f8f4",
"payment_type_name": "Credit Card",
"total": "0.00"
},
{
"payment_type_id": "b8ca3a65-0183-11e4-fbb5-4e632edc2cd8",
"payment_type_name": "Saddlers",
"total": "0.00"
},
{
"payment_type_id": "cbd497b8-0022-11e4-a0f5-b8ca3a64f8f4",
"payment_type_name": "Payment API",
"total": "0.00"
},
{
"payment_type_id": "dc85058a-a683-11e5-e112-51cc5a8ffc96",
"payment_type_name": "Loyalty",
"total": "0.00"
},
{
"payment_type_id": "dc85058a-a683-11e5-ef46-0b1f0d167dea",
"payment_type_name": "DPS",
"total": "0.00"
}
]
}
}
2. Closing the register
The data received in the first step should be presented to the user as the "expected" state of the register to allow them for checking for discrepancies. The user may have to correct the totals with values representing the actual state of the register. In an ideal situation values received from the first request will be the same as the ones used to close the register.
Once the application has all the necessary data the final request can be made, actually closing the register.
It is done with a PUT
request to /api/2.0/registers/:id/actions/close
with the following payload:
{
"payments": [{
"payment_type_id": "b1e1d70e-f019-11e3-a0f5-b8ca3a64f8f4",
"total": "25.30"
}, {
"payment_type_id": "0adaafb3-6583-11e5-fb60-fd093076e9d3",
"total": "0.00"
}, {
"payment_type_id": "b1e231c1-f019-11e3-a0f5-b8ca3a64f8f4",
"total": "0"
}, {
"payment_type_id": "b8ca3a65-0183-11e4-fbb5-4e632edc2cd8",
"total": "0"
}, {
"payment_type_id": "cbd497b8-0022-11e4-a0f5-b8ca3a64f8f4",
"total": "0"
}, {
"payment_type_id": "dc85058a-a683-11e5-e112-51cc5a8ffc96",
"total": "0.00"
}, {
"payment_type_id": "dc85058a-a683-11e5-ef46-0b1f0d167dea",
"total": "0"
}]
}
This request will return a payload with a register object representing the current state of that register like:
{
"data": {
"id": "b1e198a9-f019-11e3-a0f5-b8ca3a64f8f4",
"name": "Main Register",
"outlet_id": "b1e04bd8-f019-11e3-a0f5-b8ca3a64f8f4",
"ask_for_note_on_save": 1,
"print_note_on_receipt": false,
"ask_for_user_on_sale": false,
"show_discounts_on_receipts": true,
"print_receipt": true,
"email_receipt": true,
"invoice_prefix": "MR-",
"invoice_suffix": "-NZ",
"invoice_sequence": 1615,
"button_layout_id": null,
"is_open": false,
"is_quick_keys_enabled": true,
"deleted_at": null,
"register_open_time": null,
"register_close_time": "2016-12-07T19:17:36+00:00",
"register_open_sequence_id": "06bf537b-c783-11e6-f6b9-a06edfdab8a3",
"cash_managed_payment_type_id": "b1e1d70e-f019-11e3-a0f5-b8ca3a64f8f4",
"version": 2442943643
}
}
Updated almost 3 years ago