← All use cases

Duplicate charges

The same order charged twice within 15 minutes.

Category
Payments
Team
Payments Ops
Priority
critical
Runs
Every 5 minutes

Why watch it

Customers notice a double charge before you do, and they tell their bank, not you. Refunding it first avoids a chargeback and its fee.

The query

Every row it returns is a case to handle. Run it every so often and Pulso opens a signal only for rows it has not seen before.

SQLEvery 5 minutes
SELECT o.number AS order_number, c.name AS customer, a.reference AS first_payment,
       b.reference AS second_payment, b.amount_eur, b.provider, b.created_at AS charged_at
FROM payments a
JOIN payments b ON b.order_id = a.order_id AND b.id > a.id
 AND b.created_at - a.created_at < interval '15 minutes'
JOIN orders o ON o.id = a.order_id
JOIN customers c ON c.id = o.customer_id
WHERE a.status = 'succeeded' AND b.status = 'succeeded'
Unique by second_payment

The signal

Its title uses the row’s columns, so the inbox reads like a to-do list:

{{ customer }} was charged twice for {{ order_number }}

criticalPayments Ops

Set up “Duplicate charges” in minutes

Connect your database, paste the query, adjust the table names and pick who handles the signals. Free during early access.