← Back to library

Catch a refund or chargeback spike before your payment processor does

WeblineIndia's n8n template reads sales and refund rows from Google Sheets, computes a 7-day refund and chargeback ratio against a 90-day baseline in code, and logs every day. When the ratio passes your threshold, Gemini writes a short diagnosis of possible causes and next checks, explicitly without calling it fraud.

  • OutcomeEach morning a workflow compares your last week of refunds and chargebacks with your normal rate and, only when it jumps, posts a Slack alert with likely causes and the checks to run.
  • SetupUnder an hour
  • LevelIntermediate
  • CreditWeblineIndia
View original
Works with
n8nGemini

Published Oct 22, 2026Updated Oct 22, 2026AI dry run on sample input: passed Oct 22, 2026Source verified Oct 23, 2026

When should you use it?

  • You sell online and only notice a chargeback problem when your processor emails you
  • Refunds come from several channels and nobody watches the overall rate
  • You want an alert that says what to check, not just a number

Not for: Stores without daily sales and refund data you can export; Deciding that a specific customer committed fraud

What do you need, and what do you get?

You need

  • An n8n instance
  • A Google Sheet with sales rows (date, order ID, amount) and refund rows (date, order ID, type, amount, reason)
  • Gemini and Slack credentials
  • Your alert threshold, such as two times your normal rate

You get

  • A daily log row with the 7-day ratio, baseline and status
  • A Slack alert only when the ratio spikes
  • A short diagnosis listing plausible causes and the checks to run first

How does it work, step by step?

  1. Set up the sheetCreate tabs for sales, refunds and a monitor log with the columns the template expects, and fill them from your store or processor export.
  2. Connect the servicesImport the template, connect Google Sheets, Gemini and Slack, and point each node at your sheet and channel.
  3. Pick a thresholdStart with the default of two times your 90-day rate and adjust after a few weeks.
  4. Test with a past spikeUse the date override to replay a week when refunds were known to be high, and check the alert and the log.
  5. Act on alertsWhen an alert arrives, run its checks against the actual orders and respond to open chargebacks with evidence.

The prompt

The original prompt by WeblineIndia, word for word, with a link to where it was published. Below it is our adapted version with fill-in blanks, if you want it. Works in n8n and Gemini. Values in lime are placeholders.

Original prompt by WeblineIndia

Word for wordby WeblineIndia
You are a payment-risk monitoring assistant for a small e-commerce seller.

A deterministic monitoring system has already detected an abnormal increase in the refund/chargeback ratio.

Analyze the provided metrics and generate a concise diagnostic summary.

Do not claim that fraud or a fraud ring definitely exists. These are only possible explanations.

Consider possible causes such as:
* payment fraud or unauthorized transactions
* product quality or product defect
* misleading product information
* fulfillment or shipping problems
* customer service problems
* pricing or discount configuration errors
* duplicate or incorrect charges
* unusual customer behavior

Explain which causes appear most plausible based on the available metrics.

Provide:
1. What changed
2. Possible causes
3. Recommended checks/actions

Keep the response concise and practical for a small seller.

Metrics:
Monitoring date: {{ $('Calculate Refund Chargeback Metrics').item.json.monitoringDate }}
7-day sales: {{ $('Calculate Refund Chargeback Metrics').item.json.currentSalesAmount }}
7-day refunds: {{ $('Calculate Refund Chargeback Metrics').item.json.currentRefundAmount }}
7-day chargebacks: {{ $('Calculate Refund Chargeback Metrics').item.json.currentChargebackAmount }}
7-day refund/chargeback ratio: {{ $('Calculate Refund Chargeback Metrics').item.json.currentRatio }}%
90-day historical baseline: {{ $('Calculate Refund Chargeback Metrics').item.json.historicalBaseline }}%
Spike multiplier: {{ $('Calculate Refund Chargeback Metrics').item.json.spikeMultiplier }}x
Current transaction ratio: {{ $('Calculate Refund Chargeback Metrics').item.json.currentTransactionRatio }}%
Historical transaction ratio: {{ $('Calculate Refund Chargeback Metrics').item.json.historicalTransactionRatio }}%
Refund transaction count: {{ $('Calculate Refund Chargeback Metrics').item.json.refundTransactionCount }}
Chargeback transaction count: {{ $('Calculate Refund Chargeback Metrics').item.json.chargebackTransactionCount }}

Do not invent facts that are not present in the metrics.

Exactly as published by WeblineIndia in Monitor refund and chargeback ratio spikes with Google Sheets, Gemini, and Slack.

Our adapted version (optional)

Fill in the blanks (optional; the copied prompt uses your values)

Adapted prompt9 variables
A monitoring script has flagged a jump in refunds and chargebacks for {store_name}. It has already done the math; your job is to explain it, not to re-decide it.
Last 7 days: sales {sales_7d}, refunds {refunds_7d}, chargebacks {chargebacks_7d}, ratio {ratio_7d}.
Usual rate over 90 days: {baseline}. Counts: {refund_count} refunds, {chargeback_count} chargebacks.
Recent changes we know about: {recent_changes}

In under 150 words: say what moved and by how much, give the two or three most likely explanations and what in the numbers points to each, and list the first three things to check in our order data. Call every cause a possibility. Do not accuse any customer of fraud or add facts that are not above.

What can go wrong?

  • The spike decision is made in code, and the model only explains it; keep it that way rather than asking the model to decide.
  • A small store can trip the threshold with two or three refunds; set a minimum order count before alerting.
  • Possible causes are hypotheses; never accuse a customer or close accounts based on the summary alone.
  • Card networks and processors set their own chargeback limits; check your processor's rules for the ratio that actually matters.

Our take

This template gets an important design choice right: the arithmetic and the alert decision happen in plain code, and the model is only asked to explain what changed and suggest checks. That keeps the alert reliable and the explanation useful. The prompt is also careful in the right places, telling the model not to claim fraud and not to add facts beyond the metrics. We ran it word for word on synthetic metrics for a fictional store where the 7-day ratio was 2.75 times its baseline. The answer stated the change in money and in transaction count, noted that both rose together so the problem looked broad rather than one big order, listed product, shipping, billing and fraud explanations as possibilities only, and suggested grouping the 27 refunds and chargebacks by product, date, reason and payment method. It added nothing that was not in the input. For a small store, add a minimum order count so a quiet week does not trigger false alarms.

Where the time goes back: Nobody has to watch refund numbers every day; you hear about a problem the morning it starts, with a short list of where to look.

FAQ

Does the AI decide when to alert?
No, a code step calculates the ratios and flags the spike; Gemini is only asked to explain a spike that was already detected.
What does a quiet day look like?
The workflow logs the metrics and status to the sheet and sends nothing to Slack.
Can I feed it from Shopify or Stripe?
The template reads Google Sheets, so you would add a step that copies daily orders and refunds into the sheet, or swap the source nodes.

Source and credit

The original prompt on this page is by WeblineIndia, shown word for word with a link to where it was published. The summary, notes and adapted version are ours.

Original
Monitor refund and chargeback ratio spikes with Google Sheets, Gemini, and Slack
Creator
WeblineIndia
Published on
n8n workflow templates
Original date
Oct 13, 2026
License
Not openly licensed; the original prompt is shown word for word with credit and a link to the original
Originally for
n8n
AI dry run
Oct 22, 2026: passed. Dry-run tested by our AI test agent on sample input. Model only explained a spike detected in code, as designed.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Finance & Accounting

All 62 Finance & Accounting playbooks →

Related playbooks

Finance & AccountingWorkflow✓ AI dry run

Cover bills, settles and refunds in one workflow

Each billing event your app sends (invoice, payment or refund) is handled exactly once, with records, PDFs and customer emails kept in step.

Credit: u/cuebicai on r/n8n_ai_agents

An afternoon+
Finance & AccountingWorkflow✓ AI dry run

Match supplier invoices to their purchase orders in Make

Each emailed invoice is read, paired with its purchase order and checked line by line, with matches approved and discrepancies or unclear lines escalated.

Credit: Philippe Larrue (@Philippe_LARRUE)

Under an hour
Finance & AccountingWorkflow✓ AI dry run

Auto-file emailed invoices by month for your accountant

Every invoice that reaches Gmail is saved as a PDF in a year and month folder in Google Drive and logged in that month's sheet, ready to share with your accountant at month end.

Credit: Ioana Frincu

Under an hour
Finance & AccountingWorkflow✓ AI dry run

Turn emailed supplier invoices into checked purchase orders

Pull supplier invoices out of the inbox, read their contents, compare them with stock records and raise orders, with staff able to maintain the flow themselves.

Credit: Nova

An afternoon+
Finance & AccountingWorkflow✓ AI dry run

Harden a vendor-PDF to QuickBooks invoice pipeline

Get vendor PDFs turned into QuickBooks records with the original attached, new items learned and duplicates blocked.

Credit: Eamonn Cottrell

An afternoon+