See llms.txt for all machine-readable content.

Back to Templates

Close monthly Stripe revenue with Stripe, ZUGFeRD, Google Sheets, Gmail and DATEV

Quick overview

Runs monthly to pull paid invoices, credit notes and balance transactions from Stripe, render EN 16931 ZUGFeRD/Factur-X e-invoices with Dynamic Document API, reconcile payments, refunds and VAT, write a journal to Google Sheets, CSV and DATEV, and file everything in Google Drive and email your accountant with Gmail.

How it works

  1. Runs on a schedule on the 1st of every month and determines the month to close (previous month by default, or a manual YYYY-MM override).
  2. Retrieves paid Stripe invoices, Stripe credit notes, and Stripe balance transactions for the month (including expanded payment and source details).
  3. Fetches up to 100 line items per document from Stripe and maps invoices and credit notes into EN 16931 invoice data, flagging documents that cannot be mapped.
  4. Sends the mapped documents to Dynamic Document API to render ZUGFeRD/Factur-X PDF e-invoices in a single batch and collects per-document render results.
  5. Reconciles Stripe balance activity against the month’s documents, calculates VAT totals and reverse-charge breakdowns, and compiles a “to fix” list for missing documents, currency mismatches, and other exceptions.
  6. Writes one journal row per document and VAT rate to Google Sheets (upserting by a unique entry ID) and generates a journal CSV plus an optional DATEV Buchungsstapel export file.
  7. Renders a month report PDF with Dynamic Document API, uploads the report and exports (and the e-invoice ZIP when available) to a Google Drive month folder, emails the accountant via Gmail, and sends an alert email if items need fixing.

Setup

  1. Install the verified community node Dynamic Document API from the nodes panel (package @dynamic-document-api/n8n-nodes-dynamic-document-api, tested with 0.1.1 on n8n 2.44.4, install guide: https://dynamicdocumentapi.com/docs/n8n). In the Dynamic Document API dashboard, add the Standard invoice template from the gallery and create an API key. Batches need the Starter plan or higher, the embedded e-invoice XML the Growth plan.
  2. Create a Google Sheet whose first row has the columns entry_id, month, type, number, date, customer, country, customer_vat_id, vat_category, vat_rate, net, vat, gross, rounding, currency, original_invoice, e_invoice and stripe_link.
  3. Add credentials for Stripe, Dynamic Document API, Google Sheets, Google Drive and Gmail, then choose your template in Render e-invoices as a batch and your sheet in Write journal to Google Sheets.
  4. Set a Google Drive parent folder ID for monthly filing, and ensure the connected Google account has access to create folders and upload files there.
  5. Update the “Close settings” values (seller details, currency/timezone, recipient emails, and DATEV parameters/accounts if you use DATEV) and optionally run once with a past month value to validate outputs before enabling the schedule.

Requirements

  • n8n (Cloud or self-hosted) with the verified Dynamic Document API community node, tested with 0.1.1 on n8n 2.44.4
  • Dynamic Document API account: batches need the Starter plan or higher, the embedded e-invoice XML the Growth plan (on Starter the PDFs come without it). A test API key renders free e-invoices with a TEST watermark
  • Stripe account that bills with Stripe Invoicing, with customer billing addresses
  • Google account with Google Sheets, Google Drive and Gmail credentials in n8n

Customization

  • Change the revenue, fee and clearing accounts in Close settings (datev_revenue_accounts, datev_fee_account, datev_stripe_account). The defaults are SKR03; the DATEV sticky note lists the SKR04 accounts
  • Set untaxed_category and untaxed_reason for lines without VAT, and reverse_charge_note for EU business customers
  • Edit the e-invoice design in the Dynamic Document API template editor, or the month report's HTML in Write month report
  • Set datev_export to false if your accountant doesn't use DATEV, or swap Gmail for Outlook or SMTP

Additional info

Tested against a Stripe sandbox with invoices at 19 % and 7 %, an EU reverse-charge customer, a customer outside the EU, a customer without an address, a credit note with a refund, a refund without a credit note and a payment without an invoice. All e-invoices passed veraPDF (PDF/A-3b) and the KoSIT validator (EN 16931) without errors or warnings, and the DATEV file passed the field patterns of DATEV's format check program. A month without documents still sends the report; a failed batch is reported and the journal is still written. A second run of the same month updates the journal rows instead of adding them. The JSON contains no credentials or private IDs. Agree the DATEV accounts and tax keys with your accountant before the first import.