afterRedirect Callback

The afterRedirect callback is invoked when the browser returns to the merchant page after a redirect to a third-party site. If the beforeRedirect callback was used, the value returned from that callback will be passed to afterRedirect as an argument.

Payment method such as PayPal requires the browser to be redirected away from a merchant page.

Usage

The afterRedirect callback must be defined using the data-afterRedirect attribute on the Checkout script tag. The attribute value must be the name of a global function.

Example

<html>
    <head>
        <script src="https://suncorp.gateway.mastercard.com/static/checkout/checkout.min.js"
                data-afterRedirect="restorePageState"></script>
      
        <script type="text/javascript">
            function restorePageState(data) {
                //set page state from data object
            }
        </script>
    </head>
    ...
</html>

Arguments

data Object
The object that was returned from beforeRedirect callback, if any.

Return Value

None

Copyright © 2023 Suncorp