I want to disable/hide a button with option for "credit card payment" in paypal integration to android application. Is there any way to do this?
Asked
Active
Viewed 3,427 times
4 Answers
13
In latest SDK below is the solution : (taken from another answer to keep this answer upto date)
PayPalConfiguration() object = new PayPalConfiguration();
object = object.acceptCreditCards(false);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, object);
For older SDK :
Set below extra to an Intent
that starts PaymentActivity
. This will hide "Pay with credit card" button.
// Set extra to skip credit card payment.
intent.putExtra(PaymentActivity.EXTRA_SKIP_CREDIT_CARD, true);

Geek
- 8,280
- 17
- 73
- 137
-
@user1007522 So how to hide "Play with Credit card" in new Paypal SDK – BaDo Sep 25 '15 at 09:02
2
you must put "PaymentActivity.EXTRA_SKIP_CREDIT_CARD" in onBuyPressed function...
public void onBuyPressed(View pressed) {
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal("1.75"), "USD", "hipster jeans");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
// It's important to repeat the clientId here so that the SDK has it if Android restarts your
// app midway through the payment UI flow.
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, "credential-from-developer.paypal.com");
intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "your-customer-id-in-your-system");
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
/******************************************************************/
//HERE disable/hide a button with option for "credit card payment"
/******************************************************************/
intent.putExtra(PaymentActivity.EXTRA_SKIP_CREDIT_CARD, true);
startActivityForResult(intent, 0);
}
=)

Félix Castro
- 59
- 1
- 3
0
Try This
In my case EXTRA_SKIP_CREDIT_CARD is not working
So i tried this code this is working for me finally
PayPalConfiguration config = new PayPalConfiguration().environment(PayPalConfiguration.ENVIRONMENT_SANDBOX).clientId(Constants.PAYPAL_CLIENT_ID);
PayPalPayment payment = new PayPalPayment(new BigDecimal("10"), "USD", "Credited Amount", PayPalPayment.PAYMENT_INTENT_SALE);
Intent intent = new Intent(this, PaymentActivity.class);
config.acceptCreditCards(false);//this will disable your card option
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
startActivityForResult(intent, 123);
0
Just use acceptCreditCards(false) as false to disable Credit Card.
private static PayPalConfiguration config = new PayPalConfiguration()
.acceptCreditCards(false)//disable credit card from PayPal

Abdul Basit Rishi
- 2,268
- 24
- 30