Introduction
Agreement
Authentication
Batch
Browser Payment
Gateway
Hosted Checkout
Payment Plan
Session
Standalone Risk Assessment
Tokenization
Transaction
Wallet
RESOURCES
Changelog
Checkout
beforeRedirect
beforeRedirect Callback
The beforeRedirect callback is invoked before browser redirects occur during the payment flow. The return value of the callback will be stored until the browser is returned to the merchant page. The value can be recovered with the afterRedirect callback.
Payment method such as PayPal requires the browser to be redirected away from a merchant page.
Usage
The beforeRedirect callback must be defined using the
data-beforeRedirect
attribute on the
Checkout
script tag. The attribute value must be the name of a global function.
Example
<html> <head> <script src="https://qa03.gateway.mastercard.com/static/checkout/checkout.min.js" data-beforeRedirect="getPageState"></script> <script type="text/javascript"> function getPageState() { return { foo: "string", bar: 123.45 }; } </script> </head> ... </html>
Arguments
None
Return Value
data
Object
A JSON serializable object.