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" => '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());
}

?>

我正在使用测试样本数据:样本测试数据

我的卖家编号: 901275831

现在要做什么?我是第一次测试它。但不知道为什么会发生此错误。有没有人可以帮忙?

4

1 回答 1

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

它在本地主机上工作。

于 2015-05-17T06:28:32.117 回答