@adrianchia/recurly

An Unofficial Recurly client for the Node.js

Usage no npm install needed!

<script type="module">
  import adrianchiaRecurly from 'https://cdn.skypack.dev/@adrianchia/recurly';
</script>

README

Node Recurly

Build Status David Dependency Status Known Vulnerabilities

An unofficial Node.js client for Recurly.

Refer to https://dev.recurly.com/docs for more information.

Installation

To use node recurly in your Node.js app, run the following. The Node.js environment should support basic ES2015 syntax such as const and arrow function.

npm install --save @adrianchia/recurly

Getting started

Initialize recurly via

const Recurly = require('@adrianchia/recurly');
const recurly = new Recurly({
  apiKey: '<Your Recurly private key>',
  subdomain: '<Your recurly subdomain>' // for example, if your Recurly url is https://acme.recurly.com, enter 'acme'
});

// Do the rest of Recurly operations such as list account
recurly.accounts.list()
  .then(response => console.log(JSON.stringify(response.data)))
  .catch(err => console.error(JSON.stringify(err)));

// or create an account
let newAccount = {
  account: {
    account_code: 'foo@example.com',
    email: 'foo@example.com',
    first_name: 'Foo',
    last_name: 'Example',
    address: {
      address1: '123 Main St',
      city: 'San Francisco',
      state: 'CA',
      zip: '94105',
      country: 'US'
    }
  }
};

recurly.accounts.create(newAccount)
  .then(response => console.log(JSON.stringify(response.data)))
  .catch(err => console.error(JSON.stringify(err)));