function go_auth_capture($order, $payment_config)
 {
     $this->loginid = $payment_config['account'];
     $this->_key = $payment_config['key'];
     $this->order = $order;
     $return_array = array();
     //pr($order);die();
     $isrealcard = $this->validateCreditcard_number($order['card_num']);
     if ($isrealcard != 'This is a valid credit card number') {
         $return_array['return_code'] = 4;
         $return_array['reason_text'] = $isrealcard;
         return $return_array;
     }
     $a = new authorizenet_class();
     if ($payment_config['used_mod'] == '0') {
         $a->change_mod('test');
     } else {
         $a->change_mod('now');
     }
     // You login using your login, login and tran_key, or login and password.  It
     // varies depending on how your account is setup.
     // I believe the currently reccomended method is to use a tran_key and not
     // your account password.  See the AIM documentation for additional information.
     $a->add_field('x_login', $this->loginid);
     $a->add_field('x_tran_key', $this->_key);
     //$a->add_field('x_password', 'CHANGE THIS TO YOUR PASSWORD');
     $a->add_field('x_version', '3.1');
     $a->add_field('x_type', 'AUTH_CAPTURE');
     //AUTH_ONLY,CAPTURE_ONLY,CREDIT,PRIOR_AUTH_CAPTURE,AUTH_CAPTURE
     $a->add_field('x_test_request', 'TRUE');
     // Just a test transaction
     $a->add_field('x_relay_response', 'FALSE');
     // You *MUST* specify '|' as the delim char due to the way I wrote the class.
     // I will change this in future versions should I have time.  But for now, just
     // make sure you include the following 3 lines of code when using this class.
     $a->add_field('x_delim_data', 'TRUE');
     $a->add_field('x_delim_char', '|');
     $a->add_field('x_encap_char', '');
     // Setup fields for customer information.  This would typically come from an
     // array of POST values froma secure HTTPS form.
     $a->add_field('x_first_name', $order['payerName']);
     $a->add_field('x_last_name', '');
     $a->add_field('x_address', $order['payerAdderss']['address']);
     $a->add_field('x_state', $order['payerAdderss']['state']);
     $a->add_field('x_zip', $order['x_zip']);
     $a->add_field('x_country', $order['payerAdderss']['country']);
     $a->add_field('x_email', $order['payerEmail']);
     $a->add_field('x_phone', $order['payerPhone']);
     // Using credit card number '4007000000027' performs a successful test.  This
     // allows you to test the behavior of your script should the transaction be
     // successful.  If you want to test various failures, use '4222222222222' as
     // the credit card number and set the x_amount field to the value of the
     // Response Reason Code you want to test.
     //
     // For example, if you are checking for an invalid expiration date on the
     // card, you would have a condition such as:
     // if ($a->response['Response Reason Code'] == 7) ... (do something)
     //
     // Now, in order to cause the gateway to induce that error, you would have to
     // set x_card_num = '4222222222222' and x_amount = '7.00'
     //  Setup fields for payment information
     $a->add_field('x_method', 'CC');
     $a->add_field('x_card_num', $order['card_num']);
     //$a->add_field('x_card_num', '4007000000027');   // test successful visa
     //$a->add_field('x_card_num', '370000000000002');   // test successful american express
     //$a->add_field('x_card_num', '6011000000000012');  // test successful discover
     //$a->add_field('x_card_num', '5424000000000015');  // test successful mastercard
     // $a->add_field('x_card_num', '4222222222222');    // test failure card number
     $a->add_field('x_amount', number_format($order['amount'], 2));
     $a->add_field('x_exp_date', $order['expDate']);
     // march of 2015/03/
     //$a->add_field('x_card_code', $order['CAVV']);    // Card CAVV Security code
     // Process the payment and output the results
     switch ($a->process()) {
         case 1:
             // Successs
             $return_array['return_code'] = 1;
             $return_array['Transaction ID'] = $a->get_response_transacton_id();
             $return_array['reason_text'] = $a->get_response_reason_text();
             break;
         case 2:
             // Declined
             $return_array['return_code'] = 2;
             $return_array['reason_text'] = $a->get_response_reason_text();
             break;
         case 3:
             // Error
             $return_array['return_code'] = 3;
             $return_array['reason_text'] = $a->get_response_reason_text();
             break;
         case 0:
             // Error
             $return_array['return_code'] = 0;
             $return_array['reason_text'] = $a->get_response_reason_text();
             break;
     }
     // The following two functions are for debugging and learning the behavior
     // of authorize.net's response codes.  They output nice tables containing
     // the data passed to and recieved from the gateway.
     //$a->dump_fields();      // outputs all the fields that we set
     //$a->dump_response();    // outputs the response from the payment gateway
     return $return_array;
 }