Add a delay in a scenario with Woocommerce trigger

I have a scenrio which is triggered by a Woocommerce WatchOrders module. It does multiple things - updates a Google sheet when an order is received, sends an email to the buyer and then creates a Zoho Invoice.

I want to ensure that the invoice is created only if the transaction is really made.

The problem here is orders with the status “Pending Payments”. If the customer has cancelled the transaction, these might be converted to Failed. In which case, the invoice should not be created.
Or they might convert to “Processing” if there was a delay at the payment gateway’s end, but the transaction has in fact, gone through. In this case, the invoice is created.

One way could be to add a delay before the invoice creation stage. Then, check if the transaction ID exists. If it does, create the invoice.

The problem is, it could take up to an hour for the correct transaction status to be updated, but my scenario is set to a 10 min frequency.

Any ideas how I could go about this?

This is the screenshot of my scenario.

Hey there,

a generally good practice is not to have one scenario handle multiple things, instead have multiple scenarios handle one thing each. This way an issue with one part of the scenario will not break all of it. Especially in cases where you need a delay and need to check if something happened before continuing. I strongly suggest you move at least this part to an external scenario that checks the status of the invoice and if its not ready yet, retriggers in X minutes.

Maybe the main scenario can populate a data store with invoices that need to be checked in a while. Then trigger a secondary scenario that checks them after X minutes, if they are good to go-> process them and remove them form the data store; if there are invoices remaining in the data store → retrigger it self.