2

我想在 paypal 集成到 android 应用程序中禁用/隐藏带有“信用卡支付”选项的按钮。有没有办法做到这一点?

4

4 回答 4

13

下面是最新的 SDK 中的解决方案:(取自另一个答案,以保持此答案是最新的)

PayPalConfiguration() object = new PayPalConfiguration();
object = object.acceptCreditCards(false);

intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, object);

对于较旧的 SDK:

设置下面额外的一个Intent开始PaymentActivity。这将隐藏“使用信用卡付款”按钮。

// Set extra to skip credit card payment.
intent.putExtra(PaymentActivity.EXTRA_SKIP_CREDIT_CARD, true);
于 2013-09-01T09:23:00.623 回答
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);
}

=)

于 2013-09-04T19:50:28.417 回答
0

只需使用 acceptCreditCards(false) 作为 false 来禁用信用卡。

private static PayPalConfiguration config = new PayPalConfiguration()
        .acceptCreditCards(false)//disable credit card from PayPal
于 2020-10-22T11:50:40.860 回答
0

尝试这个

就我而言,EXTRA_SKIP_CREDIT_CARD 不起作用

所以我尝试了这段代码,这最终对我有用

    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);
于 2017-08-16T08:33:28.340 回答