Introduction
Authentication
Batch
Browser Payment
Gateway
Payment Plan
Session
Tokenization
Transaction
Wallet
RESOURCES
Changelog
Checkout
saveFormFields()
saveFormFields()
saveFormFields() is a default implementation of a beforeRedirect callback. When used in conjunction with restoreFormFields(), the contents of any input elements on your page can be restored across browser redirects during the payment process.
Usage Copied to clipboard
saveFormFields() can be configured as the beforeRedirect callback using the
data-beforeRedirect
attribute on the Checkout
script tag.
Example Copied to clipboard
<html> <head> <script src="https://gateway-na.americanexpress.com/checkout/version/59/checkout.js" data-beforeRedirect="Checkout.saveFormFields" data-afterRedirect="Checkout.restoreFormFields"> </script> </head> ... </html>
Arguments Copied to clipboard
None
Return Value Copied to clipboard
fieldData
Copied to clipboard
An object which represents the input elements on the current page and their values. The input values can be re-written to the page by passing this object to restoreFormFields().