我正在将paypal rest apisandbox帐户一起使用,以允许用户购买票证。一切正常。
我得到这个回应:

    ayPal\Api\Payment Object
     (
       [_propMap:PayPal\Common\PPModel:private] => Array
        (
        [id] => PAY-XXXXXXXXXXXXXXXXXXXXXX
        [create_time] => 2014-12-03T12:35:31Z
        [update_time] => 2014-12-03T12:36:23Z
        [state] => approved
        [intent] => sale
        [payer] => PayPal\Api\Payer Object
            (
                [_propMap:PayPal\Common\PPModel:private] => Array
                    (
                        [payment_method] => paypal
                        [payer_info] => PayPal\Api\PayerInfo Object
                            (
                                [_propMap:PayPal\Common\PPModel:private] => Array
                                    (
                                        [email] => [email protected]
                                        [first_name] => times
                                        [last_name] => douha
                                        [payer_id] => XXXXXXXXXX
                                        [shipping_address] => PayPal\Api\ShippingAddress Object
                                            (
                                                [_propMap:PayPal\Common\PPModel:private] => Array
                                                    (
                                                        [line1] => Av. de la Pelouse, 87648672 Mayet
                                                        [city] => Paris
                                                        [state] => Alsace
                                                        [postal_code] => 75002
                                                        [country_code] => FR
                                                        [recipient_name] => douha
                                                    )

                                            )

                                    )

                            )

                    )

            )

        [transactions] => Array
            (
                [0] => PayPal\Api\Transaction Object
                    (
                        [_propMap:PayPal\Common\PPModel:private] => Array
                            (
                                [amount] => PayPal\Api\Amount Object
                                    (
                                        [_propMap:PayPal\Common\PPModel:private] => Array
                                            (
                                                [total] => 12.00
                                                [currency] => EUR
                                                [details] => PayPal\Api\Details Object
                                                    (
                                                        [_propMap:PayPal\Common\PPModel:private] => Array
                                                            (
                                                                [subtotal] => 12.00
                                                            )

                                                    )

                                            )

                                    )

                                [description] => 12 EUR
                                [related_resources] => Array
                                    (
                                        [0] => PayPal\Api\RelatedResources Object
                                            (
                                                [_propMap:PayPal\Common\PPModel:private] => Array
                                                    (
                                                        [sale] => PayPal\Api\Sale Object
                                                            (
                                                                [_propMap:PayPal\Common\PPModel:private] => Array
                                                                    (
                                                                        [id] => XXXXXXXXX
                                                                        [create_time] => 2014-12-03T12:35:31Z
                                                                        [update_time] => 2014-12-03T12:36:23Z
                                                                        [amount] => PayPal\Api\Amount Object
                                                                            (
                                                                                [_propMap:PayPal\Common\PPModel:private] => Array
                                                                                    (
                                                                                        [total] => 12.00
                                                                                        [currency] => EUR
                                                                                    )

                                                                            )

                                                                        [payment_mode] => INSTANT_TRANSFER
                                                                        [state] => completed
                                                                        [protection_eligibility] => ELIGIBLE
                                                                        [protection_eligibility_type] => ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE
                                                                        [parent_payment] => PAY-8TA78025CU843082LKR7QHEY
                                                                        [links] => Array
                                                                            (
                                                                                [0] => PayPal\Api\Links Object
                                                                                    (
                                                                                        [_propMap:PayPal\Common\PPModel:private] => Array
                                                                                            (
                                                                                                [href] => https://api.sandbox.paypal.com/v1/payments/sale/XXXXXXXXXXXX
                                                                                                [rel] => self
                                                                                                [method] => GET
                                                                                            )

                                                                                    )

                                                                                [1] => PayPal\Api\Links Object
                                                                                    (
                                                                                        [_propMap:PayPal\Common\PPModel:private] => Array
                                                                                            (
                                                                                                [href] => https://api.sandbox.paypal.com/v1/payments/sale/XXXXXXXXXXXXXXXX/refund
                                                                                                [rel] => refund
                                                                                                [method] => POST
                                                                                            )

                                                                                    )

                                                                                [2] => PayPal\Api\Links Object
                                                                                    (
                                                                                        [_propMap:PayPal\Common\PPModel:private] => Array
                                                                                            (
                                                                                                [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAY-XXXXXXXXXXXXXXXX
                                                                                                [rel] => parent_payment
                                                                                                [method] => GET
                                                                                            )

                                                                                    )

                                                                            )

                                                                    )

                                                            )

                                                    )

                                            )

                                    )

                            )

                    )

            )

        [links] => Array
            (
                [0] => PayPal\Api\Links Object
                    (
                        [_propMap:PayPal\Common\PPModel:private] => Array
                            (
                                [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAY-XXXXXXXXXXXXXXX
                                [rel] => self
                                [method] => GET
                            )

                    )

            )

    )

 )


但是,您会注意到我没有退款对象。
如何获得退款对象,我想稍后使用它来退款用户。
它与贝宝帐户中的配置有关吗?

最佳答案

我不确定您的问题是否要求将来可以退款。您可以通过获取付款响应中提供的销售信息,然后在开发人员文档中的这两个API中显示的退款上轻松地做到这一点:

https://developer.paypal.com/webapps/developer/docs/api/#sale-transactions

另外,您可以在SDK本身http://htmlpreview.github.io/?https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/index.php#sale上看到该演示

您可以查找销售,并获取销售ID,然后使用退款示例根据需要退款部分/全部金额。

附言如果不是您要的问题,您可以编辑您的问题吗?

关于laravel - Paypal Rest API无法获得付款的退款对象,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27273737/

10-10 23:21