首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在2checkout创建定期付款的销售

在2checkout创建定期付款的销售
EN

Stack Overflow用户
提问于 2015-08-03 18:07:01
回答 1查看 430关注 0票数 0

工作在经常性付款与2结账,令牌是成功生成,但同时使费用得到错误“无法处理的请求”这里是代码。有人能帮我解决这个问题吗?

代码语言:javascript
复制
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();
        }
    }
EN

回答 1

Stack Overflow用户

发布于 2016-07-19 17:21:25

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

代码语言:javascript
复制
     Twocheckout::sandbox(false); 
     Twocheckout::verifySSL(false);
     Twocheckout::username('username');
     Twocheckout::password('pass');

更改以下行项目代码:

代码语言:javascript
复制
"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"
                )
            ),

希望这能行得通。谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31784636

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档