airbrite

Airbrite API wrapper

Airbrite Node

Airbrite.io makes it easy to bring e-commerce logic in the client-side of your application. This is an npm wrapper for Airbrite.io.

Add this line to your application's package.json under dependencies:

"airbrite": "*"

And then execute:

$ npm install

Or install separately:

npm install airbrite

Documentation is available at https://www.airbrite.io/documentation

var airbrite = new require('airbrite')("{{Airbrite Access Token}}");

Resources can be accessed through the airbrite instance. These methods accept optional callbacks:

airbrite.product.create({
    "sku": "panda", 
    "price": 100
  }, function(errproduct) {
    err; // null if no error 
    product; // the created product object 
  });

Resource methods also return promises (supported by when.js)

airbrite.customer.create({
    "name": "Bobby Tables",
    "email": "bobby@tables.com"
  })
  .then(function(customer) {
    customer // should have customer data 
  })
  .otherwise(function(err) {
    err; // deal with error 
  });
  • create(params)
  • update(params)
  • list()
  • find(query)
  • findOne(query)
  • destroy(id)
  • address
  • customer
  • event
  • line_item
  • log
  • order
  • payment
  • product
  • shipment
var params = {
  "sku": "panda",
  "price": 100
}
 
airbrite.products.create(params)
  .then(function(product) {
    // product json 
  });
airbrite.orders.create({ ... });
airbrite.customer.update({
        "id": "xyz",
        ...
    });
airbrite.orders.fetch();
airbrite.orders.find({
    "since": "unix time_stamp or date"
    });
airbrite.orders.findOne("xyz");
airbrite.orders.destroy("xyz");

Please email support@airbriteinc.com or add an issue.