Flow to flag multiple failed payment attempts on single order

Topic summary

A merchant seeks to flag orders with multiple failed payment attempts using Shopify Flow, specifically wanting alerts only after three or more declines (not just one or two innocent mistakes like wrong CVV).

Initial Challenge:

  • Existing flows trigger on single failed payments using either “order created” or “order transaction created” triggers
  • Need to count multiple attempts on the same order before taking action

Working Solution:

  1. Trigger: “When order created”
  2. Condition: Check if at least one transaction has status “FAILURE” OR “ERROR”
  3. Action: COUNT all transactions on the order (order.transactions)
  4. Condition: Check if count is greater than or equal to desired threshold (e.g., 5 transactions = 4 declines + 1 success)
  5. Action: Add order tag, send email, cancel order, etc.

Key Considerations:

  • The count includes successful transactions, so adjust threshold accordingly
  • Use “greater than or equal to” (not “equal to”) to catch orders with many attempts
  • Manual review helps distinguish legitimate errors (same card, multiple tries) from fraud (multiple different cards)
  • Particularly useful for detecting stolen card testing attempts (sometimes 12+ cards)
Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Yeah, I think if the trigger works then it will be the easiest for you.

If you go with “Get data” then I would use Run code instead of the condition and count above. It gives you a lot more flexibility and you won’t have to write logic twice. Usually, I prefer to return the full string for the email body plus a boolean to use in a condition (something like “hasThirdDecline”)