簡體   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