PersuitOfPerfection
PersuitOfPerfection

Reputation: 1029

How to retrieve completed payment details on android

On android we have access to the following:

// Get the confirmation data PaymentConfirmation confirmation = data.getParcelableExtra( PaymentActivity.EXTRA_RESULT_CONFIRMATION );

Which when converted to a JSON object, gives us details about the payment, such as completed, the sdk version in use etc. However it does not contain the currency code, short description and amount variables that are available on iOS.

On iOS you can retrieve the currency code like this for example:

- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment { NSString *currencyCode = completedPayment.currencyCode; }

How can one get access to these variables on Android? Honestly, the discrepancies between the PayPal Android & iOS SDK's are starting to get on my nerves. I don't mind a little discrepancy, but please at least document them.

The PayPal iOS/Android SDK documentation is some of the worst documentation I have seen in my life. Not trying to upset anyone or be rude, it's just starting to get tiresome to keep having to ask questions on stackoverflow about things that should be documented.

Hoping for a quick answer.

I'm using the latest version of the PayPal SDK for both Android and iOS. Thanks

Upvotes: 0

Views: 206

Answers (1)

Matt Jacunski
Matt Jacunski

Reputation: 381

The confirmation object includes the payment. To get JSON representation of the payment info:

confirm.getPayment().toJSONObject().toString(3)

This will provide the info you are looking for:

{
   "amount": "2.85",
   "short_description": "Awesome Sauce",
   "intent": "sale",
   "currency_code": "USD"
}

We will add this to the SampleApp for better clarity.

Upvotes: 1

Related Questions