Nanobots Producing Megastructures

    fusebill

    1.0.10 • Public • Published

    Fusebill node.js bindings

    Installation

    npm install fingerfoodstudios/fusebill-node

    Documentation

    Documentation is NOT available the API documentation is here http://help.fusebill.com/api-resource-urls

    API Overview

    Every resource is accessed via your fusebill instance:

    var fusebill = require('fusebill')(' your fusebill API key ');
    // fusebill.{ RESOURCE_NAME }.{ METHOD_NAME }

    Every resource method accepts an optional callback as the last argument:

    fusebill.customers.create(
      { primaryEmail: 'customer@example.com' },
      function(err, customer) {
        err; // null if no error occurred
        customer; // the created customer object
      }
    );

    Additionally, every resource method returns a promise, so you don't have to use the regular callback. E.g.

    // Create a new customer and then a new charge for that customer:
    fusebill.customers.create({
      primaryEmail: 'foo-customer@example.com'
    }).then(function(customer) {
      return fusebill.subscription.create({
        customerId: customer.id,
        planFrequencyId: 9999
      });
    }).then(function(charge) {
      // New charge created on a new customer
    }).catch(function(err) {
      // Deal with an error
    });

    To use the Fusebill-Account header, simply pass an extra options hash:

    // Retrieve the balance for a connected account:
    fusebill.balance.retrieve({
      fusebill_account: "acct_foo"
    }).then(function(balance) {
      // The balance object for the connected account
    }).catch(function(err) {
      // Error
    });

    Available resources & methods

    STILL A WORK IN PROGRESS

    Where you see params it is a plain JavaScript object, e.g. { email: 'foo@example.com' }

    Configuration

    • fusebill.setApiKey(' your secret api key ');
    • fusebill.setTimeout(20000); // in ms (default is node's default: 120000ms)

    More information

    http://help.fusebill.com/

    Development

    • NOTE Tests are NOT working * Run the tests using npm:
    $ npm install
    $ npm test

    If you wish, you may run tests using your Fusebill Test API key by setting the environment variable STRIPE_TEST_API_KEY before running tests:

    export FUSEBILL_TEST_API_KEY='sk_test....'
    $ npm test

    Note: On Windows use SET instead of export for setting the FUSEBILL_TEST_API_KEY environment variable.

    Author

    Originally by Ask Bjørn Hansen (ask@develooper.com). Development was sponsored by YellowBot. Adapted for Fusebill by Justin Hamade

    Install

    npm i fusebill

    DownloadsWeekly Downloads

    7

    Version

    1.0.10

    License

    MIT

    Last publish

    Collaborators

    • justinffs