{"product_id":"n8n-webhook-workflow-invoices-payments-refunds-to-google-sheets","title":"n8n Webhook Workflow: Invoices, Payments \u0026 Refunds to Google Sheets","description":"\u003ch3\u003eAutomatically log invoices, payments \u0026amp; refunds—then generate PDFs, upload them to Google Drive, and send emails\u003c\/h3\u003e\n\u003cp\u003eThis n8n webhook workflow receives invoice, payment, and refund events via an authenticated POST request, validates them, prevents duplicates, writes all records to Google Sheets, generates invoice PDFs (with \u003cstrong\u003en8n-nodes-pdfbro\u003c\/strong\u003e), uploads PDFs to \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e, and sends invoice\/receipt\/refund notifications through \u003cstrong\u003eSMTP\u003c\/strong\u003e.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAccepts webhook events\u003c\/strong\u003e: Receives a POST webhook event and checks required fields such as \u003cstrong\u003eevent_id\u003c\/strong\u003e and \u003cstrong\u003eevent_type\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRoutes by event_type\u003c\/strong\u003e: Uses event_type to process only supported events:\n    \u003cul\u003e\n      \u003cli\u003e\u003cstrong\u003einvoice.created\u003c\/strong\u003e\u003c\/li\u003e\n      \u003cli\u003e\u003cstrong\u003epayment.received\u003c\/strong\u003e\u003c\/li\u003e\n      \u003cli\u003e\u003cstrong\u003erefund.completed\u003c\/strong\u003e\u003c\/li\u003e\n    \u003c\/ul\u003e\n    Unsupported event types are rejected with a \u003cstrong\u003e400\u003c\/strong\u003e response.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevents duplicates\u003c\/strong\u003e: For each event type, it checks Google Sheets for existing records (by \u003cstrong\u003einvoice_id\u003c\/strong\u003e, \u003cstrong\u003epayment_id\u003c\/strong\u003e, or \u003cstrong\u003erefund_id\u003c\/strong\u003e) and returns a conflict\/validation response when duplicates are detected.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003einvoice.created\u003c\/strong\u003e: Appends the invoice to an invoice sheet, generates a PDF with \u003cstrong\u003ePdfBro\u003c\/strong\u003e, uploads it to \u003cstrong\u003eGoogle Drive\u003c\/strong\u003e, emails the invoice via \u003cstrong\u003eSMTP\u003c\/strong\u003e, then updates the invoice row with the PDF link and sent status.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003epayment.received\u003c\/strong\u003e: Appends payment details to a payments sheet, looks up the related invoice, and sends either a standard receipt or a “paid in full” email based on the invoice’s \u003cstrong\u003eamount_due\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003erefund.completed\u003c\/strong\u003e: Appends refund details to a refunds sheet, looks up the related invoice, emails a refund confirmation via \u003cstrong\u003eSMTP\u003c\/strong\u003e, and updates the refund row as sent.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eBuild an invoice-to-PDF pipeline for SaaS billing ops using \u003cstrong\u003en8n webhook automations\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eCentralize billing records in \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e while keeping customers updated with receipt and refund emails.\u003c\/li\u003e\n  \u003cli\u003eEnsure reliable reconciliation by rejecting unsupported events and avoiding duplicate IDs.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook\u003c\/strong\u003e (header-authenticated POST) + response handling with JSON success\/conflict results\u003c\/li\u003e\n  \u003cli\u003eRouting and control flow with nodes such as \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003emerge\u003c\/strong\u003e, and \u003cstrong\u003eswitch\u003c\/strong\u003e\n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n-nodes-pdfbropdf\u003c\/strong\u003e (PdfBro) for invoice PDF generation\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e for invoices, payments, and refunds logging + duplicate checks\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Drive\u003c\/strong\u003e for PDF storage and link updates\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEmail Send\u003c\/strong\u003e via \u003cstrong\u003eSMTP\u003c\/strong\u003e for invoice\/receipt\/refund notifications\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46157939048627,"sku":"N8N-20341","price":33.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/gxghWjeLBRS0rBw640vu-_BUNk4mu8.png?v=1791019019","url":"https:\/\/buyflowscripts.com\/products\/n8n-webhook-workflow-invoices-payments-refunds-to-google-sheets","provider":"N8N Commerce","version":"1.0","type":"link"}