// *******************************************************************
 $success = false;
 try {
     $user_id = $active_user_id;
     $creditcard = $a['card_number'];
     $expiration1 = $a['card_exp_month'] . '-' . $a['card_exp_year'];
     // for the first charge
     $expiration2 = $a['card_exp_year'] . '-' . $a['card_exp_month'];
     // for the subscription
     $auth_total = $subscription_total;
     $cvv = $a['card_cvv'];
     $invoice = strval(time());
     $tax = 0.0;
     $payment = new AuthnetAIM('7jE3f8DhGK6', '9rkC8QgF349Jg48k');
     $payment->setTransaction($creditcard, $expiration1, $auth_total, $cvv, $invoice, $tax);
     $payment->setTransactionType("AUTH_CAPTURE");
     $payment->setParameter("x_duplicate_window", 180);
     $payment->setParameter("x_cust_id", $active_user_id);
     $payment->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']);
     $payment->setParameter("x_email_customer", TRUE);
     $payment->setParameter("x_first_name", $a['card_name_first']);
     $payment->setParameter("x_last_name", $a['card_name_last']);
     $payment->setParameter("x_address", $a['address']);
     $payment->setParameter("x_city", $a['city']);
     $payment->setParameter("x_state", $a['state']);
     $payment->setParameter("x_zip", $a['zipcode']);
     $payment->setParameter("x_ship_to_first_name", $a['card_name_first']);
     $payment->setParameter("x_ship_to_last_name", $a['card_name_last']);
     $payment->setParameter("x_ship_to_address", $a['address']);
     $payment->setParameter("x_ship_to_city", $a['city']);
     $payment->setParameter("x_ship_to_state", $a['state']);