Checkout restoreFormFields()

restoreFormFields()

restoreFormFields() is a default implementation of a afterRedirect callback. When used in conjunction with saveFormFields(), the contents of any input elements on your page can be restored across browser redirects during the payment process.


Usage Copied to clipboard

restoreFormFields() can be configured as the afterRedirect callback using the data-afterRedirect attribute on the Checkout script tag.


Example Copied to clipboard

<html>
    <head>
        <script src="https://ap-gateway.mastercard.com/checkout/version/100/checkout.js"
            data-beforeRedirect="Checkout.saveFormFields"
            data-afterRedirect="Checkout.restoreFormFields">
        </script>
    </head>
    ...
</html>

Arguments Copied to clipboard

fieldData Copied to clipboard

An object which represents the input elements on the current page and their values. This is the return value of saveFormFields().


Return Value Copied to clipboard

None