I need to integrate PayPal with my Android application. Payment tests using ENVIRONMENT_NO_NETWORK
work fine. However, when I use "production" I get "Login Failed. System error. Please try again later" when I try to login and pay. This issue is consistent. I have seen multiple posts on this problem, however, I still cannot figure out how to make it work.
I am using the latest PayPal Android SDK version (I think version 1.2.5, judging from PayPal-Android-SDK Git).
First, I start the service:
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, PaymentActivity.ENVIRONMENT_PRODUCTION);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, getString(R.string.paypal_clientid));
startService(intent);
And then I make a payment
PayPalPayment payment = new PayPalPayment(new BigDecimal("2.00"), "USD", "my payment");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, PaymentActivity.ENVIRONMENT_PRODUCTION);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, getString(R.string.paypal_clientid));
intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, userEmail);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, getString(R.string.paypal_email));
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
startActivityForResult(intent, 0);
I use the Client ID from "Live Credentials" section in the application information. I do not use "Secret" anywhere.
I have also disabled card.io card scanning if that makes any difference.
When I try to make the payment, I can see the PayPal order screen. I click on "Pay with PayPal". I enter my personal PayPal email address and password (it is a separate PayPal account, not associated with the application) and click "Log in". But then I get a dialog saying "Login Failed. System error. Please try again later". I see the following messages in the log:
02-04 10:37:07.827: E/RequestError(24963): 500 http response received. Response not parsable.
02-04 10:37:07.832: E/PayPalService(24963): INTERNAL_SERVER_ERROR
02-04 10:37:07.927: E/LoginActivity(24963): login error: INTERNAL_SERVER_ERROR
The PayPal account I am using (where the application is created) has credit card added and it is verified.
UPD For comparison, I can successfully login with the same email, under which the PayPal application is created. However, if I use the same email, under which the PayPal application is created, but provide a wrong password, I also get "Login Failed. System error. Please try again later", but this time I see the following messages in the log:
02-06 10:42:00.715: E/RequestError(14165): , Mobile Login failed.
02-06 10:42:00.715: E/PayPalService(14165): 10803
02-06 10:42:00.830: E/LoginActivity(14165): login error: 10803
Note, that in this case PayPal correctly recognizes an incorrect credentials attempt.
Apparently there is a bug in PayPal login window. When a password field in the PayPal login contains "&" character, INTERNAL_SERVER_ERROR message is shown (does not matter if credentials are correct or not):
02-09 14:34:01.171: E/RequestError(6618): 500 http response received. Response not parsable.
02-09 14:34:01.171: E/PayPalService(6618): INTERNAL_SERVER_ERROR
02-09 14:34:01.341: E/LoginActivity(6618): login error: INTERNAL_SERVER_ERROR
If there is no "&" character in password and credentials are not correct, a valid error message is shown in the log:
02-09 14:33:48.741: E/RequestError(6618): , Mobile Login failed.
02-09 14:33:48.746: E/PayPalService(6618): 10803
02-09 14:33:49.206: E/LoginActivity(6618): login error: 10803
My password contained "&" character. When I changed my password not to contain it, I was able to login.
Follow full story on PayPal Android SDK GitHub page.