FD1 Client Protocol
 
Library Developer Home FD1 Client Protocol Home Concepts Reading Data Writing Data Protocol Defined Servers Connect & Authenticate Proxies & Tunnels
Webhooks Programming Support Logging Minor Facts State Facts Response Format How To Guides eCommerce Sites Custom Point of Sale Customer Access Bulk Downloads Major APIs / Endpoints All Endpoints Products Sales SalesBuilder Session Sale Capture General Purpose Data Capture Devices Barcode Scanners Eftpos IoT Sensors Power Outlets Printing Scales Security Cameras Purchasing / Supply Side Purchase Orders Invoices Invoice Payments Document Capture Rare APIs / Endpoints SSL Certificates API Key Management Diagnositics Server to Client Messages Overview Resources / Objects Purchase Order Invoice Payable Invoice Payment Product Supplier Location Sale Lines Sale Delivery Details Sales Price Maps Employees Carriers Payments Product Kits Department 1 Customers

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
ProsCons
Easy to developSecurity 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
ProsCons
Security is FD1 and your Web serverTwo moving parts in data flow, rather than one

Overview of Operation

  1. Open a websocket to Fieldpine
  2. Provide authentication details. This is typically required to be sent through the websocket in addition to any HTTP header requirements
  3. Create a session to indicate who is calling.
  4. Call fd1.sales.get_activesale_list to recall any sales that are still in progress for this device
  5. If no sale already exists, call fd1.sales.create_activesale to create a new sale
  6. Add products to the sale
  7. Add payment to the sale
  8. 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));

Creating a Session