繁体   English   中英

使用Angelleye Paypal Express Checkout类进行并行付款

[英]Use Angelleye Paypal Express Checkout Class for Parallel Payments

我正在使用Angelleye Paypal类设置快速结帐。 使用演示,我可以接受自己支付的多项费用。 我有一个网站,可以代表他人做广告,并且构建了购物车,并将每个卖家的价值分成多个数组。

我如何使用SetExpressCheckout.php为接收器创建数组。

这是我从购物车中获得的阵列的演示

Array
(
[102340] => Array
    (
        [name] => Mandy
        [paypal] => sales@one.co.uk
        [artwork] => Array
            (
                [data_id] => Array
                    (
                        [0] => 1034
                        [1] => 1038
                    )

                [name] => Array
                    (
                        [0] => Pink Foxgloves
                        [1] => Big Red Poppies
                    )

                [qty] => Array
                    (
                        [0] => 1
                        [1] => 1
                    )

                [price] => Array
                    (
                        [0] => 260
                        [1] => 288
                    )

            )

        [amount] => 548
    )

[102341] => Array
    (
        [name] => John C
        [paypal] => sales@two.co.uk
        [artwork] => Array
            (
                [data_id] => Array
                    (
                        [0] => 1052
                    )

                [name] => Array
                    (
                        [0] => Success
                    )

                [qty] => Array
                    (
                        [0] => 1
                    )

                [price] => Array
                    (
                        [0] => 46.75
                    )

            )

        [amount] => 46.75
    )

)

因此baiscally mandy已售出2件商品:

id:1034名称:Pink Foxgloves数量:1小计:260.00

id:1038名称:大红色罂粟花数量:1小计:288.00

约翰卖掉了

id:1052名称:成功数量:1小计:46.75

我也总共是:594.75

如果我可以让收货人在快速结帐中,那会很好,如果我也能获得他们的物品,那将是极好的。

提前致谢。

因此,经过研究并没有太多帮助,我通过反复试验找到了答案。

在setexpresscheckout脚本中,我必须在付款数组区域周围执行一个foreach循环。

然后,该区域将具有配方电子邮件/贝宝ID,金额货币和唯一的付款请求ID。

然后在此循环中,我围绕商品运行另一个循环,并生成从该卖方购买的商品清单。

然后,将所有内容设置为一个数组,该数组通常像单个卖家一样通过发送。

这是我的代码,但显然这是我的任务特有的。

// setup the holding array for all the details
$Payments = array();
foreach ($seller as $key => $value) {
        // reset the items array for each recipient
        $PaymentOrderItems = array();
        // setup each recipient details
        $Payment = array(
            'currencycode'          => 'GBP',
            'amt'                   => $value['amount'],
            'sellerpaypalaccountid' => $value['paypal'],    
            'paymentrequestid'      => 'Payment'.$key
        );

        // loop through the products for each seller
        foreach ($value['artwork'] as $akey) {
            $Item = array(
                'number'    => $akey['data_id'],
                'desc'      => $akey['name'],
                'qty'       => $akey['qty'],
                'amt'       => round($akey['price'],2)
            );
            // push this item into the item array for this recipient
            array_push($PaymentOrderItems, $Item);
        }

        // add the item array to the payment array
        $Payment['order_items'] = $PaymentOrderItems;

        // push the payment array to the main payments array
        array_push($Payments, $Payment);
    }

我希望这对那些希望使用快速结帐而不是自适应付款的人有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM