One Tap- Android – PayU Documentation

One Tap

Android

Pre-requisites

1. Android Studio v1.3+, Android SDK API 9+, Android compile and build tool versions 23+, PayU PG SDK v4.3+

2. PayU Mobile Custom Browser v5.3+

3.  Store Card as a service from PayU

Steps Involved

 

The functioning of One Tap has two parts, where our SDKs takes care of the part of making the transaction CVV less and our Custom Browser takes care of automatically selecting the customer’s OTP. Accordingly the integration that follows is divided into two parts:

SDK:

  1. Enrolling a card, an already stored card or a fresh card, for One Tap Payment.
  2. Making payment as One Tap payment by sending the information to SDK
  3. Deleting a One tap card.

Custom Browser:

  1. Enable parameters to automatically select the OTP.

Subscribing a One Tap card

 

Change in UI

In StoredCard & CC/DC screen create a checkbox, which should ask user to enroll for oneTap Payment(Refer sample app for more details).

Converting an already stored card to One Tap card

If a customer wants to enrol an existing  stored card for OneTap payment, you need to  send PayU an extra parameter (setEnableOneClickPayment(1)) during the transaction to the otherwise existing flow of store card feature.
Code of line that needs to be added

Sample code form with all the parameters required to enroll a store card for OneTap Payment is

Using a fresh Credit/ Debit card as One Tap card

If a customer wants to enrol a fresh CC/DC card for Onetap Payment  you need to do is send us two extra parameters (mPaymentParams.setStoreCard(1) , setEnableOneClickPayment(1)) during the transaction to the otherwise existing flow of CC/DC.
Code of line that needs to be added:

the  sample code with all the parameters required for enrolling a regular CC/DC payment card for OneTap payment  looks like

Response

Making payment via One Tap Card

 

In order to do a transaction by using a card that has already been enrolled for  One tap, you would need to do the following

Fetch merchant hashes and card_token from your server

The first step towards making a transaction via One tap would be to fetch all the merchant hashes and card_tokens for a user from your database.

Fetch store cards from Payu server

You would need to fetch all the store cards from PayU for a user  to choose one of the store cards to make payment. You have to do this by calling our API payment_related_details_for_mobile_sdk.

 

To use payment_related_details_for_mobile_sdk:

 

POST

 

In order to retrieve all the store cards, you need to make a call on the following URL with certain parameters:

Environment URL
Test https://test.payu.in/merchant/postservice.php?form=2
Live https://info.payu.in/merchant/postservice.php?form=2

Parameters:

Parameter Description Sample value
Key Your key provided by payu gtKFFx
Command Name of web service call payment_related_details_for_mobile_sdk
hash Security parameter e54de882e2b14c13424c91a4855fea2dc9b2a3a9525531408beec97564dd336460e22d72770ba37a5fcb6bad76d042582e87cc26b34741b6b6747e6b5b71b2cc
User_credentials Identification parameter of customer gtKFFx:payutest@payu.in

You would need to send all the parameters in the following mentioned format

Response

This response gives a list of all the stored cards, in the form of stored card objects (StoredCard). The stored card object will have the following parameters, card_token, card name, card_type, etc.

 

Mapping merchant_hashes to card_token

After all the stored cards have been fetched from payu, it would be needed to map them to their corresponding merchant_hashes to distinguish all the stored cards from One tap cards. You can do it by using the below mentioned code

Making a payment post request

 

Among the one tap cards returned, customer chooses a card, and you would need to send to the card_token and corresponding merchant_hash of the card chosen along with the other payment parameters as you would’ve for store card transaction, with a replacement of one parameter:

Parameter Replacement param Description Example
ccvv merchant_hash  A mandatory parameter to make the transaction cvv-less

Now the form has to be submitted to payu’s SDK, the sample code is as follows

Deleting a card

 

In order to delete a card, you would need to implement the following interface

 

Delete store cards

If your customer chooses to delete a card, it can be done by making an API call to PayU. All you need to do is:

Post:

Environment URL
Test https://test.payu.in/merchant/postservice.php?form=1
Live https://info.payu.in/merchant/postservice.php?form=1

Parameters:

Parameter Description Sample value
Key Your key provided by payu gtKFFx
Command Name of web service call DELETE_USER_CARD
hash Security parameter e54de882e2b14c13424c91a4855fea2dc9b2a3a9525531408beec97564dd336460e22d72770ba37a5fcb6bad76d042582e87cc26b34741b6b6747e6b5b71b2cc
var1=User_credentials Identification parameter of customer gtKFFx:payutest@payu.in
var2=Card_token Identification parameters of Card

You would need to send all the parameters in the following mentioned format

Response

Changes in Custom Browser

You will have to set the following flags true in order to facilitate One Tap transactions.

Sample code