2015-05-17 29 views
1
<?php 

require "lib/Twocheckout.php"; 

Twocheckout::privateKey('E33E09ED-BD17-4775-AF92-27DE266859A6'); 
Twocheckout::sellerId('901275831'); 
Twocheckout::sandbox(true); 

try { 
    $charge = Twocheckout_Charge::auth(array(
     "merchantOrderId" => "123", 
     "token"  => $_POST['token'], 
     "currency" => 'USD', 
     "total"  => '10.00', 
     "billingAddr" => array(
      "name" => 'Joe Flagster', 
      "addrLine1" => '123 Main Street', 
      "city" => 'Townsville', 
      "state" => 'Ohio', 
      "zipCode" => '43206', 
      "country" => 'USA', 
      "email" => '[email protected]', 
      "phoneNumber" => '555-555-5555' 
     ) 
    )); 

    if ($charge['response']['responseCode'] == 'APPROVED') { 
     echo "Thanks for your Order!"; 
     echo "<h3>Return Parameters:</h3>"; 
     echo "<pre>"; 
     print_r($charge); 
     echo "</pre>"; 

    } 
} catch (Twocheckout_Error $e) { 
    print_r($e->getMessage()); 
} 

?> 

我使用的是测试样本数据:Sample Test Data的2Checkout - 卷曲失败的错误沙盒

我的卖家ID:901275831

现在怎么办?我正在首次测试它。但不知道为什么会发生此错误。有没有人可以帮忙?

回答

4

加入这样的:

// If you want to turn off SSL verification (Please don't do this in your production environment) 
Twocheckout::verifySSL(false); // this is set to true by default 

它得到了工作在本地主机上。