Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set application default payment service

Let's think about a case where user has installed multiple applications capable of NFC HCE payments. Those application services are visible under settings NFC Tap and Pay.

How to programmatically change your application to be the default payment service if it's not?

CardEmulation seems only to have API to query if service for category is default.

Thanks.

like image 670
Niko Avatar asked Jun 11 '14 13:06

Niko


People also ask

How do I set a default payment app?

Open Settings > tap Connections > tap NFC and payment again. Turn on the NFC feature on your phone, and then tap Tap and pay. Choose Google Pay as your default payment method.

What does it mean when it says set as default payment?

A default payment method is the payment method that will be used for all created payments going forward.

How do I change the default pay app on Android?

Open the phone's Settings and select the Apps menu. Tap the three-dot icon and select Default Apps or select the setting for Choose default apps. Choose the Tap and pay option and set it to Google Pay (or G Pay) if it isn't already the default. Google Pay will then pop up as the payment system when needed.

How do I change my main payment method?

Log in to your PayPal account (make sure you're using two-factor authorization for extra security while you're at it). Then, click the Wallet tab. You'll see a list of the payment methods you've linked on the left. Click the one you want to default to, and then click Set as preferred.


1 Answers

The main idea behind having that UI is that the user can decide on which payment app should be the default app. Consequently, there is no way to programmatically set your app to be the default.

However, you can request the user to set your app as default app for the payment category (see ACTION_CHANGE_DEFAULT):

Intent intent = new Intent();
intent.setAction(CardEmulation.ACTION_CHANGE_DEFAULT);
intent.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT,
                new ComponentName(this, my.package.MyPaymentService.class));
intent.putExtra(CardEmulation.EXTRA_CATEGORY, CardEmulation.CATEGORY_PAYMENT);

startActivity(intent);
like image 90
Michael Roland Avatar answered Oct 13 '22 09:10

Michael Roland