Events
The shift payload includes a location object with the station where the shift was opened. Its structure is the same as Shift location (shiftLocation) described in structure: it includes name, stationId, country, province, shortcode, latitude, longitude, costCenter, operatingCompanyId, operatingCompanyName, locationPurchaseLimits, primaryCurrencyCode, acceptedCurrencies, externalId, timeZone (IANA time zone, e.g. America/Toronto), regionId, and regionName.
regionId and regionName are taken from the station assigned to the shift at the moment the shift is opened. Both fields are emitted on shift.created, shift.closed, and shifts.updated (as well as shifts.deposit.created). The same values are then copied to the transaction's shiftLocation when a transaction is created from this shift, so they will also appear on transaction.completed, transaction.updated, and transaction.delivered payloads. When the station has no region assigned, both fields are emitted as empty strings.
| Action |
Event name |
| opening a shift |
shift.created |
| updating shift requires-agency-shift-closure (PUT /shifts/:shiftId/requires-agency-shift-closure) |
shifts.updated |
| adding deposits to a shift (POST /shifts/:shiftId/deposits or closing a shift with deposits) |
shifts.deposit.created |
| adding manual ticket to a shift (POST /shifts/:shiftId/manual-tickets) |
shifts.manualTicket.created |
| closing a shift |
shift.closed |
Payload example (shifts.updated)
Emitted when updating the requires-agency-shift-closure property via PUT /shifts/:shiftId/requires-agency-shift-closure. The data object contains the updated shift (same structure as the generic shift payload below).
{
"id": "string",
"attemptId": "string",
"livemode": "boolean",
"created": 0,
"event": "shifts.updated",
"data": {
"_id": "string",
"variance": 0,
"userId": "string",
"user": { "username": "string", "email": "string" },
"shiftNumber": "string",
"location": {},
"internalId": "",
"deposits": [],
"comment": "string",
"closedAt": {},
"closed": false,
"agencyId": "string",
"accountId": "string",
"deleted": false,
"createdAt": { "value": "string", "offset": 0 },
"updatedAt": { "value": "string", "offset": 0 }
}
}
Payload example
{
"id": "string",
"attemptId": "string",
"livemode": "boolean",
"created": "int",
"event": "string",
"data": {
"_id": "string",
"variance": "int",
"userId": "string",
"user": {
"username": "string",
"email": "string"
},
"shiftNumber": "string",
"location": {
"stationId": "string",
"name": "string",
"country": "string",
"province": "string",
"shortcode": "string",
"latitude": "string",
"longitude": "string",
"costCenter": "string",
"operatingCompanyId": "string",
"operatingCompanyName": "string",
"locationPurchaseLimits": {},
"primaryCurrencyCode": "string",
"acceptedCurrencies": [],
"externalId": "string",
"timeZone": "string",
"regionId": "string",
"regionName": "string"
},
"internalId": "",
"deposits": [],
"comment": "string",
"closedAt": {},
"closed": "boolean",
"agencyId": "string",
"accountId": "string",
"deleted": "boolean",
"createdAt": {
"value": "string",
"offset": "int"
},
"updatedAt": {
"value": "string",
"offset": "int"
}
}
}
Payload fields (shift payload)
| Field |
Type |
Description |
| data._id |
string |
Shift id (ObjectId) |
| data.variance |
number |
Cash variance amount |
| data.userId |
string |
User id (ObjectId) who opened the shift |
| data.user |
object |
User info (username, email) |
| data.shiftNumber |
string |
Shift number |
| data.location |
object |
Station/location where the shift was opened (see structure) |
| data.internalId |
string |
Internal id |
| data.deposits |
array |
Deposits for the shift |
| data.comment |
string |
Closure comment |
| data.closedAt |
object |
Close timestamp |
| data.closed |
boolean |
Whether the shift is closed |
| data.agencyId |
string |
Agency id |
| data.accountId |
string |
Account id |
| data.deleted |
boolean |
Soft-delete flag |
| data.createdAt |
object |
Creation timestamp (value, offset) |
| data.updatedAt |
object |
Last update timestamp (value, offset) |
Payload example deposit created
{
"attemptId": "bbbe2471-131a-4bce-a1a9-3ccff1aa2139",
"created": 1682013279,
"data": {
"id": "string",
"bag": "1",
"comment": "",
"deposit": 23,
"depositMXN": 300,
"depositPEN": 200,
"slip": "3",
"userId": "string",
"partialDeposit": "boolean",
"partialDepositOrder": 0,
"location": {
"stationId": "string",
"name": "string",
"country": "string",
"province": "string",
"shortcode": "string",
"latitude": "string",
"longitude": "string",
"costCenter": "string",
"operatingCompanyId": "string",
"operatingCompanyName": "string",
"locationPurchaseLimits": {},
"primaryCurrencyCode": "string",
"acceptedCurrencies": [],
"externalId": "string",
"timeZone": "string",
"regionId": "string",
"regionName": "string"
},
"user": {
"username": "string",
"email": "string"
},
"operatingCompanyId": "string",
"operatingCompanyName": "string",
"createdAt": {
"value": "string",
"offset": "int"
},
"type": "string"
},
"event": "shifts.deposit.created",
"id": "857dc9d7-19b9-4591-a059-df21a59ea851",
"livemode": false
}
Payload fields (shifts.deposit.created)
| Field |
Type |
Description |
| data.id |
string |
Deposit id (ObjectId) |
| data.bag |
string |
Bag identifier |
| data.comment |
string |
Deposit comment |
| data.deposit |
number |
Deposit amount (primary currency) |
| data.depositMXN |
number |
Deposit amount in MXN (if applicable) |
| data.depositPEN |
number |
Deposit amount in PEN (if applicable) |
| data.slip |
string |
Slip identifier |
| data.userId |
string |
User id (ObjectId) |
| data.partialDeposit |
boolean |
Whether this is a partial deposit |
| data.partialDepositOrder |
number |
Order of partial deposit |
| data.location |
object |
Station/location (see structure) |
| data.user |
object |
User info (username, email) |
| data.operatingCompanyId |
string |
Operating company id |
| data.operatingCompanyName |
string |
Operating company name |
| data.createdAt |
object |
Creation timestamp (value, offset) |
| data.type |
string |
Deposit type |
Payload example manual ticket created
{
"attemptId": "a992ea6d-d264-4f2d-a460-db3451f3e2c1",
"created": 1684159205,
"data": {
"manifestDate": {
"offset": 0,
"value": "2023-05-15T00:00:00.000Z"
},
"scheduleName": "SC-name",
"tickets": [
{
"price": 999,
"ticketNumber": "TN-128823"
}
]
},
"event": "shifts.manualTicket.created",
"id": "d0e42807-3fcb-4602-a438-3c58ad74b199",
"livemode": false
}
Payload fields (shifts.manualTicket.created)
| Field |
Type |
Description |
| data.manifestDate |
object |
Manifest date (value, offset) |
| data.scheduleName |
string |
Schedule name |
| data.tickets |
array |
List of manual tickets |
| data.tickets[].price |
number |
Ticket price |
| data.tickets[].ticketNumber |
string |
Ticket number |