I am trying to integrate PayPal into my Android app using Java. The integration is complete, but I am encountering the following error when attempting to process a payment:

PayPal Payment Failed - Vendor account does not have a confirmed email

Additionally, when I checked the PayPal API response, I saw the following error details:

{
    "name": "PAYEE_ACCOUNT_INVALID",
    "message": "Payee account is invalid."
}

Steps I Took: Sandbox Testing:

  • Used a sandbox client ID and tried making a payment using the test Visa card 4242 4242 4242 4242.
  • Received the same error.

Live Testing:

  • Used the live client ID and attempted payment using my HDFC card. Encountered the same issue.
  • Logged into my PayPal account, but I couldn't figure out what might be causing the issue.

My Code: Here is my code:

package com.example.paypalproject;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.util.UUID;
import java.math.BigDecimal;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;

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 MainActivity extends AppCompatActivity {

    private static final String PAYPAL_CLIENT_ID = ""; // sandbox client id i have used here

    private static final int PAYPAL_REQUEST_CODE = 123;

    private String transactionReferenceId;
    private TextView paymentStatus;
    private ActivityResultLauncher<Intent> paymentResultLauncher;

    private PayPalConfiguration payPalConfig;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        paymentStatus = findViewById(R.id.payment_status);
        Button paypalpayButton = findViewById(R.id.paypalpay_button);

        // Initialize PayPal configuration
        payPalConfig = new PayPalConfiguration()
                .environment(PayPalConfiguration.ENVIRONMENT_SANDBOX) // Use sandbox for testing
                .clientId(PAYPAL_CLIENT_ID);


        // Start PayPal service
        Intent intent = new Intent(this, PayPalService.class);
        intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, payPalConfig);
        startService(intent);

        // Generate unique transaction reference ID
        transactionReferenceId = "T" + UUID.randomUUID().toString().substring(0, 8);
        Log.d("UPI Payment", "transactionReferenceId: " + transactionReferenceId);

        // Set onClickListener for the PayPal pay button
        paypalpayButton.setOnClickListener(v -> initiatePayPalPayment());
    }

    private void initiatePayPalPayment() {
        // Create a PayPal payment object

        double inrAmount = 1; // Amount in INR
        double conversionRate = 86.39;
        double usdAmount = inrAmount / conversionRate;

        PayPalPayment payment = new PayPalPayment(new BigDecimal(usdAmount), "USD", "Live Payment", PayPalPayment.PAYMENT_INTENT_SALE);

        // Create an intent for PayPal payment
        Intent intent = new Intent(this, PaymentActivity.class);
        intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, payPalConfig);
        intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);

        // Launch PayPal payment activity
        startActivityForResult(intent, PAYPAL_REQUEST_CODE);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == PAYPAL_REQUEST_CODE) {
            if (resultCode == RESULT_OK && data != null) {
                PaymentConfirmation confirmation = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
                if (confirmation != null) {
                    try {
                        // Log and handle the payment confirmation
                        String paymentDetails = confirmation.toJSONObject().toString(4);
                        Log.d("PayPalPayPalPayPal", "Payment Confirmation: " + paymentDetails);
                        paymentStatus.setText("Payment successful!");
                        Toast.makeText(this, "Payment successful!", Toast.LENGTH_SHORT).show();
                    } catch (Exception e) {
                        Log.e("PayPalPayPalPayPal", "Error: " + e.getMessage());
                    }
                }
            } else if (resultCode == RESULT_CANCELED) {
                paymentStatus.setText("Payment canceled.");
                Toast.makeText(this, "Payment canceled.", Toast.LENGTH_SHORT).show();
            } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
                paymentStatus.setText("Invalid Payment.");

                Toast.makeText(this, "Invalid Payment.", Toast.LENGTH_SHORT).show();
            }
        }
    }


    @Override
    protected void onDestroy() {
        stopService(new Intent(this, PayPalService.class));
        super.onDestroy();
    }
}

Questions:

  • How can I fix the "Vendor account does not have a confirmed email" error?
  • Is there any additional setup required in PayPal to validate my vendor account for sandbox or live environments?
  • Could this issue be related to the client ID or PayPal account type? Any guidance or suggestions would be greatly appreciated.

Screenshot: Vendor account does not have a confirmed email - image

Source: View source