PayPal Orders API付款给第三方收款人

时间:2020-03-22 14:53:30

标签: api paypal

我想方便汇款到商家的PayPal帐户。我在PayPal沙箱中添加了一个额外的企业帐户。我已使用此帐户作为收款人进行了定购。但是,当我收到订单(在付款人批准后)时,收款人仍然是我的演员帐户。我需要在沙箱中进行一些特殊配置吗?在生产中,预期的收款人需要给我特殊权限吗?

Array
(
    [intent] => AUTHORIZE
    [application_context] => Array
        (
            [return_url] => http://example.com/cart/PP_Payment.php?success=true
            [cancel_url] => http://example.com/cart/PP_Payment.php?success=false
            [brand_name] => Company X
        )

    [payee] => Array
        (
            [email_address] => sb-u4hosest4@business.example.com
        )

    [inovoice_id] => 1-GD2U-70E7-4Y
    [items] => Array
        (
            [0] => Array
                (
                    [quantity] => 1
                    [name] => Rabenhorst Klostergarten BIO Mini
                    [unit_amount] => Array
                        (
                            [currency_code] => EUR
                            [value] => 1.04
                        )

                    [sku] => 97899
                )

            [1] => Array
                (
                    [quantity] => 1
                    [name] => Lupinen Filet
                    [unit_amount] => Array
                        (
                            [currency_code] => EUR
                            [value] => 3.87
                        )

                    [sku] => 66911
                )

            [2] => Array
                (
                    [quantity] => 1
                    [name] => Kühltasche/-akku
                    [unit_amount] => Array
                        (
                            [currency_code] => EUR
                            [value] => 6
                        )

                    [sku] => P002
                )

        )

    [purchase_units] => Array
        (
            [0] => Array
                (
                    [amount] => Array
                        (
                            [currency_code] => EUR
                            [value] => 15.86
                            [breakdown] => Array
                                (
                                    [item_total] => Array
                                        (
                                            [currency_code] => EUR
                                            [value] => 10.91
                                        )

                                    [shipping] => Array
                                        (
                                            [currency_code] => EUR
                                            [value] => 4.95
                                        )

                                )

                        )

                )

        )

)

结果:##########

Array
(
    [id] => 5KPxxxx
    [links] => Array
        (
            [0] => Array
                (
                    [href] => https://api.sandbox.paypal.com/v2/checkout/orders/5KPxxxx
                    [rel] => self
                    [method] => GET
                )

            [1] => Array
                (
                    [href] => https://www.sandbox.paypal.com/checkoutnow?token=5KPxxxx
                    [rel] => approve
                    [method] => GET
                )

            [2] => Array
                (
                    [href] => https://api.sandbox.paypal.com/v2/checkout/orders/5KPxxxx
                    [rel] => update
                    [method] => PATCH
                )

            [3] => Array
                (
                    [href] => https://api.sandbox.paypal.com/v2/checkout/orders/5KPxxxx/authorize
                    [rel] => authorize
                    [method] => POST
                )

        )

    [status] => CREATED
)

但是当我收到订单时,收款人是我,而不是所选的第三方

Array
(
    [id] => 5KPxxxx
    [intent] => AUTHORIZE
    [purchase_units] => Array
        (
            [0] => Array
                (
                    [reference_id] => default
                    [amount] => Array
                        (
                            [currency_code] => EUR
                            [value] => 15.86
                            [breakdown] => Array
                                (
                                    [item_total] => Array
                                        (
                                            [currency_code] => EUR
                                            [value] => 10.91
                                        )

                                    [shipping] => Array
                                        (
                                            [currency_code] => EUR
                                            [value] => 4.95
                                        )

                                )

                        )

                    [payee] => Array
                        (
                            [email_address] => mike@www.org
                            [merchant_id] => FXXX
                            [display_data] => Array
                                (
                                    [brand_name] => Company X
                                )

                        )

                    [shipping] => Array
                        (
                            [name] => Array
                                (
                                    [full_name] => test buyer
                                )

                            [address] => Array
                                (
                                    [address_line_1] => ESpachstr. 1
                                    [admin_area_2] => Freiburg
                                    [admin_area_1] => Empty
                                    [postal_code] => 79111
                                    [country_code] => DE
                                )

                        )

                )

        )

    [payer] => Array
        (
            [name] => Array
                (
                    [given_name] => test
                    [surname] => buyer
                )

            [email_address] => mt-buyer@w3xxx.org
            [payer_id] => 4xxx
            [address] => Array
                (
                    [country_code] => DE
                )

        )

    [create_time] => 2020-03-22T09:32:48Z
    [links] => Array
        (
            [0] => Array
                (
                    [href] => https://api.sandbox.paypal.com/v2/checkout/orders/5KPxxxx
                    [rel] => self
                    [method] => GET
                )

            [1] => Array
                (
                    [href] => https://api.sandbox.paypal.com/v2/checkout/orders/5KPxxxx/authorize
                    [rel] => authorize
                    [method] => POST
                )

        )

    [status] => APPROVED
)

1 个答案:

答案 0 :(得分:1)

 [payee] => Array
        (
            [email_address] => sb-u4hosest4@business.example.com
        )

此收款人因为不在purchase_units对象中而被忽略。

请参见the documentation中的示例。


虽然您可以确定要进行intent:CAPTURE,但另一个注意事项是,没有权限可能不支持intent:AUTHORIZE(以及以后的捕获)。