In this blog,
I will show you how to get the full transaction details after getting the payment_id in paypal android sdk.
Maximum time the users have confused how to get the full transaction details after getting the pay id in paypal android sdk.
For the security reason, the sdk never gives the full transaction details like web payment. So
you have to make another API calls to get the complete details.
How to get the transaction details
If you get the following response in sdk means the payment has been completed but this is not enough details for us,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
{ "response": { "state": "approved", "id": "PAY-9A140896UE325390DK5VK4KI", "create_time": "2016-06-22T15:26:40Z", "intent": "sale" }, "client": { "platform": "Android", "paypal_sdk_version": "2.14.1", "product_name": "PayPal-Android-SDK", "environment": "sandbox" }, "response_type": "payment" } |
So after getting this details you have to send the pay id to server site and you have to do some api calls,
1. We have to generate the access-Token by the client_id and secret,
1 2 3 4 5 |
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "client_id:secret" \ -d "grant_type=client_credentials" |
2. After getting the access-Token you have to make another api call for getting the full transaction details,
1 2 3 |
curl -v -X GET https://api.sandbox.paypal.com/v1/payments/payment/Payment-Id \ -H "Content-Type:application/json" \ -H "Authorization: Bearer Access-Token" |
After hitting this I will get the full transaction details.