To unify all payment gateway driver communication, an Aero\Payment\Responses\PaymentResponse
class is used. This common class must be returned from the register
, complete
, capture
, refund
and cancel
methods.
Setting the payment view
Many payment gateways use an iframe or JavaScript code to bridge the store with the gateway provider. In order to output this to the customer on the checkout, or telephone operator for MOTO payments, the PaymentResponse
can define a view to output. To do so, pass the view to the setView
method. If no view is set, a JSON response will be returned.
Passing data to the payment view
If there is data to be passed to the view or JSON response, the setData
method should be used.
Marking as successful
To indicate that the action carried out in the method was successful, then the response should be flagged as successful calling the setSuccessful
method on the PaymentResponse
.
Adding error messages
If an error occurred during the action, these messages can be passed to the PaymentResponse
using the setError
method.
Redirecting the user
If further action is required where the user needs to be redirected to a different URL (to complete 3D-secure on the card issuers website for example), a redirect can be set using the setRedirect
method.