0

使用 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();
        }
    }
4

1 回答 1

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"
                )
            ),

希望这会奏效。谢谢

于 2016-07-19T09:21:24.703 回答