HARDVerified Real Interview• Risk & Fraud Analytics Engineer

Repeated Payments Within 10 Minutes

Stripe's Risk & Fraud engineering team wants to identify potential double-charging bugs or fraudulent card attacks.

A repeated payment is defined as a transaction that has the same merchant_id, credit_card_id, and amount, occurring within 10 minutes or less of an immediately preceding transaction with those same attributes.

Write a query to count the total number of repeated payments across the entire dataset.

Table:

  • transactions (transaction_id INT, merchant_id INT, credit_card_id INT, amount DECIMAL, transaction_timestamp TIMESTAMP)

Execution Sandbox:

Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.

Standard SQL (ANSI)|Ln 1, Col 1
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.