使用 Angelleye Paypal Express Checkout Class 进行并行支付

Use Angelleye Paypal Express Checkout Class for Parallel Payments

我正在使用 Angeleye Paypal class 设置快速结账。 使用演示,我可以接受为多件商品支付给自己的款项。 我有一个代表人们做广告的网站,并且构建了购物车并将值分解为每个卖家的数组。

如何使用 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 name: Pink Foxgloves 数量: 1 小计: 260.00

id:1038 name:大红罂粟数量:1 小计:288.00

约翰已经卖掉了

id:1052 name:成功qty:1小计:46.75

我也有总数:594.75

如果我能在快速收银处拿到收件人,那就太好了,如果我也能拿到他们的物品,那就太好了。

提前致谢。

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

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

此区域将有配方 email/paypal 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);
    }

我希望这对受此困扰的其他人有所帮助 class 希望使用快速结帐而不是自适应付款。