How do I return a payment response in my payment driver?

To unify all payment gateway driver communication, an Aero\Payment\Responses\PaymentResponseclass is used. This common class must be returned from the register, complete, capture, refundand cancelmethods.

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 PaymentResponsecan define a view to output. To do so, pass the view to the setViewmethod. 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 setDatamethod 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 setSuccessfulmethod on the PaymentResponse.

Adding error messages

If an error occurred during the action, these messages can be passed to the PaymentResponseusing the setErrormethod.

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 setRedirectmethod.


Revision #1
Created 2026-09-02 13:28:39 UTC by Michael Price
Updated 2026-09-02 13:28:39 UTC by Michael Price