saucelabs/stripe-pdf-invoice

Name: stripe-pdf-invoice

Owner: Sauce Labs

Description: Stripe PDF invoice generator

Forked from: jonathanasquier/stripe-pdf-invoice

Created: 2017-07-07 06:06:26.0

Updated: 2017-07-07 06:06:27.0

Pushed: 2017-07-07 06:07:02.0

Homepage: null

Size: 418

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Stripe PDF Invoice

Render

ScreenShot

Install
npm install stripe-pdf-invoice

Install the wkhtmltopdf exec

Usage
Generate invoice in a file
fs = require('fs');
pdfInvoice = require('stripe-pdf-invoice')('STRIPE_KEY', {/*options...*/});
invoiceId = 'STRIPE_INVOICE_ID';

nvoice.generate(invoiceId, {/*options...*/}, function(error, pdfname, stream){
stream.pipe(fs.createWriteStream(pdfname));

Use with Express
express = require('express');
app = express();
pdfInvoice = require('stripe-pdf-invoice')('STRIPE_KEY', {/*options...*/});
invoiceId = 'STRIPE_INVOICE_ID';

get('/', function(req, res) {
res.set('content-type', 'application/pdf; charset=utf-8');
pdfInvoice.generate(invoiceId, {/*options...*/}, function(error, pdfname, stream){
    //Force download
    //res.set('Content-Disposition', 'attachment; filename=' + pdfname + '.pdf');
    stream.pipe(res);
});

Options
er (Number)
ency_position_before (Bool)
ency_symbol (String)
_format (String)
days (Number)
r (Number)

any_name (String)
any_logo (String)
any_address (String)
any_zipcode (String)
any_city (String)
any_country (String)
any_siret (String)
any_vat_number (String)

nt_company_name (String)
nt_company_address (String)
nt_company_zipcode (String)
nt_company_city (String)
nt_company_country (String)

l_invoice (String)
l_invoice_to (String)
l_invoice_by (String)
l_due_on (String)
l_invoice_for (String)
l_description (String)
l_unit (String)
l_price (String)
l_amount (String)
l_subtotal (String)
l_total (String)
l_vat (String)
l_invoice_by (String)
l_invoice_date (String)
l_company_siret (String)
l_company_vat_number (String)
l_invoice_number (String)
l_reference_number (String)
l_invoice_due_date (String)
TODO
Remote logo and logo type test (mmmagic)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.