Introduction
Authentication
Batch
Browser Payment
Gateway
Hosted Checkout
Payment Plan
Session
Standalone Risk Assessment
Tokenization
Transaction
Wallet
RESOURCES
Changelog
Checkout
error
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://qnbalahli.test.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://qnbalahli.test.gateway.mastercard.com/static/checkout/checkout.min.js" data-error="http://[your domain]/errorPage"></script> </head> ... </html>
Arguments
error
Object
Details of the error.
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.
cause
String
Cause of the error is one of following:
INVALID_REQUEST
SERVER_BUSY
SERVER_FAILED
CONSTRAINT_VIOLATION
REQUEST_REJECTED
Return Value
None