使用2结帐进行定期付款,令牌生成成功但在收取错误时“无法处理请求”这里是代码。任何人都可以帮我解决问题。
include(APPPATH.'third_party/two_checkout/Twocheckout.php');
if(isset($_POST['token']) && $_POST['token']!="")
{
$token=$_POST['token'];
Twocheckout::privateKey('503CF97F-46DA-4E55-8235-4D006C065624');
Twocheckout::sellerId('901284807');
Twocheckout::sandbox(true); #Uncomment to use Sandbox
try {
$charge = Twocheckout_Charge::auth(array(
"merchantOrderId" => "123",
"token" => $token,
"currency" => 'USD',
/*"total" => '10.00',*/
/*"recurrence" => "1 Month",*/
"billingAddr" => array(
"name" => 'Testing Tester',
"addrLine1" => '123 Test St',
"city" => 'Columbus',
"state" => 'OH',
"zipCode" => '43123',
"country" => 'USA',
"email" => 'testingtester@2co.com',
"phoneNumber" => '555-555-5555'
),
"shippingAddr" => array(
"name" => 'Testing Tester',
"addrLine1" => '123 Test St',
"city" => 'Columbus',
"state" => 'OH',
"zipCode" => '43123',
"country" => 'USA',
"email" => 'testingtester@2co.com',
"phoneNumber" => '555-555-5555'
),
"lineItems" => array(
"type" => "product",
"name" => "Gold",
"quantity" => "1",
"price" => "10.00",
"tangible" => "N",
"productId" => "GLD",
"recurrence" => "1 Month",
"duration" => "1 Year",
"startupFee" => "0"
)
), 'array');
if ($charge['response']['responseCode'] == 'APPROVED') {
echo "Thanks for your Order!";
}
} catch (Twocheckout_Error $e) {
echo $e->getMessage();
}
}
答案 0 :(得分:0)
请按照以下说明操作一次。 在顶部,请添加以下代码:
Twocheckout::sandbox(false);
Twocheckout::verifySSL(false);
Twocheckout::username('username');
Twocheckout::password('pass');
更改下面的lineitems代码:
"lineItems" => array(
array(
"type" => 'product',
"price" => "5.00",
"productId" => "123",
"name" => "Test Product",
"quantity" => "1",
"tangible" => "N",
"startupFee" => "1.00",
"recurrence" => "1 Month",
"description" => "This is a test"
)
),
希望这会奏效。 感谢