Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stripe-pdf-invoice

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stripe-pdf-invoice

Stripe PDF invoice generator

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by7.41%
Maintainers
1
Weekly downloads
 
Created
Source

Stripe PDF Invoice 2.0.0

Render

ScreenShot

NB

  • Breaking changes
  • Support for async/await is needed (Node 7.6)

Install

Install the wkhtmltopdf executable

    npm install stripe-pdf-invoice

Usage

Generate invoice in a file

const invoice_id = 'invoice_id';
const stripe_key = 'stripe_key';

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

const stripepdfinvoice = require('./index')(stripe_key, {
  company_name: 'Trusk',
  company_address: '14 rue Charles V',
  company_zipcode: '75004',
  company_city: 'Paris',
  company_country: 'France',
  company_siret: '146-458-246',
  company_vat_number: '568-3587-345',
  company_logo: path.resolve("./batman.jpg"),
  color: '#2C75FF',
});

stripepdfinvoice(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'
})
.then(stream => {
  stream.pipe(fs.createWriteStream('./invoice.pdf'));
  stream.on('end', () => {
    console.log('done');
  });
  stream.on('error', (error) => {
    console.log(error);
  });
});

Use with Express

const invoice_id = 'invoice_id';
const stripe_key = 'stripe_key';

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

const app = express();

const stripepdfinvoice = require('./index')(stripe_key, {
  company_name: 'Trusk',
  company_address: '14 rue Charles V',
  company_zipcode: '75004',
  company_city: 'Paris',
  company_country: 'France',
  company_siret: '146-458-246',
  company_vat_number: '568-3587-345',
  company_logo: path.resolve("./batman.jpg"),
  color: '#2C75FF',
});

app.get('/', function(req, res) {
  res.set('content-type', 'application/pdf; charset=utf-8');
  stripepdfinvoice(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'
  })
  .then(stream => {
    //Force download
    //res.set('Content-Disposition', 'attachment; filename=invoice.pdf');
    stream.pipe(res);
  });
});

app.listen(3000);

Options

number (Number)
currency_position_before (Bool)
currency_symbol (String)
date_format (String)
due_days (Number)
color (Number)

company_name (String)
company_logo (String)
company_address (String)
company_zipcode (String)
company_city (String)
company_country (String)
company_siret (String)
company_vat_number (String)

client_company_name (String)
client_company_address (String)
client_company_zipcode (String)
client_company_city (String)
client_company_country (String)

label_invoice (String)
label_invoice_to (String)
label_invoice_by (String)
label_due_on (String)
label_invoice_for (String)
label_description (String)
label_unit (String)
label_price (String)
label_amount (String)
label_subtotal (String)
label_total (String)
label_vat (String)
label_invoice_by (String)
label_invoice_date (String)
label_company_siret (String)
label_company_vat_number (String)
label_invoice_number (String)
label_reference_number (String)
label_invoice_due_date (String)

FAQs

Package last updated on 01 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc