Flow to flag multiple failed payment attempts on single order

rossiedees
Tourist
3 0 1

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?

 

Thanks for any ideas!

Replies 5 (5)

Kalen_Jordan
Shopify Partner
446 15 64

What trigger are you using currently for the single failed payment flow?

Kalen Jordan
Platform Advocate
MESA - Shopify Automation You've Love
rossiedees
Tourist
3 0 1

Hi Kalen!  I have tried it two ways:

  1. With "order created" as the trigger and "transactions_item.status" equal to FAILURE.
  2. With "order transaction created" as the trigger and "orderTransaction.errorCode" equal to CARD_DECLINED

Both of these successfully trigger an internal email, but I'm not sure how to tell Flow to only trigger if it happens three times on the same order.

paul_n
Shopify Staff
946 128 225

I'm not too familiar with how the transaction events come through. Are you seeing the workflow trigger 3 times using Order transaction created? 

 

If so, you could store them in a metafield or tag each time they happen. And then check the metafield before sending that internal email.

 

You might also be able to use something like:

 

  • Every day
  • Get orders (using the financial_status field for the query)
  • For each order:
    • Check if it has 3 tries
    • If true
      • Send email
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
rossiedees
Tourist
3 0 1

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:

  1. Scheduled to run every day
  2. Then:  Get order data
  3. Then Check if: 
    1. At least one of get order data, at least one of transactions, "transactions_item.status" is equal to FAILURE
    2. -or- if "transactions_item.errorCode" exists
  4. Then Count items in getOrderData
  5. Then Check if:  Count is greater than 3
  6. Then send internal email

Is this right?  Seems a little convoluted? 

paul_n
Shopify Staff
946 128 225

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")

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.