The general workflows for sale (immediate payment) is this:
The merchant obtains the available payment methods, and offers them to the customer.
The merchant creates a payment transaction, and directs the customer to the payment iframe. The customer is prompted for final closure here.
The merchant receives the customer back at the success URL, and checks the payment status.
If the payment status is accepted everything is ready for delivery. But it is also possible you need to wait for the payment.
If it is invoice payment, the merchant adds every delivery, and asks for capture together with the final delivery.
If something went wrong, the customer is directed to the failure URL. It is also possible, the customer is neither directed to the success URL nor to the failure URL.