我必须将Paypal Payment pro集成到客户的网站。我首先在服务器上安装Paypal php SDK。它在php 5.2.17上运行,并且看起来完美。

完成测试后,我将SDK从服务器移到了运行php 5.3.2的客户端服务器,由于某种原因,它无法正常工作。

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

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

我一直在寻找解决方案。我在这里找到的一种解决方案:
PayPal error messages on PHP 5.3.1
与梨包装有关。

任何人都知道是否需要特殊的梨包装才能使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>

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

谢谢。

最佳答案

要解决这些错误,请执行以下操作:

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


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

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膨胀,完全没有必要。

10-06 00:19