ci-merchant.org-将自定义数据添加到贝宝快递交易中


ci-merchant.org - Add custom data to paypal express transaction

我使用ci-merchant库ci-merhant,除了我只是将订单总额传递给贝宝之外,一切都很好。

有没有办法指定运费和/或其他自定义属性,这样当客户被推荐到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);

像这里指定的那样将文件修改到库中,它允许您在调用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商人。你最好使用Omnipay。