【问题标题】:2Checkout doesn't work in Production (Bad parameters)2Checkout 在生产中不起作用(参数错误)
【发布时间】:2018-04-04 16:53:23
【问题描述】:

我用 Sandbox 尝试了同样的调用,它运行良好。当我更改为生产(现场)时,2CO 只返回“错误参数”。

我需要在 2CO 帐户中再设置一件事吗?我在插入时找到的每个示例都使用相同类型的调用。

我做错了什么?

我的代码:

Twocheckout::privateKey(MYKEY); //Private Key
Twocheckout::sellerId(MYID); // 2Checkout Account Number
Twocheckout::sandbox(false); // Set to false for production accounts.

try {
    $charge = Twocheckout_Charge::auth(array(

        "sellerId" => "MYID",
        "merchantOrderId" => "1",
        "token"      => $_POST['token'],
        "currency"   => "USD",
        //"total" => "1.00",           //Only use when lineitems are not passed in
        "lineItems" => array(
            "0" => array(  
                    "type" => 'product',
                    "price" => "1.00",
                    "productId" => "0000001",
                    "name" => "Smartphone Chip",
                    "quantity" => "1",
                    "tangible" => "N",
                    "description" => "Description of my product"
                    )
                ),
        "billingAddr" => array(
            "name" => $Nome,
            "addrLine1" => $Endereco . ' ' . $Numero . ' ' . $Complemento . ' ' . $Bairro,
            "city" => $Cidade,
            "state" => $Estado,
            "zipCode" => $CEP,
            "country" => 'BRA',
            "email" => $Email,
            "phoneNumber" => $DDD . $Celular
        ),
        "shippingAddr" => array(
            "name" => $Nome,
            "addrLine1" => $Endereco . ' ' . $Numero . ' ' . $Complemento . ' ' . $Bairro,
            "city" => $Cidade,
            "state" => $Estado,
            "zipCode" => $CEP,
            "country" => 'BRA',
            "email" => $Email,
            "phoneNumber" => $DDD . $Celular
        )       
    ));


    if ($charge['response']['responseCode'] == 'APPROVED') {
      echo "Success!";
    }

} catch (Twocheckout_Error $e) {

    print_r($e->getMessage());

    exit();
}

【问题讨论】:

    标签: 2checkout


    【解决方案1】:

    您的真实账户应该经过验证(不是在演示模式下)才能正常工作。

    【讨论】:

      猜你喜欢
      • 2020-09-24
      • 1970-01-01
      • 2015-07-24
      • 1970-01-01
      • 1970-01-01
      • 2015-02-06
      • 2021-12-05
      • 2020-11-03
      • 1970-01-01
      相关资源
      最近更新 更多