Google Pay Push Provisioning

NiumPushPay SDK helps Mobile app developers to easily implement Add to Apple Wallet button or Add to Google Pay button in mobile banking applications.

SDK can enable cardholders to provision their card details from their mobile app to their device's payment wallet in a simple, secure way, eliminating the need to enter their card information manually.

The SDK is intended to be embedded into the mobile application(s). The SDK is intended to be embedded into the mobile application(s). Whereas the mobile app provider is in charge of the app's user experience, the SDK allows clients to take advantage of Nium's infrastructure.

Set up NiumPushPay SDK so that you can add cards to Google Pay.

Getting started with the Android SDK requires the below steps.

Step 1 : Download the SDK and adding to libs folder

To integrate the Nium Push Provisioning libraries, you need to perform a few basic tasks to prepare your Android Studio project.

  • Add the NiumPushPay_SDK.aar to the app/libs directory
  • Add the play-services-tapandpay-17.0.1.aar to the app/libs directory.

Add flatDir in the root build.gradle file.

allprojects {
   repositories {
    flatDir {
        dirs 'libs'
      }
   }
}

And Add the dependency in the app level build.gradle as below

implementation(name:'NiumPushPaySDK', ext:'aar')
implementation(name:'play-services-tapandpay-17.0.1', ext:'aar')

NOTE: The Android SDK is compatible with apps supporting Android API level 21 and above. Apps can be written using Kotlin or Java 8, but must use AndroidX.

Step 2 : Configure the SDK into your app

To configure SDK in your app, initialize the SDK by using the initialize(application,clientHashId,customerHashId,walletHashId,apiSecret) method.

Use getInstance() method to get the object of NiumPushPay SDK.

NOTE: This can be initialized any part of the app, ideally after having the below details

  • clientHashId
  • customerHashId
  • walletHashId
  • apiSecret

Also, override the onActivityResult method in your app and call the NiumPushPay SDK onActivityResult() method in the same activity where you initialize it.

override fun onActivityResult(requestCode: Int,resultCode: Int,  data: Intent?) { 
        NiumPushPay.getInstance().onActivityResult(requestCode, resultCode, data)
}

Step 3 : Verify if card added to wallet (Single card)

Use checkIfCardIsAddedToWallet (cardHashId, CardResultListener) method.

This method is used to check whether provisioned tokens(Added to google pay wallet or not) are present or not and if present then it is in active state or not.

If yes returns true so that client can enable the integrate to wallet option for that particular card.

NiumPushPay.getInstance().checkIfCardIsAddedToWallet(CARD_HASH_ID, object : CardResultListener {
  override fun onCardStatusSuccess(isCardAddedToWallet: Boolean) {
       Toast.makeText(context,"Success $isCardAddedToWallet", Toast.LENGTH_SHORT).show()
  }
  override fun onCardStatusFailure(errorEntity: ErrorEntity) {
       Toast.makeText(context, errorEntity.errMsg, Toast.LENGTH_SHORT).show()
   }
})

Step 4 : Verify if cards added to wallet (All cards)

Use getCards(CardListResultListener) method.

This method is used to check whether provisioned tokens are present or not; and if present, then sets the status to True. And at the end, send a list of cards with their status (whether card is provisioned or not).

This is to check provision status for all available cards.

NiumPushPay.getInstance().getCards(object  : CardListResultListener {
    override fun onCardStatusSuccess(cardResultEntity: List<CardResultEntity>) {
          Toast.makeText(context,"Success",Toast.LENGTH_SHORT).show()
    }
    override fun onCardStatusFailure(errorEntity: ErrorEntity) {
          Toast.makeText(context, errorEntity.errMsg, Toast.LENGTH_SHORT).show()
   }
})

Step 5 : Adding the card to the wallet (Provisioning)

Use addToWallet(PushProvisioingListener) method.

This method is used to add cards to the wallet. After the card is successfully added to the card, the wallet application can get provisioned tokens.

This callback will update whether provisioning is success or failure.

NiumPushPay.getInstance().addToWallet(cardHashId, object :PushProvisioningListener {
     override fun onPushProvisioningSuccess(tokenId: String,cardHashId: String) {
            Toast.makeText(context,"Success",Toast.LENGTH_SHORT).show()
     }
     override fun onPushProvisioningFailure(errorEntity: ErrorEntity) {
            Toast.makeText(context, errorEntity.errMsg, Toast.LENGTH_SHORT).show()
   }
})