jonathanasquier/stripe-pdf-invoice

Name: stripe-pdf-invoice

Description: Stripe PDF invoice generator

Created: 2015-05-25 12:13:38.0

Updated: 2018-01-09 01:12:45.0

Pushed: 2017-08-25 18:19:53.0

Homepage: null

Size: 487

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Stripe PDF Invoice 2.0.0

Render

ScreenShot

NB
Install

Install the wkhtmltopdf executable

npm install stripe-pdf-invoice
Usage
Generate invoice in a file
t invoice_id = 'invoice_id';
t stripe_key = 'stripe_key';

t fs = require('fs');
t path = require('path');

t stripepdfinvoice = require('./index')(stripe_key, {
mpany_name: 'Trusk',
mpany_address: '14 rue Charles V',
mpany_zipcode: '75004',
mpany_city: 'Paris',
mpany_country: 'France',
mpany_siret: '146-458-246',
mpany_vat_number: '568-3587-345',
mpany_logo: path.resolve("./batman.jpg"),
lor: '#2C75FF',


pepdfinvoice(invoice_id, {
ient_company_name: 'My Company',
ient_company_address: '1 infinite Loop',
ient_company_zipcode: '95014',
ient_company_city: 'Cupertino, CA',
ient_company_country: 'USA',
ceipt_number: 'ER56T67'

n(stream => {
ream.pipe(fs.createWriteStream('./invoice.pdf'));
ream.on('end', () => {
console.log('done');
;
ream.on('error', (error) => {
console.log(error);
;

Use with Express
t invoice_id = 'invoice_id';
t stripe_key = 'stripe_key';

t express = require('express');
t fs = require('fs');
t path = require('path');

t app = express();

t stripepdfinvoice = require('./index')(stripe_key, {
mpany_name: 'Trusk',
mpany_address: '14 rue Charles V',
mpany_zipcode: '75004',
mpany_city: 'Paris',
mpany_country: 'France',
mpany_siret: '146-458-246',
mpany_vat_number: '568-3587-345',
mpany_logo: path.resolve("./batman.jpg"),
lor: '#2C75FF',


get('/', function(req, res) {
s.set('content-type', 'application/pdf; charset=utf-8');
ripepdfinvoice(invoice_id, {
client_company_name: 'My Company',
client_company_address: '1 infinite Loop',
client_company_zipcode: '95014',
client_company_city: 'Cupertino, CA',
client_company_country: 'USA',
receipt_number: 'ER56T67'

hen(stream => {
//Force download
//res.set('Content-Disposition', 'attachment; filename=invoice.pdf');
stream.pipe(res);
;


listen(3000);
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)

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.