【问题标题】:Create sell for recurring payment on 2checkout在 2checkout 上为经常性付款创建销售
【发布时间】:2015-08-03 10:07:01
【问题描述】:

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

【问题讨论】:

    标签: recurring 2checkout


    【解决方案1】:

    请按照以下说明操作一次。 请在顶部添加以下代码:

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

    希望这会奏效。 谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-14
      • 2012-05-01
      • 2018-08-25
      • 2013-10-29
      • 2014-04-14
      • 2012-06-09
      • 2013-01-06
      相关资源
      最近更新 更多