访问paypal支付时http响应码500

Posted

技术标签:

【中文标题】访问paypal支付时http响应码500【英文标题】:Http response code 500 when accessing paypal payment 【发布时间】:2016-10-01 23:45:28 【问题描述】:

使用 PAYPAL 创建付款时,我收到此异常:

                            PayPal\Exception\PayPalConnectionException

                            File:

                                /var/www/clients/client2/web93/web/vendor/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConnection.php:178

                            Message:

                                Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/payments/payment.

                            Stack trace:

                                #0 /var/www/clients/client2/web93/web/vendor/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php(74): PayPal\Core\PayPalHttpConnection->execute('"intent":"sale...')
                                #1 /var/www/clients/client2/web93/web/vendor/paypal/rest-api-sdk-php/lib/PayPal/Common/PayPalResourceModel.php(102): PayPal\Transport\PayPalRestCall->execute(Array, '/v1/payments/pa...', 'POST', '"intent":"sale...', NULL)
                                #2 /var/www/clients/client2/web93/web/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/Payment.php(579): PayPal\Common\PayPalResourceModel::executeCall('/v1/payments/pa...', 'POST', '"intent":"sale...', NULL, Object(PayPal\Rest\ApiContext), NULL)
                                #3 /var/www/clients/client2/web93/web/module/Application/src/Application/Controller/CompanyController.php(399): PayPal\Api\Payment->create(Object(PayPal\Rest\ApiContext))

这是我发送到 paypal sdk 的请求:

                            object(PayPal\Api\Payment)#1045 (1) 
                              ["_propMap":"PayPal\Common\PayPalModel":private]=>
                              array(4) 
                                ["intent"]=>
                                string(4) "sale"
                                ["payer"]=>
                                object(PayPal\Api\Payer)#1039 (1) 
                                  ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                  array(1) 
                                    ["payment_method"]=>
                                    string(6) "payapl"
                                  
                                
                                ["redirect_urls"]=>
                                object(PayPal\Api\RedirectUrls)#1044 (1) 
                                  ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                  array(2) 
                                    ["return_url"]=>
                                    string(17) "http://google.com"
                                    ["cancel_url"]=>
                                    string(17) "http://google.com"
                                  
                                
                                ["transactions"]=>
                                array(1) 
                                  [0]=>
                                  object(PayPal\Api\Transaction)#1043 (1) 
                                    ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                    array(4) 
                                      ["amount"]=>
                                      object(PayPal\Api\Amount)#1041 (1) 
                                        ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                        array(2) 
                                          ["currency"]=>
                                          string(3) "USD"
                                          ["total"]=>
                                          string(2) "95"
                                        
                                      
                                      ["item_list"]=>
                                      object(PayPal\Api\ItemList)#1036 (1) 
                                        ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                        array(1) 
                                          ["items"]=>
                                          array(1) 
                                            [0]=>
                                            object(PayPal\Api\Item)#1035 (1) 
                                              ["_propMap":"PayPal\Common\PayPalModel":private]=>
                                              array(4) 
                                                ["name"]=>
                                                string(9) "e-toolset"
                                                ["currency"]=>
                                                string(3) "USD"
                                                ["quantity"]=>
                                                int(1)
                                                ["price"]=>
                                                string(2) "95"
                                              
                                            
                                          
                                        
                                      
                                      ["description"]=>
                                      string(17) "E-Toolset package"
                                      ["invoice_number"]=>
                                      string(13) "574fff863c2d0"
                                    
                                  
                                
                              
                            

如果您要询问日志文件,这里是我得到的错误日志: [Thu Jun 02 11:11:37.373825 2016] [:error] [pid 5053:tid 140435666220800] [client 91.218.196.212:49810] FastCGI: server "/var/www/clients/client2/web93/cgi-bin/php5 -fcgi-*-80-etoolset.dev.artio.pl" 标准错误:PHP 消息:PHP 警告:chdir():open_basedir 限制生效。文件(/var/www/clients/client2/web93)不在允许的路径内:(/var/www/clients/client2/web93/web:/var/www/clients/client2/web93/tmp: /var/www/etoolset.dev.artio.pl/web:/srv/www/etoolset.dev.artio.pl/web:/usr/share/php5:/tmp:/usr/share/php) 在 /var /www/clients/client2/web93/web/public/chat.php 第 3 行,referer:http://etoolset.dev.artio.pl/edit/company/dotpay/63

【问题讨论】:

【参考方案1】:

您的Payer payment_method 有拼写错误;你有payapl

【讨论】:

谢谢伙计.. 你知道我只是在工作调试上浪费了 2 天时间

以上是关于访问paypal支付时http响应码500的主要内容,如果未能解决你的问题,请参考以下文章

访问 https://api.sandbox.paypal.com 时得到 Http 响应码 400

访问 https://api.paypal.com/v1/payments/payment/ 时得到 Http 响应码 400

访问 https://api.sandbox.paypal.com/v1/payments/billing-plans/ 时得到 Http 响应码 403

使用 PayPal PHP SDK 在 PayPal Sandbox 上执行支付时,得到 Http 响应代码 400

实施 Paypal Sandbox 退款时得到 Http 响应代码 400

访问https://api.sandbox.paypal.com时获得Http响应代码400