Ticket

POS clients can record transactions using this API. The client must use the Satellite Tag algorithm to generate the barcode for each ticket.

All the codes for a specific purchase should follow the following convention:

  • Purchase code: a barcode’s base
  • Purchase Item code: the purchase code + zero padded incremental counter starting from zero (0000, 0001, … 9999)
  • Ticket Barcode: a barcode generated using the purchase code as base

A transaction recorded through a POS should always be accepted by the system because once the transaction is confirmed there will be a customer somewhere walking around with some tickets that must be loaded into the system. For this reason, while the system will try and load all the information as correctly as it can, it will still trust the device and store the data anyway, even if some inconsistencies are detected.

POST /ticket/transaction

A transaction is composed of global fields and transaction items.

The request should hold the following parameters:

  • event_id: the ID of the event this purchase is for
  • code: the purchase code
  • totalAmount: the total amount (in cents of a dollar)
  • notes: staff entered note
  • createdAt: the timestamp of the purchase
  • recordedBy_rfid: the RFID of the staff member recording this transaction
  • transactions: the list of money transactions logged for this purchase, each one should have:
    • paymentMethod: can be “cash” or “card”
    • amount: the amount paid using this method (in cents of a dollar)
    • change: the change given back to the customer (if available and only for cash transactions)
    • transactionId: the identifier of the transaction (if available, for example the credit card transaction reference)
  • items: the items purchased in this transaction. each item should have:
    • product_id: the ID of the product sold
    • quantity: the quantity sold
    • description: a description of the product (should be the product label, we store this in case it changes so that we have a snapshot of what was sold at the time of purchase)
    • unitAmount: product price per unit (in cents of a dollar)
    • totalAmount: total price for this line item (in cents of a dollar, usually this is the quantity times the price per unit)
    • discountAmount: total discount applied to this line item (in cents of a dollar)
    • tickets: this is a list of tickets that have been printed for this line item. Each ticket should have the following properties:
      • product_id: the product ID for this ticket (usually this is the same as the line item but sometimes it’s a “child product” like for family passes when some tickets for adults and some tickets for children are issued)
      • description: a description of the product (should be the product label)
      • barcode: the barcode associated to this ticket (should be generated using the barcode generation algorithm)

This is an example of a request:

{
  "event_id": 3,
  "code": "GJXS0LM6RYG37",
  "totalAmount": 240,
  "notes": "fake notes scanning device didn't work",
  "createdAt": "564465456465",
  "recordedBy": "15646545646",
  "transactions": [
    {
      "paymentMethod": "cash",
      "amount": 100,
      "change": 400
    },
    {
      "paymentMethod": "card",
      "transactionId": "hfjkdshfjksfh jksdh f",
      "amount": 140
    }
  ],
  "items": [
    {
      "product_id": 4,
      "quantity": 3,
      "description": "Adult",
      "unitAmount": 30,
      "totalAmount": 90,
      "discountAmount": null,
      "tickets": [
        {
          "product_id": 4,
          "description": "Adult",
          "barcode": "GJXS0LM6RYG37XJX01"
        },
        {
          "product_id": 4,
          "description": "Adult",
          "barcode": "GJXS0LM6RYG37XJX09"
        },
        {
          "product_id": 4,
          "description": "Adult",
          "barcode": "GJXS0LM6RYG37XJX03"
        }

      ]
    },
    {
      "product_id": 3,
      "quantity": 1,
      "description": "Family Pass",
      "unitAmount": 150,
      "totalAmount": 150,
      "discountAmount": null,
      "tickets": [
        {
          "product_id": 8,
          "description": "Adult",
          "barcode": "GJXS0LM6RYG37XJX04"
        },
        {
          "product_id": 8,
          "description": "Adult",
          "barcode": "GJXS0LM6RYG37XJX05"
        },
        {
          "product_id": 9,
          "description": "Child",
          "barcode": "GJXS0LM6RYG37XJX06"
        },
        {
          "product_id": 9,
          "description": "Child",
          "barcode": "GJXS0LM6RYG37XJX07"
        },
        {
          "product_id": 9,
          "description": "Child",
          "barcode": "GJXS0LM6RYG37XJX08"
        }
      ]
    }
  ]
}