Invoice generator avatar
Invoice generator

Pricing

$50.00 / 1,000 results

Go to Apify Store
Invoice generator

Invoice generator

Developed by

Maciej

Maciej

Maintained by Community

https://apify.com/ideas/invoice-generator-dc557656

0.0 (0)

Pricing

$50.00 / 1,000 results

0

2

1

Last modified

5 hours ago

Invoice Generator Actor

Automate creation of polished PDF invoices (single or bulk) with pdfkit on Apify.
Supports Excel column paste or a full JSON array of invoices, auto-numbering, defaults, logo, and ZIP output.

Features

  • Subtotal, discount, tax, grand total (auto)
  • Two input styles: Excel-paste textareas or invoicesJson (array)
  • Auto numbering (e.g., 00000, 00001, …)
  • Bulk ZIP + individual PDFs in Key-Value Store
  • Logo + seller block + one-page clamp

Quick start

  1. Install deps in package.json:
{
"dependencies": {
"apify": "^3.0.0",
"jszip": "^3.10.1",
"pdfkit": "^0.14.0"
}
}
  1. Run the actor from Apify UI or API using one of the inputs below.

Input options

A) Excel-paste mode (no JSON needed)

Paste one value per line in the UI:

  • Client Names, Client Addresses, (optional) Client Emails
  • (optional) Invoice Numbers, (optional) Invoice Dates (YYYY-MM-DD)
  • Line Description, (optional) Quantity, Amount

Also set top-level defaults (currency, tax, logo, seller, auto numbering).

Example (what you paste):

Client Names:

ACME LTD
Globex LLC
Initech

Client Addresses:

123 Main St, Springfield
Hauptstraße 1, Berlin
ul. Testowa 2, Warszawa

Line Item — Description:

Monthly subscription
Design sprint (1 day)
Consulting package

Line Item — Amount:

199.99
600
1200

Leave Invoice Numbers empty to let auto numbering handle it.

B) JSON array (full control)

Set invoicesJson (textarea) to a JSON array:

[
{
"invoiceNumber": "",
"invoiceDate": "2025-11-03",
"currency": "USD",
"locale": "en-US",
"onePage": true,
"seller": { "name": "Your Company", "address": "Street 1", "email": "billing@company.com", "vat": "PL1234567890" },
"client": { "name": "Client A", "address": "Road 10", "email": "a@client.com" },
"items": [
{ "item": "SUB-MONTH", "description": "Monthly subscription", "quantity": 1, "amount": 199.99 }
],
"taxRate": 23,
"discount": 0,
"paymentTerms": "Net 14",
"footerNote": "Bank: XYZ • IBAN PL00 0000 0000 0000 0000 0000"
}
]

Empty or missing invoiceNumber will be auto-assigned if auto numbering is on.


Auto numbering

Control via top-level fields:

  • useAutoInvoiceNumbering (boolean, default true)
  • invoiceNumberStart (number, e.g., 0)
  • invoiceNumberWidth (number, e.g., 500000, 00001, …)

Rules: Explicit numbers (from JSON or the “Invoice Numbers” textarea) are kept. Missing ones are generated.


Global invoice date

If the Invoice Dates textarea is empty, set a single date for all with:

  • globalInvoiceDate (YYYY-MM-DD)

Missing per-row dates fall back to globalInvoiceDate, then today.


Output

  • Single invoiceINVOICE-<number>.pdf
  • Multiple invoices → individual PDFs and a ZIP (e.g., INVOICES.zip)
  • Files appear in the run’s Key-Value Store

API usage examples

cURL

curl -X POST "https://api.apify.com/v2/acts/<USERNAME>~invoice-generator/runs?token=<APIFY_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"clientNamesLines": "ACME LTD\nGlobex LLC",
"clientAddressesLines": "123 Main St\nHauptstraße 1",
"lineDescLines": "Monthly subscription\nDesign sprint",
"lineAmountLines": "199.99\n600",
"defaultCurrency": "USD",
"defaultLocale": "en-US",
"defaultTaxRate": 23,
"useAutoInvoiceNumbering": true,
"invoiceNumberStart": 0,
"invoiceNumberWidth": 5,
"globalInvoiceDate": "2025-11-03",
"sellerName": "Your Company Sp. z o.o.",
"sellerAddress": "ul. Przykładowa 1, 00-000 Warszawa",
"sellerEmail": "billing@company.com",
"sellerVat": "PL1234567890",
"zipName": "INVOICES.zip"
}'

Node.js (Apify Client)

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('<USERNAME>/invoice-generator').call({
invoicesJson: JSON.stringify([
{
invoiceNumber: "",
invoiceDate: "2025-11-03",
currency: "EUR",
locale: "de-DE",
seller: { name: "Your Company", address: "Street 1", email: "billing@company.com", vat: "PL1234567890" },
client: { name: "Client B GmbH", address: "Hauptstraße 1, Berlin", email: "ap@b.com" },
items: [{ item: "Consulting", description: "8h package", quantity: 8, amount: 1200 }],
taxRate: 19,
paymentTerms: "Net 14"
}
]),
defaultCurrency: "EUR",
defaultLocale: "de-DE",
useAutoInvoiceNumbering: true,
invoiceNumberStart: 42,
invoiceNumberWidth: 5
});
console.log('Run:', run.data.id);

Common formatting pitfalls (and fixes)

  • Always fence code with triple backticks and a language hint:
    • $
  • Valid JSON only in invoicesJson (no comments, no trailing commas).
  • When pasting columns: one value per line; blank lines are ignored.
  • If your README shows curly braces weirdly inside Markdown lists, put them in a fenced code block.

Troubleshooting

  • “invoicesJson must be a non-empty JSON array”
    Your textarea isn’t valid JSON or it’s empty. Paste an array [...].

  • Got multiple pages unexpectedly
    Ensure defaultOnePage: true (or set onePage: true per invoice). Long item lists get truncated with “... and N more item(s)”.

  • Logo not showing
    defaultLogoPath must point to a file the actor can read (e.g., uploaded via schema file field). Paths are inside the actor’s sandbox.