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

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

Example

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

Arguments

fieldData

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

Return Value

None

Copyright © 2023 Mastercard