Skip to content

Invoice-Generator/invoice-generator-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 

Repository files navigation

Invoice Generator API

We created a simple API at Invoice-Generator.com to generate invoice PDFs on the fly. This service has been used internally by us for some time. We believe this could be helpful in your project as well.

The API has a primary endpoint that returns a PDF given details of an invoice. We don't store any of your invoice data.

In addition to PDF, the API can also generate e-invoices in UBL (Universal Business Language) with the invoice PDF embedded. This is useful as the world shifts to e-invoicing because UBL invoices are tricky to generate.

Use Cases

  • Creating invoices for VAT compliance
  • Generate a PDF of an invoice that you have the details to (recipient, line items, etc)
  • Produce invoices for B2B buyers from an order or receipt
  • Selling products or services on credit terms
  • Creating e-invoices in UBL (Universal Business Language)

Table of Contents

Getting Started

In order to begin using the Invoice-Generator.com API, you first need to create an API key. The process for obtaining an API key is as follows.

  1. Create a free Invoice-Generator.com account here, or sign in if you already have one.
  2. Go to the Settings page.
  3. In the "API Keys" section, click New API Key.

Now you have an API key and are ready to start invoicing!

Examples

Simple Invoice

curl https://invoice-generator.com \
  -H "Authorization: Bearer myApiKey" \
  -d from="Nikolaus Ltd" \
  -d to="Acme, Corp." \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d due_date="Feb 16, 2015" \
  -d "items[0][name]"="Starter plan monthly" \
  -d "items[0][quantity]"=1 \
  -d "items[0][unit_cost]"=99 \
  -d notes="Thanks for being an awesome customer\!" \
  -d terms="Please pay by the due date." \
> invoice.pdf

VAT Invoice

Here's a simple cURL example for generating invoices with VAT:

curl https://invoice-generator.com \
  -H "Authorization: Bearer myApiKey" \
  -d from="Nikolaus Ltd%0AVAT ID: 1234" \
  -d to="Foster Moen%0AVAT ID: 4567" \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d payment_terms="Charged - Do Not Pay" \
  -d "items[0][name]"="Starter Plan Monthly" \
  -d "items[0][quantity]"=1 \
  -d "items[0][unit_cost]"=99 \
  -d tax_title="VAT" \
  -d "fields[tax]"="%" \
  -d tax=8 \
  -d notes="Thanks for being an awesome customer\!" \
  -d terms="No need to submit payment. You will be auto-billed for this invoice." \
> invoice.vat.pdf

JSON Input

JSON input is also accepted with the Content-Type header set to application/json

curl https://invoice-generator.com \
  -H "Authorization: Bearer myApiKey" \
  -H "Content-Type: application/json" \
  -d '{"from":"Nikolaus Ltd","to":"Acme, Corp.","logo":"https://example.com/img/logo-invoice.png","number":1,"items":[{"name":"Starter plan","quantity":1,"unit_cost":99}],"notes":"Thanks for your business!"}' \
> invoice.pdf

Localization

It is possible to change the localization used to generate the invoice by supplying a locale in the Accept-Language header. The default locale is en-US.

curl https://invoice-generator.com \
  -H "Authorization: Bearer myApiKey" \
  -H "Accept-Language: fr-FR" \
  -d from="Nikolaus Ltd" \
  -d to="Acme Corp." \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d currency=eur \
  -d date="Feb 9, 2015" \
  -d due_date="Feb 16, 2015" \
  -d "items[0][name]"="Starter plan monthly" \
  -d "items[0][quantity]"=1 \
  -d "items[0][unit_cost]"=99 \
> invoice.pdf

Supported Languages

We currently have translations available in English, French, German, Spanish, and Thai.

Custom Fields