Adding my app as a tap and pay option in Android

2.7k views Asked by At

I'm trying to get some information about how to add my app as a tap and pay option for Android devices.

Apps like PayPal and Android Pay can be set as the default app to launch when NFC contact is detected. I would like for my payment app to be an option to launch when someone does NFC tap.

Currently my app can take advantage of NFC by the Android Beam functionality, but I was curious to see how I can get my app included as a tap-to-pay default option so that an NFC tap would launch the app directly.

1

There are 1 answers

0
Pablo R. On

I am trying to do the same like you and I found this question which ables you to show your app as payment method.

Application not visible in Tap and Pay

add this lines within application tag in your android manifest...

 <service android:exported="true" android:name="my.package.MyPaymentService" android:permission="android.permission.BIND_NFC_SERVICE">
        <intent-filter>
            <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <meta-data android:name="android.nfc.cardemulation.host_apdu_service" android:resource="@xml/apduservice" />
    </service>

and then create a file named apdusehvices.xml in your xml folder with this content...

<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:requireDeviceUnlock="true"
    android:apduServiceBanner="@drawable/ic_fingerprint_error">

    <aid-group
        android:category="payment"
        android:description="@string/app_name" >
        <aid-filter
            android:name="325041592E5359532E4444463031"
            android:description="@string/ppse" />
        <aid-filter
            android:name="A0000000041010"
            android:description="@string/mastercard" />
        <aid-filter
            android:name="A0000000031010"
            android:description="@string/visa" />
        <aid-filter
            android:name="A000000003101001"
            android:description="@string/visa" />
        <aid-filter
            android:name="A0000002771010"
            android:description="@string/interac" />
    </aid-group>

you will need to set the string variables in your values => strings and the background image in your drawable folder.

Now I can select my app as Tap & Pay app but when I select it the app crashes and I suppose it's because I haven't created there Service class and the manifest is pointing to my.package.MyPaymentService.