Bat Bayan
Bat Bayan

Reputation: 5

PayPal - Unable to verify the payment using Transaction ID (GetTransactionDetails API)

There are a lot of discussions about similar issues but I couldn’t find the exact answer.

Here is the problem:

I’m trying to integrate in-app payment in Android OS using the latest PayPal MSDK library. The integration was straight forward, I could make successful single payment, receive proper response and the things was OK until I have to verify the mobile payment

In the mobile app(using PayPalConfiguration.ENVIRONMENT_SANDBOX), I receive the following response:

{
    "client": {
        "environment": "sandbox",
        "paypal_sdk_version": "2.2.2",
        "platform": "Android",
        "product_name": "PayPal-Android-SDK"
    },
    "response": {
        "create_time": "2014-08-05T19:49:19Z",
        "id": "PAY-0D205735ER3716140KPQTKPY",
        "intent": "sale",
        "state": "approved"
    },
    "response_type": "payment"
}

As you can see, the transaction ID is: PAY-0D205735ER3716140KPQTKPY

When I try to verify the payment by making request with this transaction ID from my server to PayPal, the response is always the same:

{
"Errors":
     [
        {
        "L_ERRORCODE":"10004",
        "L_SHORTMESSAGE":"Transaction refused because of an invalid argument. See additional error messages for details.",
        "L_LONGMESSAGE":"The transaction id is not valid",
        "L_SEVERITYCODE":"Error"
        }
     ]
}

When I check in PayPal Sandbox test account site -> Notifications, the test transactions ids are completely different. For the above transaction, the transaction id is: 5DY75733624918945

If I use this transaction ID in my verification request – the response from the PayPal is OK.

According the documentation, I should use the id from the mobile app response (moreover – I do not know other way to retrieve a transaction id…).

I'm using a test sandbox account, tried with different type of payment (PayPal button and CC), tried even with real transactions - the result is the same.

Do you guys know why they are different?

Upvotes: 0

Views: 2648

Answers (1)

Matt Jacunski
Matt Jacunski

Reputation: 381

Please take a closer look at https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/

The SDK returns a payment ID which can be used to retrieve a payment resource using GET. The payment will contain one or more transactions (in your case, a single sale transaction) in the related_resources section.

Upvotes: 1

Related Questions