Php 授权.net目标错误。即使支付';s提供的帐单地址无效

Php 授权.net目标错误。即使支付';s提供的帐单地址无效,php,web,e-commerce,payment-gateway,authorize.net,Php,Web,E Commerce,Payment Gateway,Authorize.net,我已尝试更新AVS设置并拒绝所有没有或无效账单地址的交易。 我正试图解决这个问题,但仍然无法解决 这是我当前的AVS设置 请看一下我的代码,看看是否有错 $post_url = "https://test.authorize.net/gateway/transact.dll"; $CC_API = "*****"; $CC_KEY = "*****"; $amount = number_format($formDa

我已尝试更新AVS设置并拒绝所有没有或无效账单地址的交易。 我正试图解决这个问题,但仍然无法解决

这是我当前的AVS设置

请看一下我的代码,看看是否有错

$post_url = "https://test.authorize.net/gateway/transact.dll";          
        $CC_API   = "*****";
        $CC_KEY   = "*****";


        $amount = number_format($formData[total_amt],2);


                  $post_values = array(

                    // the API Login ID and Transaction Key must be replaced with valid values
                    "x_login"           => $CC_API,
                    "x_tran_key"            => $CC_KEY,
                    "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"            => $formData[cc_num],
                    "x_exp_date"            => $formData[cc_expM].$formData[cc_expY],

                    "x_amount"          =>  $amount ,
                    "x_description"         => "Test Order",

                    "x_first_name"          => $formData[cc_fname],
                    "x_last_name"           => $formData[cc_lname],
                    "x_company"         => $Data[cust_bill_company_name],
                    "x_address"         => $Data[cust_bill_street_address],
                    "x_city"                        => $Data[cust_bill_city],
                    "x_state"                       => $Data[cust_bill_state],
                    "x_zip"                         => $Data[cust_bill_postcode],
                    "x_country"                     => $Data[cust_bill_country],
                    "x_email"                       => $Data[cust_email],

                          //shipping
                    "x_ship_to_first_name"  => $Data[cust_ship_fname],
                    "x_ship_to_last_name"   => $Data[cust_ship_lname],
                    "x_ship_to_company"     => $Data[cust_ship_company_name],
                    "x_ship_to_address"     => $Data[cust_ship_street_address],
                    "x_ship_to_city"        => $Data[cust_ship_city],
                    "x_ship_to_state"       => $Data[cust_ship_state],
                    "x_ship_to_zip"         => $Data[cust_ship_zip],
                    "x_ship_to_country"     => $Data[cust_ship_country]


                  );

                  // This section takes the input fields and converts them to the proper format
                  // for an http post.  For example: "x_login=username&x_tran_key=a1B2c3D4"
                  $post_string = "";
                  foreach( $post_values as $key => $value )
                    { $post_string .= "$key=" . urlencode( $value ) . "&"; }
                  $post_string = rtrim( $post_string, "& " );

                  // This sample code uses the CURL library for php to establish a connection,
                  // submit the post, and record the response.
                  // If you receive an error, you may want to ensure that you have the curl
                  // library enabled in your php configuration
                  $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

                    // This line takes the response and breaks it into an array using the specified delimiting character
                    $response_array = explode($post_values["x_delim_char"],$post_response);

        return ($response_array[0]=="1" && $response_array[1]=="1") ? "ok" : $response_array[3]; 

沙盒仅模拟与支付处理器的连接。要生成特定的错误条件,您需要使用位于

的错误生成指南。您是否在生产环境中?或者使用开发人员服务器?是的,我们使用的是生产环境。如果我们使用开发人员服务器会发生什么?上面的代码指向的是沙箱,而不是生产环境。沙盒仅模拟与支付处理器的连接。要生成特定的错误条件,您需要使用错误生成指南,因为上面的代码指向的是生产商户帐户,而不是沙箱帐户。我已经决定使用沙盒进行调试。