付款状态显示无效后,Authorize.net

时间:2015-11-06 15:11:02

标签: php authorize.net

当我从Authorize.net付款时,我面临问题。付款已成功完成,但当我访问Authorize.net网站并检查状态时,它会显示状态Authorize.net并收到此消息。< / p>

这是我正在使用的代码:

include("authorizenet_functions.php");

$payment_first_name=$_POST['payment_first_name'];
$payment_last_name=$_POST['payment_last_name'];
$payment_address01=$_POST['payment_address01'];
$payment_address02=$_POST['payment_address02'];
$payment_city=$_POST['payment_city'];
$payment_state=$_POST['payment_alabama'];
$payment_zipcode=$_POST['payment_zipcode'];
$payment_phone_number=$_POST['payment_phone_number'];
$card_number=$_POST['payment_email'];
$payment_date=$_POST['payment_date'];
$payment_year=$_POST['payment_year'];
$card_exp_date=$payment_date.'-'.$payment_year;
$cvv=$_POST['payment_gender'];
$subscription_amount = '14.99';

            if($transaction_mode=="T")
            {
            $post_url = "https://test.authorize.net/gateway/transact.dll";
            $test_request = "TRUE";
            }
            else
            {
            $post_url = "https://secure.authorize.net/gateway/transact.dll";
            $test_request = "FALSE";
            }

            $post_values = array(       
            // the API Login ID and Transaction Key must be replaced with valid values
            "x_login"           => $loginname,
            "x_tran_key"        => $transactionkey,         
            "x_version"         => "3.1",
            "x_delim_data"      => "TRUE",
            "x_delim_char"      => "|",
            "x_relay_response"  => "FALSE", 
            "x_type"            => "AUTH_ONLY",
            "x_method"          => "CC",
            "x_card_num"        => $card_number,
            "x_card_code"       => $cvv,
            "x_exp_date"        => $card_exp_date,  
            "x_amount"          => $subscription_amount,
            //"x_credit_card_type" =>$cardcct,
            //"x_name_on_card"  =>$cardname,
            "x_first_name"      => $payment_first_name,
            "x_last_name"       => $payment_last_name,
            "x_address" => $payment_address01,
            "x_city" => $payment_city,
            "x_state" => $payment_state,
            "x_zip" => $payment_zipcode,
            "x_phone" => $payment_phone_number,
            "x_description" => 'Individual & Families',
            "x_email_customer" => "TRUE"        
        );
        $post_string = "";
        foreach( $post_values as $key => $value )
            { $post_string .= "$key=" . urlencode( $value ) . "&"; }
        $post_string = rtrim( $post_string, "& " );


            $request = curl_init($post_url); // initiate curl object
            curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
            curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
            curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
            curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
            $post_response = curl_exec($request); // execute curl post and store results in $post_response
            // additional options may be required depending upon your server configuration
            // you can find documentation on curl options at http://www.php.net/curl_setopt
            curl_close ($request); // close curl object

        $response_array = explode($post_values["x_delim_char"],$post_response);
        $status_response = $response_array[0];
        $status_error = $response_array[3];
        if($status_response <> 1)
        {
         $response['error_msg']=$status_error;
         $response['pstatus']= 'FAILED';
        }
        else
        {
        $transaction_orderid = $response_array[6];
        $response['pstatus']= 'OK';     
        $response['transaction_id']= $transaction_orderid;
        }   
print json_encode($response);

请帮我解决这个问题。

交易后现场出现的错误:

我看了收据,一切似乎都很好,但是当我进入时     授权网并查看它然后说明     它被排除在外,金额显示为0.00美元。

0 个答案:

没有答案