Introduction
Authentication
Batch
Browser Payment
Gateway
Payment Plan
Session
Tokenization
Transaction
Wallet
RESOURCES
Changelog
Checkout
error
error Callback
The error callback is invoked when problems occur during a payment.
Usage Copied to clipboard
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 Copied to clipboard
<html> <head> <script src="https://gateway-japa.americanexpress.com/checkout/version/59/checkout.js" data-error="errorCallback"></script> <script type="text/javascript"> function errorCallback(error) { //handle payment error } </script> </head> ... </html>
<html> <head> <script src="https://gateway-japa.americanexpress.com/checkout/version/59/checkout.js" data-error="http://[your domain]/errorPage"></script> </head> ... </html>
Arguments Copied to clipboard
error
Copied to clipboard
Object
Details of the error.
explanation
Copied to clipboard
String
Human readable description of the error.
field
Copied to clipboard
String
Indicates the name of the field that failed validation or has violated the payment constraints.
result
Copied to clipboard
String
Fixed value = ERROR
validationType
Copied to clipboard
String
Indicates the type of field validation error.
cause
Copied to clipboard
String
Cause of the error is one of following:
INVALID_REQUEST
SERVER_BUSY
SERVER_FAILED
CONSTRAINT_VIOLATION
REQUEST_REJECTED
Return Value Copied to clipboard
None