1

我不得不将 Paypal Payment pro 集成到客户的网站上。我首先在我的服务器上安装 paypal php SDK。它在 php 5.2.17 上运行,似乎运行良好。

当我完成测试时,我将 SDK 从我的服务器移动到运行 php 5.3.2 的客户端服务器,但由于某种原因它不起作用。

一开始我们确定这是权限问题,因为脚本无法写入 paypal.log 文件

大约一个星期以来,我们正在与托管公司合作解决问题。一个想法是将服务器回滚到 5.2.17(以匹配我服务器的 php 版本)。此更改解决了问题,但是服务器上的其他网站被搞砸了,这迫使我们回到 5.3.2

我一直在寻找解决方案。我在这里找到的一个解决方案: PHP 5.3.1 上的 PayPal 错误消息 与梨包有关。

任何人都知道是否需要任何特殊的梨包才能使 SDK 工作?

以下是一些技术信息:

当错误报告设置为 -1 时尝试 doDirectPayment 示例时出现以下错误

其中5或6个:

Warning: error_log(../PayPal.log) [function.error-log]: failed to open stream: Permission denied in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPLoggingManager.php on line 60

1 个:

Strict Standards: Only variables should be passed by reference in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPUtils.php on line 99

其中大约 12 个:

Strict Standards: Non-static method PPUtils::convertXmlObjToArr() should not be called statically in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPUtils.php on line 99

和 5 个软管中的 2 个:

Notice: Class string not found. in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPXmlMessage.php on line 172

请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" ><soapenv:Header><ns:RequesterCredentials><ebl:Credentials><ebl:Username>yanivk_1359660748_biz_api1.gmail.com</ebl:Username><ebl:Password>1359660807</ebl:Password><ebl:Signature>AYWZfz56bBT.eby8WGW6PcSYJuLGAJAkQp0g-4el58kjzrOUFVSWTpE5</ebl:Signature></ebl:Credentials></ns:RequesterCredentials></soapenv:Header><soapenv:Body><ns:DoDirectPaymentReq><ns:DoDirectPaymentRequest><ebl:DoDirectPaymentRequestDetails><ebl:PaymentDetails><ebl:OrderTotal><ebl:currencyID>USD</ebl:currencyID><ebl:value>1.00</ebl:value></ebl:OrderTotal><ebl:ShipToAddress><ebl:Name>John Doe</ebl:Name><ebl:Street1>1 Main St</ebl:Street1><ebl:CityName>San Jose</ebl:CityName><ebl:StateOrProvince>CA</ebl:StateOrProvince><ebl:Country>US</ebl:Country><ebl:PostalCode>95131</ebl:PostalCode></ebl:ShipToAddress></ebl:PaymentDetails><ebl:CreditCard><ebl:CreditCardType>Visa</ebl:CreditCardType><ebl:CreditCardNumber>4079305435163119</ebl:CreditCardNumber><ebl:ExpMonth>01</ebl:ExpMonth><ebl:ExpYear>2014</ebl:ExpYear><ebl:CardOwner><ebl:PayerName><ebl:FirstName>John</ebl:FirstName><ebl:LastName>Doe</ebl:LastName></ebl:PayerName><ebl:PayerCountry>US</ebl:PayerCountry><ebl:Address><ebl:Name>John Doe</ebl:Name><ebl:Street1>1 Main St</ebl:Street1><ebl:CityName>San Jose</ebl:CityName><ebl:StateOrProvince>CA</ebl:StateOrProvince><ebl:Country>US</ebl:Country><ebl:PostalCode>95131</ebl:PostalCode></ebl:Address></ebl:CardOwner><ebl:CVV2>962</ebl:CVV2></ebl:CreditCard></ebl:DoDirectPaymentRequestDetails><ebl:Version>94.0</ebl:Version></ns:DoDirectPaymentRequest></ns:DoDirectPaymentReq></soapenv:Body></soapenv:Envelope>

响应:

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body id="_0"><DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2013-02-10T23:51:36Z</Timestamp><Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">ccaa89a0e921f</CorrelationID><Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"><ShortMessage xsi:type="xs:string">Transaction refused because of an invalid argument. See additional error messages for details.</ShortMessage><LongMessage xsi:type="xs:string">Order total is invalid.</LongMessage><ErrorCode xsi:type="xs:token">10401</ErrorCode><SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode></Errors><Version xmlns="urn:ebay:apis:eBLBaseComponents">94.0</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">5060305</Build><Amount xsi:type="cc:BasicAmountType" currencyID="USD">0.00</Amount></DoDirectPaymentResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

我知道这是一个非常具体的问题,熟悉这个问题的人的可能性很低,但我不得不问。

感谢。

4

1 回答 1

0

要解决这些错误中的每一个:

Warning: error_log(../PayPal.log) [function.error-log]: failed to open stream: Permission
denied in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPLoggingManager.php on line 60

这将表明在所述路径存在权限问题。确保该文件存在并且对您的 www-root(或任何运行您的 Apache 服务的用户)具有适当的权限。

Strict Standards: Only variables should be passed by reference in 
/home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPUtils.php on line 99

这表明变量的非最佳实践用法。我可以对此进行更深入的研究,但基本上,某些东西是通过引用而不是通过值传递的(谷歌它的区别)。

Strict Standards: Non-static method PPUtils::convertXmlObjToArr() should not be called 
statically in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPUtils.php on line 99

静态方法是类中的一种方法,无需实例化整个类即可调用。这个方法似乎没有被定义为静态的,而是被用作静态的。

Notice: Class string not found. in /home/brando/public_html/wp-
content/plugins/ownapainting-shopping-cart/paypal/lib/PPXmlMessage.php on line 172

严格标准的另一个问题。

基本上对于最后 3 个,从 E_STRICT | 更改错误报告 | E_ALL 到 E_ALL。它不会解决问题,但会阻止它们出现在客户面前。

最终的解决方案是根本不使用 PayPal SDK。不建议真正使用它。SDK 导致的问题比任何事情都多。这是我在人们开始使用 PayPal 集成时提供的一些入门信息。它应该有助于:

Getting Started: https://www.x.com/developers/paypal/documentation-tools/paypal-payments-pro/paypal-payments-pro-getting-started-guide 
API Reference Guide: https://www.x.com/developers/paypal/documentation-tools/api?qt-api_references=1#qt-api_references 
Sample Code: https://www.x.com/developers/paypal/documentation-tools/paypal-code-samples 

请使用 NVP,而不是 SOAP。SOAP 臃肿且完全没有必要。

于 2013-02-11T21:14:47.537 回答