Checkout afterRedirect

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 Copied to clipboard

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 Copied to clipboard

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

Arguments Copied to clipboard

data Copied to clipboard Object

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


Return Value Copied to clipboard

None