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:
Trigger: “When order created”
Condition: Check if at least one transaction has status “FAILURE” OR “ERROR”
Action: COUNT all transactions on the order (order.transactions)
Condition: Check if count is greater than or equal to desired threshold (e.g., 5 transactions = 4 declines + 1 success)
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)
Hi! I have created a flow that emails me when there is a failed payment attempt on an order… it works fine, but what I’m looking for is multiple declines on the same order.
For example, a person may innocently input the wrong zip code or CVV and get a decline error once or even twice, but then enter the info correctly and successfully place their order. I’m not really worried about those scenarios. I want to be notified if there are more than THREE payment attempts (“declined” error code or “failed” transaction status).
As mentioned, I have a flow in place to let me know of one failed payment attempt. Does anyone know if Shopify Flow is able to “count” the number of payment attempts on a given order and only trigger the action if the condition has happened a certain number of times?
Yes, I do get multiple email notifications for repeat events on the same order for the card decline, but the transaction status failure flow only triggers once.
I’ll try the flow you suggested, but not sure on some of the steps. Here’s what I have:
Scheduled to run every day
Then: Get order data
Then Check if:
At least one of get order data, at least one of transactions, “transactions_item.status” is equal to FAILURE
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”)
checking in to see if this worked? I have many people who try and scam us by charging mulitple stolen cards. Sometimes up to 12 different cards that fail.
if it has worked, can you write the steps in detail? sorry, im new to this!
Yes! The below flow has been working great for me!
Trigger “When order created”
THEN if
At least one of order / transactions STATUS (transactions_item.status) is equal to FAILURE - OR -
At least one of order / transactions STATUS (transactions_item.status) is equal to ERROR
THEN “Count” transactions (order.transactions)
THEN Check if “Count” is greater than or equal to 5 (or whatever threshold you want to set)
THEN… whatever you want it to do, cancel the order, add an order tag, send internal email, etc.
The count function will obviously count successful charges, too, so find a number that makes sense for you. To me, if someone’s credit card gets declined 4 times, that’s enough to justify a fraud flag. (4 declines + 1 successful authorization = 5 transactions) I have my flow set up to add an order tag, add an order note for the warehouse, and email me). I take a look at the activity, and if it’s the same card declined 4 times, that’s obviously someone who has fat fingers or doesn’t know their billing address and I usually let those process. But if it’s 4 declines with 4 different cards, I manually cancel the order.
Looks good! I would just suggest “greater than or equal to” as the count qualifier, because the way you have it written, the number of transactions on the order has to be exactly 4 to auto-cancel the order… and if you have one of your 12-attempt scam orders come through, it won’t trigger the last action.