If you get a non-null APayError, then that means something went wrong during the operation. To handle the error, use the response from the ApayError API.
AmazonPayError parser = new AmazonPayError("", "");
AmazonPayError aPayError = parser.fromIntent(data);
// Get Error Type and Error Message
if (aPayError != null) {
String type = aPayError.getErrorType();
String message = aPayError.getErrorMessage();
}
AmazonPayError parser = new AmazonPayError("", "");
AmazonPayError aPayError = parser.fromIntent(data);
if (aPayError != null) {
// Get Error Type
String type = aPayError.getErrorType();
String message = aPayError.getErrorMessage();
Log.e(TAG, "SDK Error Received -> Type: " + type + " | Message: " + message); // Inline Logic for Error Types
if ("AUTH_ERROR".equals(type)) {
//if the error type is auth error, get the underlaying auth exception
AuthError authError = aPayError.getAuthError();
// See the stacktrace associated with the authError (like you wouldn't other exception)
Log.e(TAG, "Underlying Auth Error: ", authError);
}
}