Php (13) 商户登录ID或密码无效或帐户处于非活动状态。(使用authorize.net的Aim方法)

Php (13) 商户登录ID或密码无效或帐户处于非活动状态。(使用authorize.net的Aim方法),php,e-commerce,payment-gateway,authorize.net,Php,E Commerce,Payment Gateway,Authorize.net,因此,当我将action定义为payment.php时,一切正常,但一旦我定义action post_url,它就会给我这个错误。所以请帮助我。测试帐户的所有登录凭据都正常并已检查 这是我的check out.php表单操作 <?php include_once('payment.php'); ?> <form method="post" action='<?php echo $post_url; ?>'> 感谢您的帮助,如图所示,此错误是因为您

因此,当我将action定义为payment.php时,一切正常,但一旦我定义action post_url,它就会给我这个错误。所以请帮助我。测试帐户的所有登录凭据都正常并已检查

这是我的check out.php表单操作

<?php  include_once('payment.php');  ?> 
<form  method="post" action='<?php echo $post_url; ?>'>


感谢您的帮助,如图所示,此错误是因为您的API登录名和事务密钥无效。这可能是由于在沙箱中使用了来自实时生产帐户的API密钥/事务密钥,或者visa国际组织使用了来自实时生产帐户的API密钥/事务密钥。由于您在上面发布了交易密钥,建议您再次登录并重新生成交易密钥

如果重新生成沙盒事务密钥,可以在新的API参考控制台中测试它的工作情况。

我在这里找到了解决方案:

如果简而言之,描述该决定,则很可能您正在尝试发送测试证书上的实时数据


将$post_url更改为“”

我在authorize.net的支持论坛上读到“如果您正在使用高级集成方法(AIM)集成您的网站”使用PHP时,请注意网关URL列出了两次——一次在cURL配置中,一次在代码主体中。在代码的cURL部分使用测试网关URL将产生错误13,因为cURL将连接到错误的服务器“任何与我的问题有关的事情,我告诉他所有的钥匙都是好的,并且经过双重检查。当我用“payment.php”代替post url时,所有的交易都成功了,并且获得了响应代码,但问题是付款没有登录到安全的支付网关或上面提到的post url,这是任何付款的SOP。我已经更改了代码
返回($this->\u sandbox?self::sandbox\u URL:self::LIVE\u URL);
返回($this->\u sandbox?self::LIVE\u URL:self::sandbox\u URL)
它对我有效。这是获取实时url的正确方法还是我应该做些其他事情?@MusaddiqKhan,我认为您需要使用第一次返回并将$this->u sandbox配置为true/false以将数据发送到正确的url。我认为它对sandbox帐户不起作用,因为它总是返回实时url。
<?php


        //log in credentials and key values 

        $LOGINKEY = '24Xd2WdY';// x_login


        $TRANSKEY = 'xxxx';//x_tran_key

        $firstName =urlencode( $_POST['first_name']);

        $lastName =urlencode($_POST['last_name']);

        $creditCardType =urlencode( $_POST['card_type']);

        $creditCardNumber = urlencode($_POST['cardnumber']);

        $expDateMonth =urlencode( $_POST['cardmonth']); 

        // Month must be padded with leading zero
        $padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);

        $expDateYear =urlencode( $_POST['cardyear']);

        $cvv2Number = urlencode($_POST['cardsecuritycode']);

        $address1 = urlencode($_POST['street1']);

        $city = urlencode($_POST['city']);

        $state =urlencode( $_POST['state']);

        $zip = urlencode($_POST['zipcode']);

        $country = urlencode($_POST['country']);

        $company = urlencode($_POST['company']);

        $email = urlencode($_POST['email']);

        $phone = urlencode($_POST['phone']);

        $invoice_number=urlencode($_POST['order_id']);

        $amount = urlencode($_POST['amount_charged']);

        $currencyCode="USD";

        $paymentType="Sale";

        $date = $expDateMonth.$expDateYear;\


    $post_values = array(

        "x_login"       => "$LOGINKEY",

        "x_tran_key"        => "$TRANSKEY",

        "x_version"         => "3.1",
        "x_delim_data"      => "TRUE",
        "x_delim_char"      => "|",
        "x_relay_response"  => "FALSE",
        //"x_market_type"       => "2",
        "x_device_type"     => "1",
        "x_type"        => "AUTH_CAPTURE",
        "x_method"      => "CC",
        "x_card_num"        => $creditCardNumber,
        "x_invoice_num"     =>  $invoice_number,
        "x_exp_date"        => $date,
        "x_amount"      => $amount,
        //"x_description"   => "Sample Transaction",
        "x_first_name"      => $firstName,
        "x_last_name"       => $lastName,
        "x_address"     => $address1,
        "x_state"       => $state,
        "x_city"        =>$city,
        "x_country"     =>$country,
        "x_company"     =>$company,
        "x_email"       =>$email,
        "x_phone"       =>$phone,

        "x_response_format" => "1",
        "x_zip"         => $zip


        // Additional fields can be added here as outlined in the AIM integration
        // guide at: http://developer.authorize.net
    );

    //echo '<pre>'; echo 'Request values'; print_r($post_values);
    //comment the above line. i have given this just for testing purpose.

    $post_string = "";
    foreach( $post_values as $key => $value )$post_string .= "$key=" . urlencode( $value ) . "&";
    $post_string = rtrim($post_string,"& ");

    //for test mode use the followin url
    $post_url = "https://test.authorize.net/gateway/transact.dll";
    //for real accounts (even in test mode), please make sure that you are posting to 
    //$post_url = "https://secure.authorize.net/gateway/transact.dll"; 

    $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);


    //echo '<br><br> Response Array'; print_r($response_array);
    //remove this line. i have used this just print the response array

    if($response_array[0]==2||$response_array[0]==3) 
    {
        //success 
        echo '<b>Payment Failure</b>. <br>';
        echo '<b>Error String</b>: '.$response_array[3];


        echo '<br><br>Press back button to go back to the previous page';
    }
    else
    {
        $ptid = $response_array[6];
        $ptidmd5 = $response_array[7];
        $status=$response_array[0];


        echo "$ptid "."Payment Success";
        echo"$status";
    }
    if ($status==1) {

        require_once('Rescue_soap.php');
        $new_soap = new Rescuesoap();
        $new_soap->check_contacts($_REQUEST);
        }
?>
//for test mode use the followin url
$post_url = "https://test.authorize.net/gateway/transact.dll";
//for real accounts (even in test mode), please make sure that you are posting to 
//$post_url = "https://secure.authorize.net/gateway/transact.dll";