2011-02-26 66 views
2

我正在開發一個Web應用程序。這裏我已經實現了authorize.net支付網關。 但是這裏的洞穴代碼沒有正確驗證。如果我給錯卡代碼支付結果成功但我需要結果作爲付款申明卡代碼未在authorize.net中驗證

有沒有人知道這一點? 看到代碼

    "x_version"   => "3.1", 

        "x_delim_data"  => "TRUE", 

        "x_delim_char"  => "|", 

        "x_relay_response" => "FALSE", 

        "x_type"   => "AUTH_CAPTURE", 

        "x_method"   => "CC", 

        "x_card_num"  => $card_number, 

        "x_exp_date"  => $exp_date, 

        "x_amount"   => $amount, 

        "x_description"  => "Live Transaction", 

        "x_card_code"  => $ccv, 



        "x_first_name"  => $bill_name, 

        "x_address"   => $bill_address, 

        "x_city"   => $bill_city, 

        "x_state"   => $bill_state, 

        "x_zip"    => $bill_zip, 

        "x_country"   => $bill_country, 

        "x_phone"   => $bill_phone, 

        "x_email"   => $email, 



        "x_ship_to_first_name"  => $ship_name, 

        "x_ship_to_address"   => $ship_address, 

        "x_ship_to_city"   => $ship_city, 

        "x_ship_to_state"   => $ship_state, 

        "x_ship_to_zip"    => $ship_zip, 

        "x_ship_to_country"   => $ship_country, 

        "x_ship_to_phone"   => $ship_phone 

        // Additional fields can be added here as outlined in the AIM integration 

        // guide at: http://developer.authorize.net 

       ); 



       // 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, "& "); 




       // The following section provides an example of how to add line item details to 
       // the post string. Because line items may consist of multiple values with the 
       // same key/name, they cannot be simply added into the above array. 
       // 
       // This section is commented out by default. 





       foreach($line_items as $value) 
        { $post_string .= "&x_line_item=" . urlencode($value); } 


       // 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); 
+0

你做錯了什麼。你需要發佈一些代碼或類似的東西,以便有人能夠幫助你*你做錯了什麼。 – 2011-02-26 09:28:58

回答

0

這不是代碼錯誤。如果您希望在CVV編號不正確時付款被拒絕,您需要將其設置在您的Authorize.Net控制面板中。它在安全設置下找到。

2

您的問題可能與authorize.net帳戶中的一些不正確的設置有關。請檢查以下內容:

  1. 確保事務版本設置爲3.1。您可以從Settings->Transaction Version->Submit

  2. 設置Card Code Verification拒收設置並選擇NU選項。爲此,請轉至Settings->Card Code Verification

  3. 確保x_version字段設置爲「3.1」,並且x_card_code包含CCV編號。

希望這會有所幫助。

更多細節: https://support.authorize.net/authkb/index?page=content&id=A546&impressions=false