{"product_id":"detect-duplicate-payment-charges-gmail-gemini-n8n","title":"Detect Duplicate Payment Charges: Gmail + Gemini + n8n","description":"\u003ch3\u003eCatch duplicate payment charges automatically—using Gmail, Google Gemini, n8n, Google Sheets, and Slack\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow monitors your Gmail for receipt emails, extracts transaction details with \u003cstrong\u003eGoogle Gemini\u003c\/strong\u003e, checks \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e for potential double charges within a 48-hour window, and sends a \u003cstrong\u003eSlack\u003c\/strong\u003e alert when something looks like a duplicate.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eMonitors Gmail every minute\u003c\/strong\u003e for new messages matching your search query (e.g., “receipt”).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFetches and cleans the email\u003c\/strong\u003e by pulling the full Gmail message, extracting a clean body from MIME parts, and capturing metadata such as sender, subject, thread ID, and received timestamp.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eUses Google Gemini to extract structured fields\u003c\/strong\u003e (merchant, amount, currency, transaction date\/time, reference, and type) by sending the email content to Gemini and parsing the JSON response.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates and normalizes\u003c\/strong\u003e that the email represents a successful charge with the required fields, then standardizes merchant, amount, currency, and timestamps into consistent formats.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDetects possible duplicates\u003c\/strong\u003e by generating a deterministic transaction ID, pulling recent transactions from Google Sheets, and flagging a duplicate when \u003cstrong\u003emerchant, amount, and currency\u003c\/strong\u003e match within \u003cstrong\u003e48 hours\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLogs results and notifies you\u003c\/strong\u003e by appending the transaction to Google Sheets and posting a Slack alert when a potential double charge is detected.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eMarks the Gmail message as processed\u003c\/strong\u003e by labeling it after completion.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eDetecting card\/billing issues when the same merchant charges multiple times for the same amount.\u003c\/li\u003e\n  \u003cli\u003eKeeping SaaS finance operations clean by automatically tracking receipt-based transactions.\u003c\/li\u003e\n  \u003cli\u003eReducing manual review time when reconciling payment receipts across multiple email senders.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGmail trigger\u003c\/strong\u003e (polls every minute; uses an email search query and a “processed” label ID).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Gemini (PaLM) API\u003c\/strong\u003e for transaction extraction and JSON parsing.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e for storing recent transactions and recording duplicate checks.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSlack\u003c\/strong\u003e for alerts on potential duplicate charges.\u003c\/li\u003e\n  \u003cli\u003eLogic implemented with n8n nodes such as \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003eset\u003c\/strong\u003e, and \u003cstrong\u003ecode\u003c\/strong\u003e (plus \u003cstrong\u003esticky note\u003c\/strong\u003e for workflow clarity).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46217905668275,"sku":"N8N-20859","price":4.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/k-ZL-SjQFX9NPHYGyNOaC_XFQpFN4v.png?v=1791882284","url":"https:\/\/buyflowscripts.com\/products\/detect-duplicate-payment-charges-gmail-gemini-n8n","provider":"N8N Commerce","version":"1.0","type":"link"}