// Get the error number so we can reference the Authnet
 // documentation and get an error description.
 $error_number = $payment->getResponseSubcode();
 $error_message = $payment->getResponseText();
 // OR
 // Capture a detailed error message. No need to refer to the manual
 // with this one as it tells you everything the manual does.
 $full_error_message = $payment->getResponseMessage();
 $avs_result = $payment->getAVSResponse();
 $cvv_result = $payment->getCVVResponse();
 $err[] = "Error {$error_number}: {$full_error_message}";
 //$err[] = "AVS Result: $avs_result";
 //$err[] = "CVV Result: $cvv_result";
 // TODO: in case of errors, email the above info to the admin
 // We can tell what kind of error it is and handle it appropriately.
 if ($payment->isConfigError()) {
     // We misconfigured something on our end.
     //$err[] = "Config Error";
 } else {
     if ($payment->isTempError()) {
         // Some kind of temporary error on Authorize.Net's end.
         // It should work properly "soon".
         //$err[] = "Temporary Error";
     } else {
         // All other errors.
         //$err[] = "Other Error";
     }
 }
 // TODO: in case of errors, email the above info to the admin
 // Report the error to someone who can investigate it
 // and hopefully fix it