2Checkout - 卷曲失败错误沙箱

时间:2015-05-17 05:59:18

标签: php curl 2checkout

<?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" => 'example@2co.com',
            "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

我的卖家ID: 901275831

现在该怎么办?我是第一次测试它。但不知道为什么会发生这种错误。有人可以帮忙吗?

1 个答案:

答案 0 :(得分: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

它开始使用localhost。