Paypal权限API Java SDK:GetBasicPersonalData:获取身份验证失败

时间:2012-10-05 09:57:32

标签: paypal paypal-adaptive-payments

方案

我在沙箱模式下使用x.com的最新权限API版本1.1.93。我正在使用沙箱凭据来测试功能。

问题 ::

使用Junit运行时,getBasicPersonalData和getAdvancedPersonalData无效。 (虽然getPermissions和cancelPermissions工作正常)

我收到的API凭据不正确。虽然细节是100%正确

当我运行sdk提供的具有相同凭据的权限样本war文件时,它可以正常工作。

*我甚至复制粘贴了sdk_config.properties文件,以确保我使用的是正确的属性。*

我还比较了标题,paypload和请求信息,All似乎完全相同。

* PS:请不要说我使用了错误的凭据,检查了1000次,我只使用沙盒信用卡,我被告知同样多次:-) *

以下是我调用GetBasicPersonalData时使用的值,使用调试来获取这些值

标头值

{X-PAYPAL-REQUEST-DATA-FORMAT=NV, X-PAYPAL-APPLICATION-ID=APP-80W284485P519543T, X-PAYPAL-DEVICE-IPADDRESS=127.0.0.1, X-PAYPAL-REQUEST-SOURCE=sdk-permissions-java-1.1.93, X-PAYPAL-AUTHORIZATION=token=uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature=4cpQsfOD7d2g39P5Crq6yPbIYLE=,timestamp=1349383673, X-PAYPAL-SANDBOX-EMAIL-ADDRESS=Platform.sdk.seller@gmail.com, X-PAYPAL-RESPONSE-DATA-FORMAT=NV}

有效载荷

requestEnvelope.errorLanguage=en_US&attributeList.attribute(0)=http://axschema.org/namePerson/first&attributeList.attribute(1)=http://axschema.org/namePerson/last&attributeList.attribute(2)=http://axschema.org/contact/email&attributeList.attribute(3)=http://schema.openid.net/contact/fullname&attributeList.attribute(4)=http://axschema.org/company/name&attributeList.attribute(5)=http://axschema.org/contact/country/home&attributeList.attribute(6)=https://www.paypal.com/webapps/auth/schema/payerID&

响应

responseEnvelope.timestamp=2012-10-04T13%3A48%3A48.416-07%3A00&responseEnvelope.ack=Success&responseEnvelope.correlationId=acc87fc89aad2&responseEnvelope.build=2210301&response.personalData(0).personalDataKey=http%3A%2F%2Faxschema.org%2Fcompany%2Fname&response.personalData(0).personalDataValue=Invoice+Sender+%27s+Test+Store&response.personalData(1).personalDataKey=http%3A%2F%2Faxschema.org%2Fcontact%2Fcountry%2Fhome&response.personalData(1).personalDataValue=GB&response.personalData(2).personalDataKey=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&response.personalData(2).personalDataValue=invsd2_1349373629_biz%40bakingit.com&response.personalData(3).personalDataKey=http%3A%2F%2Faxschema.org%2FnamePerson%2Ffirst&response.personalData(3).personalDataValue=Invoice&response.personalData(4).personalDataKey=http%3A%2F%2Faxschema.org%2FnamePerson%2Flast&response.personalData(4).personalDataValue=Sender+&response.personalData(5).personalDataKey=http%3A%2F%2Fschema.openid.net%2Fcontact%2Ffullname&response.personalData(5).personalDataValue=Invoice+Sender+&response.personalData(6).personalDataKey=https%3A%2F%2Fwww.paypal.com%2Fwebapps%2Fauth%2Fschema%2FpayerID&response.personalData(6).personalDataValue=H4KY78FSAPYF4

现在,当我从Junit测试中使用相同的访问令牌和令牌密钥时,我得到相同的值并且它会出现错误“身份验证失败。 API凭据不正确。“

我使用完全相同的凭据

标题

{X-PAYPAL-REQUEST-DATA-FORMAT=NV, X-PAYPAL-APPLICATION-ID=APP-80W284485P519543T, X-PP-AUTHORIZATION=token=uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature=6xe5sVZcHtt2YZtnOBqyor98Tl0=,timestamp=1349383983, X-PAYPAL-DEVICE-IPADDRESS=127.0.0.1, X-PAYPAL-REQUEST-SOURCE=sdk-merchant-java-1.1.93, X-PAYPAL-SANDBOX-EMAIL-ADDRESS=Platform.sdk.seller@gmail.com, X-PAYPAL-RESPONSE-DATA-FORMAT=NV}

有效载荷

requestEnvelope.errorLanguage=en_US&attributeList.attribute(0)=http://axschema.org/namePerson/first&attributeList.attribute(1)=http://axschema.org/namePerson/last&attributeList.attribute(2)=http://axschema.org/contact/email&attributeList.attribute(3)=http://schema.openid.net/contact/fullname&attributeList.attribute(4)=http://axschema.org/company/name&attributeList.attribute(5)=http://axschema.org/contact/country/home&attributeList.attribute(6)=https://www.paypal.com/webapps/auth/schema/payerID&

响应

responseEnvelope.timestamp=2012-10-04T13%3A54%3A51.690-07%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=e6ea99b5f3156&responseEnvelope.build=2210301&error(0).errorId=520003&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Authentication+failed.+API+credentials+are+incorrect.

1 个答案:

答案 0 :(得分:1)

我们看到在junit测试用例中传递的标头是不正确的,这应该是问题。

{X-PAYPAL-REQUEST-DATA-FORMAT = NV,X-PAYPAL-APPLICATION-ID = APP-80W284485P519543T, X-PP-AUTHORIZATION = token = uJvLxPmOCPVQbfVSxkH29I53Q6c5gd6XvY40ygCQxpbpOJOWrWQ-nA,signature = 6xe5sVZcHtt2YZtnOBqyor98Tl0 =,timestamp = 1349383983,X-PAYPAL-DEVICE-IPADDRESS = 127.0.0.1,X-PAYPAL-REQUEST-SOURCE = sdk-merchant-java-1.1.93,X-PAYPAL-SANDBOX-EMAIL-ADDRESS = Platform.sdk。 seller@gmail.com,X-PAYPAL-RESPONSE-DATA-FORMAT = NV}

X-PP-AUTHORIZATION 更改为 X-PAYPAL-AUTHORIZATION ,这应该可以解决您的问题。请参阅SDK中的标题值。