IOnline |
CancelPaymentResponse CancelPayment( CancelPaymentRequest request )
If this is called while the transaction is in the "Initialized" state, it will simply set the status to "Canceled" and return. If it's called when the transaction is in the "Completed" state, it will do the above, but only after it has also sent a cancel request to the underlying provider.
The "Initialized" case is mostly useful in situations where the payment window provides a Cancel button that the user can press to "bail out" of the payment. Since a payment has previously been created in the Infosoft database, it's good practice (though not required) to call this method in those cases. Doing so will ensure that the payment entry can never be confused for a completed payment, but will have no effect beyond that.
The "Completed" case is useful if the shop has an "undo" feature for payments that have been authorized but not yet captured. In such cases, the Cancel call is important, since it will cause the monetary reservation made in the customer's bank account to be deleted, in addition to marking the payment as canceled in the Infosoft database.