$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']); $payment->setParameter("x_ship_to_zip", $a['zipcode']); $payment->setParameter("x_description", 'Occasions Initial Authorization'); //$payment->setParameter("x_test_request", TRUE); $payment->process(); if ($payment->isApproved()) { // Get info from Authnet to store in the database $authorization_code = $payment->getAuthCode(); $avs_result = $payment->getAVSResponse(); // not saved at this time $cvv_result = $payment->getCVVResponse(); // not saved at this time $transaction_id = $payment->getTransactionID(); // Do stuff with this. //$err[] = "Amount: $auth_total"; //$err[] = "Invoice #: $invoice"; //$err[] = "Auth Code: $approval_code"; //$err[] = "AVS Result: $avs_result"; //$err[] = "CVV Result: $cvv_result"; //$err[] = "Transaction ID: $transaction_id"; // TODO: in case of errors, email the above info to the admin // ******************************************************************* // NOW WE CAN SET UP THE RECURRING BILLING SUBSCRIPTION
$payment->setParameter("x_address", $business_address); $payment->setParameter("x_city", $business_city); $payment->setParameter("x_state", $business_state); $payment->setParameter("x_zip", $business_zipcode); $payment->setParameter("x_phone", $business_telephone); $payment->setParameter("x_ship_to_first_name", $shipping_firstname); $payment->setParameter("x_ship_to_last_name", $shipping_lastname); $payment->setParameter("x_ship_to_address", $shipping_address); $payment->setParameter("x_ship_to_city", $shipping_city); $payment->setParameter("x_ship_to_state", $shipping_state); $payment->setParameter("x_ship_to_zip", $shipping_zipcode); $payment->setParameter("x_description", $product); $payment->process(); if ($payment->isApproved()) { // Get info from Authnet to store in the database $approval_code = $payment->getAuthCode(); $avs_result = $payment->getAVSResponse(); $cvv_result = $payment->getCVVResponse(); $transaction_id = $payment->getTransactionID(); // Do stuff with this. Most likely store it in a database. // Direct the user to a receipt or something similiar. $status = 'success'; } else { if ($payment->isDeclined()) { // Get reason for the decline from the bank. This always says, // "This credit card has been declined". Not very useful. $reason = $payment->getResponseText(); // Politely tell the customer their card was declined // and to try a different form of payment. $status = 'declined'; } else {