Client API Reference

Overview

The web client application (Web Register) supports a couple of functions allowing browser extensions to interact with the sale.

Methods

Add a line item

/**
 * Add a new line item to the sale
 */
 window.postMessage(JSON.stringify({
   method: 'add-product',
   params: {
     product_id: '0adaafb3-6583-11e5-fb60-d5c48562bd5b',
     sku: 'some_sku',   // optional - can be used instead of product_id
     quantity: 1.234,   // optional
     unit_price: 2.345, // optional
     note: 'via API',   // optional
     confirmed: true    // optional
   }
 }), window.location.origin);

Add a customer

/**
 * Add a customer to the sale
 */
 window.postMessage(JSON.stringify({
   method: 'add-customer',
   params: {
     customer_id: '080027ac-bd2c-11e5-ec95-d12579aa90a3'
   }
 }), window.location.origin);