error Callback

The error callback is invoked when problems occur during a payment.

Usage

The error callback must be defined using the data-error attribute on the Checkout script tag. The attribute value may be the name of a global function or a URL string.

When a URL is provided, the browser will be redirected to the new page with a query parameter appended for each argument.

Example

<html>
    <head>
        <script src="https://evopaymentsmexico.gateway.mastercard.com/static/checkout/checkout.min.js"
                data-error="errorCallback"></script>

        <script type="text/javascript">
            function errorCallback(error) {
                //handle payment error
            }
        </script>
    </head>
    ...
</html>
<html>
    <head>
        <script src="https://evopaymentsmexico.gateway.mastercard.com/static/checkout/checkout.min.js"
                data-error="http://[your domain]/errorPage"></script>
    </head>
    ...
</html>

Arguments

error Object
Details of the error.
cause String
Cause of the error. One of INVALID_REQUEST, SERVER_BUSY, SERVER_FAILED, CONSTRAINT_VIOLATION, REQUEST_REJECTED
explanation String
Human readable description of the error.
field String
Indicates the name of the field that failed validation or has violated the payment constraints.
result String
Fixed value = ERROR
validationType String
Indicates the type of field validation error.

Return Value

None

Copyright © 2023 Mastercard