Webhooks & Firehoses
Sales Capture
FD1 can be used to create a customised Sales capture terminal in browsers or any environment capable of TCP connections.
You can embed calls to FD1 directly into a SPA or web page. The FD1 websocket and the origin server do not need to be the same domain. The documentation on this page will assume this model is being used.
Mobile Phone Tablet PC Browser |
⇄ | Your Website | |
⇄ | FD1 Websocket | ⇄ | Retail Server |
Pros | Cons |
Easy to develop | Security depends on FD1 config |
Alternatively, you can embed calls to FD1 from your webserver.
Mobile Phone Tablet PC Browser |
⇄ | Your Website | |
⇅ | |||
FD1 Websocket | ⇄ | Retail Server |
Pros | Cons |
Security is FD1 and your Web server | Two moving parts in data flow, rather than one |
Overview of Operation
- Open a websocket to Fieldpine
- Provide authentication details. This is typically required to be sent through the websocket in addition to any HTTP header requirements
- Create a session to indicate who is calling.
- Call fd1.sales.get_activesale_list to recall any sales that are still in progress for this device
- If no sale already exists, call fd1.sales.create_activesale to create a new sale
- Add products to the sale
- Add payment to the sale
- Trigger receipt printing or emailing
Common Extensions
- Scanning Barcodes
- Eftpos Payments
A minimal wireframe demo, without styling, can be viewed here
Opening A Websocket
To open a websocket, is a simple Javascript operation
let address = "https://myretail.xyz/fd1/open_websocket"; let Fd1Socket = new WebSocket(address);
Actual implementations will need to extend this of course.
Authentication
Once the socket is connected, you need to send an authorisation packet. The socket will not process any messages until you have successfully authorised
let msg = { a: "fd1.session.login", v: { apikey: "...your API key ..." } } if (Fd1Socket.readyState == 1) Fd1Socket.send(JSON.stringify(msg));