我尝试使用Sandbox进行同样的调用,但效果很好。当我改为Production(live)时,2CO只返回" Bad Parameters"。
我是否需要在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();
}
答案 0 :(得分:0)
您的真实帐户应该经过验证(不在演示模式下),才能正常工作。