Skip to content

Unofficial node.js client for the Quaderno API

License

Notifications You must be signed in to change notification settings

mdwt/node-quaderno

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-quaderno

Unofficial node.js client for the Quaderno API

About

You can use the Quaderno API to access all Quaderno features, designed around the idea of making tax management and invoicing easy for small businesses.

Installation

Node

Install with npm:

npm install quaderno --save

Getting started

To start, you need an instance of Quaderno configured with your personal Quaderno account name and private api key:

const Quaderno = require('quaderno');
const quaderno = new Quaderno({
  accountName: '<YOUR_QUADERNO_ACCOUNT_NAME>',
  privateApiKey: '<YOUR_QUADERNO_PRIVATE_API_KEY>',
});

Tax calculation

quaderno.taxes.calculate({
  country: 'NL',
})
  .then((tax) => {
    console.log(tax);
  })
  .catch((error) => {
    console.log(error);
  });

Invoice creation

const Quaderno = require('quaderno');

const quaderno = new Quaderno({
  accountName: '<YOUR_QUADERNO_ACCOUNT_NAME>',
  privateApiKey: '<YOUR_QUADERNO_PRIVATE_API_KEY>',
});

const CONTACT = {
  kind: 'person',
  first_name: 'John',
  last_name: 'Doe',
  email: 'john@johndoe.com',
  country: 'NL',
};

async function invoiceCreation() {
  try {
    const tax = await quaderno.taxes.calculate({
      country: CONTACT.country,
    });
    const invoice = await quaderno.invoices.create({
      contact: CONTACT,
      currency: 'EUR',
      items_attributes: [{
        description: 'An arbitrary product',
        quantity: 1.0,
        unit_price: 99.0,
        tax_1_name: tax.name,
        tax_1_rate: tax.rate,
        tax_1_country: tax.country,
      }],
    });
    console.log(invoice);
  } catch (err) {
    console.error(err);
  }
}

invoiceCreation();

About

Unofficial node.js client for the Quaderno API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 82.3%
  • JavaScript 14.3%
  • CSS 3.4%