Jump to content


Paypal Integration With Android: Server Communication Error With Sandbox Account

paypal paypal-integration java android sandbox-paypal

  • Please log in to reply
1 reply to this topic

#1 san.bhat



  • Members
  • Pip
  • 1 posts

Posted 11 June 2014 - 05:36 AM

I am new to android-paypal integration . I used the code below and the sandbox credentials 


Can anyone please help me to solve the server communication error please check the attachment for the errors


import java.math.BigDecimal;
import org.json.JSONException;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.paypal.android.sdk.payments.PayPalConfiguration;
import com.paypal.android.sdk.payments.PayPalPayment;
import com.paypal.android.sdk.payments.PayPalService;
import com.paypal.android.sdk.payments.PaymentActivity;
import com.paypal.android.sdk.payments.PaymentConfirmation;
public class sample extends Activity {
    private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_SANDBOX;
    // note that these credentials will differ between live & sandbox environments.
    private static final String CONFIG_CLIENT_ID = "AQkquBDf1zctJOWGKWUEtKXm6qVhueUEMvXO_-MCI4DQQ4-LWvkDLIN2fGsd";
    private static PayPalConfiguration config = new PayPalConfiguration()
    protected void onCreate(Bundle savedInstanceState) {
        Intent intent = new Intent(sample.this, PayPalService.class);
        intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
    public void onBuyPressed(View pressed) {
        PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);
        Intent intent = new Intent(sample.this, PaymentActivity.class);
        intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
        startActivityForResult(intent, 0);
     private PayPalPayment getThingToBuy(String paymentIntent) {
    Intent intent1 = getIntent();
    String message = intent1.getStringExtra("title");
        String price = intent1.getStringExtra("price");
        return new PayPalPayment(new BigDecimal(price), "GBP", message,
    protected void onActivityResult (int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
            if (confirm != null) {
                try {
                    Log.i("paymentExample", confirm.toJSONObject().toString(4));
                } catch (JSONException e) {
                    Log.e("paymentExample", "an extremely unlikely failure occurred: ", e);
        else if (resultCode == Activity.RESULT_CANCELED) {
            Log.i("paymentExample", "The user canceled.");
        else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
            Log.i("paymentExample", "An invalid payment was submitted. Please see the docs.");
    public void onDestroy() {
        stopService(new Intent(this, PayPalService.class));
I have posted the error which i am getting the issue why it is showing as server communication error and when i use the live id it will get it as invalid pay-pal sdk

Attached Files

#2 Puran



  • Members
  • Pip
  • 1 posts

Posted 13 August 2015 - 07:55 AM

i have been facing same issue

Also tagged with one or more of these keywords: paypal, paypal-integration, java, android, sandbox-paypal

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users