Reputation:
I am using the following SDK : https://github.com/paypal/PayPal-Android-SDK
I have this in my AndroidManifext.xml :
<!-- PayPal Android SDK start -->
<service android:name="com.paypal.android.sdk.payments.PayPalService"
android:exported="false" />
<activity android:name="com.paypal.android.sdk.payments.PaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.LoginActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" />
<activity android:name="io.card.payment.CardIOActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" />
<!-- PayPal Android SDK end -->
In my fragment that I am initiating the purchasing from I have the following code (which was taken from the SDK tutorial):
private static PayPalConfiguration paypal_config = new PayPalConfiguration()
// Start with mock environment. When ready, switch to sandbox (ENVIRONMENT_SANDBOX)
// or live (ENVIRONMENT_PRODUCTION)
.environment(PayPalConfiguration.ENVIRONMENT_SANDBOX)
.clientId("<--ID-->");
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
Intent intent = new Intent(getActivity(), PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, paypal_config);
getActivity().startService(intent);
...
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme);
LayoutInflater inflater = LayoutInflater.from(getActivity());
View prompt = inflater.inflate(R.layout.purchase, null);
Button cancel_btn = (Button) prompt.findViewById(R.id.cancel);
Button purchase_btn = (Button) prompt.findViewById(R.id.purchase_button);
PayPalPayment payment = new PayPalPayment(new BigDecimal("1.75"), "USD", "sample item",
PayPalPayment.PAYMENT_INTENT_SALE);
Intent intent = new Intent(getActivity(), PaymentActivity.class);
// send the same configuration for restart resiliency
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, paypal_config);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
startActivityForResult(intent, 0);
}
});
This was working for all of yesterday and most of today, yet today I am getting the errors stated in the title. I went to the developer portal for paypal and there are no notices for my account, and my app/accounts/users are set up correctly (nothing has changed since before it was working. It just stopped working during testing).
Has anyone faced this issue and resolved it successfully?
Edit: A little more info: When the paypal view pops up, it gives me an error popup Title: "Try Again" Message: "There was a problem communicating with the PayPal servers. Please try again." If it tap cancel, it goes back to my app's view. Sometimes, when I tap 'Try Again' it will let me through to the payment and login buttons, but when I try to login it gives me a similar error with only "Ok" as an option.
Edit 2: After hitting 'Try Again' several times I also get this error:
"E/paypal.sdk: request failed with server response:Socket is closed"
Edit 3: Also, right before these errors I am always getting this error:
"E/ViewRootImpl: sendUserActionEvent() mView == null"
Anyone know if this is a cause of the problem? Not really sure what this means as the view is actually loading fine, but there seems to be an issue with the server call afterwards.
Edit 4: Seems to work fine with ENVIRONMENT_PRODUCTION set w/ Production clientId. I tried deleting the app, using different accounts for the app, and even tried with another paypal account to no avail. Unless there is something I am missing or PayPal is restricting my testing account, then there is something wrong with PayPal's server. Hopefully someone more knowledgeable can come in and shed some light on this issue so others don't have to waste there time on this.
Edit 5: Scratch that. I am getting the error on production environment now... what gives?
Upvotes: 0
Views: 1080
Reputation: 2850
Your best bet with these sort of connection errors is to grab the log cat output and look for an error message with a debug_id
and then contact Merchant Support. They can look in to the specific thing that's happening on the backend.
Upvotes: 0