How to create a workflow for both payments conform and payments failed

how to send messages for both payment conformation and payment failed, for payment conformation, a conformation message should be sent and for failed payment, a failed payment message should be sent with a delay, and in case the customer payment is failed for the first time and then he tries again and the payment is success then only payment success message should be sent.
 
Top