// GOOD TO GO -- RUN THE INITIAL PAYMENT
 // *******************************************************************
 $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']);
/**
 * Authorize and Prosses order using the AuthnetAIM.class.php class.
 * Fill object of the class ($payment), then send to process order,
 * this order then gives a echo for the payment error or recieved.
 * Tutorial: http://www.johnconde.net/blog/tutorial-integrating-the-authorizenet-aim-api-with-php/
 * @param  object $ccInfo Object containing info for the Authorize.NET API.
 * @return void
 */
function wc_AuthorizeCard($ccInfo)
{
    require 'AuthnetAIM.class.php';
    $payment = new AuthnetAIM("52H4eeYq", "7RD64g4h993VE6rp", true);
    $payment->setTransaction($ccInfo->getCreditCard(), $ccInfo->getExpiration(), $ccInfo->getTotal());
    $payment->setParameter("x_description", $ccInfo->getProduct());
    $payment->setParameter("x_email", $ccInfo->getEmail());
    $payment->setParameter("x_first_name", $ccInfo->getName());
    $payment->process();
    if ($payment->isApproved()) {
        echo "Payment Received/Approved";
    }
    if ($payment->isError()) {
        $error_number = $payment->getResponseSubcode();
        $error_message = $payment->getResponseText();
        echo $payment->getResponseMessage();
    }
}