【问题标题】:ci-merchant.org - Add custom data to paypal express transactionci-merchant.org - 将自定义数据添加到贝宝快递交易
【发布时间】:2013-08-27 13:07:15
【问题描述】:

我正在使用 ci-merchant 库 ci-merchant 并且一切正常,除了我只是将订单总额传递给 paypal。

有没有办法指定运费和/或其他自定义属性,这样当客户被推荐到 Paypal 时,会有一个分项清单,以便他们知道他们要支付的费用。

这是我现有的代码:

    $params = array(
            'amount' => 50.00,
            'currency' =>  'USD',
            'return_url' => 'mysite.com/return/' . $order_id,
            'notify_url' => 'mysite.com/notify/' . $order_id,
            );


    $response  = $this->merchant->purchase($params);

我想做的是这样的:

    $params = array(
            'amount' => 40.00,
            'shipping' => 10.00,
            'currency' =>  'USD',
            'return_url' => 'mysite.com/return/' . $order_id,
            'notify_url' => 'mysite.com/notify/' . $order_id,
            );


    $response  = $this->merchant->purchase($params);

【问题讨论】:

    标签: php codeigniter payment-gateway ci-merchant


    【解决方案1】:

    将一个文件修改到此处指定的库中,它允许您传递一个包含调用 purchase() 方法时所需的经典数据的项目数组。

    https://github.com/guillermofr/ci-merchant/commit/70ea1a2864971078b3b67e5ca1051be174f23fa0#commitcomment-3642787

    数组的格式如下:

    $params = array(
            'amount' => 40.00,
            'currency' =>  'USD',
            'return_url' => 'mysite.com/return/' . $order_id,
            'notify_url' => 'mysite.com/notify/' . $order_id,
            'items' => array(
                array(  
                  'name'=>'',
                  'desc'=>'',
                  'amt'=>,
                  'qty'=>
               )
            )
     );
    

    但请记住,不再支持 ci-merchant。你最好使用 Omnipay。

    【讨论】:

    • 我对大量编辑不利。我尽量做到最清楚。顺便说一句,请注意,据我所知,无法显示运费。它们包含在交易的全局金额中。
    • 谢谢,没关系,我不显示运费,我可以将其添加为项目之一
    • 查看我提供给您的链接后,运费是适用的,可选的每件商品参数 'shippingamt' => 0.00
    • 非常感谢您救了我们的命....................... ......祝福你
    猜你喜欢
    • 2012-08-31
    • 2021-12-15
    • 2015-10-13
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    • 2015-09-11
    • 2015-08-11
    • 2017-06-29
    相关资源
    最近更新 更多