I've been banging my head enough:
I'm writing an Android app that will receive PayPal payments. So I'm using this.
In Java code for the Android app you'd find:
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, PaymentActivity.ENVIRONMENT_NO_NETWORK);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, "LARGE STRING AKA Client ID");
intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "The email of the paying girl");
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, "The email I registered at PayPal");
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
in the onActivityResult
I get this JSON:
{
"payment": {
"short_description": "Donation to Saving The Amazon",
"amount": "5",
"currency_code": "USD"
},
"client": {
"platform": "Android",
"paypal_sdk_version": "1.2.5",
"product_name": "PayPal Android SDK; ",
"environment": "mock"
},
"proof_of_payment": {
"adaptive_payment": {
"timestamp": "2014-02-09T22:44:45+0000",
"payment_exec_status": "COMPLETED",
"app_id": "_FAKE_APPLICATION_ID_",
"pay_key": "AP-70M68096ML426802W"
}
}
}
Now, I need to verify the payment. I'm supposed to make a request (from my server) that looks like this:
curl https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails \
-H "X-PAYPAL-SECURITY-USERID: {userId}" \
-H "X-PAYPAL-SECURITY-PASSWORD: {password}" \
-H "X-PAYPAL-SECURITY-SIGNATURE: {signature}" \
-H "X-PAYPAL-APPLICATION-ID: {appId}" \
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
-d "payKey={payKey}
&requestEnvelope.errorLanguage=en_US"
The PayPal page says I can find the userId
the password
and the signature
here whereas I only find an API Username
, an API Password
and the signature
. I've replaced userId with the value in API Username
and password
with the value in API Password
(and obviously signature
with the value). The payKey
I take it from the proof_of_payment
and the appId
from an app I had to create here. Which is a different from the one I created here. Is this right?
Edit: My request now looks like this: (omitting some parts of the values)
curl https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails \
-H "X-PAYPAL-SECURITY-USERID: info_api1.test.com" \
-H "X-PAYPAL-SECURITY-PASSWORD: XXNXXXA6XXX3PGXX" \
-H "X-PAYPAL-SECURITY-SIGNATURE: XXXXXvXXXXXqXXXXXm1XXXXXg3fOAuds4mc3XXXXXXXXJdy4XXXXXXqX" \
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
-d "payKey=AP-70M68096ML426802W
&requestEnvelope.errorLanguage=en_US"
After all this, PayPal is happy to tell me:
responseEnvelope.timestamp=2014-02-09T15%3A37%3A37.559-08%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=33628be038bc5&responseEnvelope.build=9641252&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.
I just can't get the information necessary to verify this payment. What I'm I doing wrong?