-
Notifications
You must be signed in to change notification settings - Fork 8
Home
#Welcome to the Android-SDK wiki!
This document describes the steps for technical integration process between merchant's app and PayU SDK for enabling online transactions.
PayU offers electronic payment services to merchant website through its partnerships with various banks and payment instrument companies. Through PayU, the customers would be able to make electronic payments through a variety of modes which are mentioned below:
- Credit cards
- Debit cards
- Online net banking accounts
- EMI payments
- Cash Cards
- Email Invoicing
- IVR
- Cash on Delivery (COD)
PayU also offers an online interface (known as PayU Dashboard) where the merchant has access to various features like viewing all the transaction details and can be accessed through https://www.payu.in by using the username and password provided to you.
The merchant can integrate with PayU by using one of the below methods:
- Non-Seamless Integration
In Non-Seamless Integration, the Customer would move from the Merchant's Activity to PayU's payment options activity.There he would select the payment options and enter the necessary details. After this PayU would redirect the customer to the bank for further processing.
- Seamless Integration
In this mode, the merchant needs to collect the details on their own website and then send them to PayU's SDK.
-
key : This parameter is the unique Merchant Key provided by PayU for your merchant account. The Merchant Key acts as the unique identifier (primary key) to identify a particular Merchant Account in our database. Example: "C0Ds8q"
-
txnid: This parameter is known as Transaction ID (or Order ID). It is the order reference number generated at your (Merchant’s) end. It is an identifier which you (merchant) would use to track a particular order. It is essential that you post us a unique transaction ID for every new transaction. Example: "fd3e847h2"
-
amount: This parameter should contain the payment amount of the particular transaction. Please type-cast the amount to float. Example: 10.00
-
productinfo: This parameter should contain a brief product description. It should be a string describing the product (The description type is entirely your choice). Example: "tshirt100"
-
firstname: Should contain the first name of the user. Example: "Abdur"
-
email: Must contain the email of the customer. Example: "[email protected]"
-
surl: Success URL - This parameter must contain the URL on which PayU will redirect the final response if the transaction is successful. The response handling can then be done by you after redirection to this URL.
-
furl: Failure URL - This parameter must contain the URL on which PayU will redirect the final response if the transaction is failed.
-
hash (Checksum): Hash is a crucial parameter – used specifically to avoid any tampering during the transaction. For hash calculation, you need to generate a string using certain parameters and apply the sha512 algorithm on this string. Please note that you have to use pipe (|) character in between these parameters as mentioned below. The parameter order is mentioned below: sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT). udf1-udf5 are User Defined Fields.We can set up to 5 User Defined Fields, which would contain has been made for you to keep any information corresponding to the transaction, which may be useful for you to keep in the database. udf1-udf5 fields are for this purpose only. It’s completely for your usage and you can post any string value in this parameter. Example:
Case 1: If all the udf parameters (udf1-udf5) are posted by the merchant. Then, hash=sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT)
Case 2: If only some of the udf parameters are posted and others are not. For example, if udf2 and udf4 are posted and udf1, udf3, udf5 are not. Then, hash=sha512(key|txnid|amount|productinfo|firstname|email||udf2||udf4|||||||SALT)
Case 3: If NONE of the udf parameters (udf1-udf5) are posted. Then, hash=sha512(key|txnid|amount|productinfo|firstname|email|||||||||||SALT)
For seamless mode, 7 extra Mandatory parameters are required along with the parameters mentioned in the above table. These are mentioned below:
-
pg: Defines the payment category.Please set its value to ‘NB’ for Net Banking , ‘CC’ for Credit Card , ‘DC’ for Debit Card , ‘CASH’ for Cash Card and ‘EMI’ for EMI.
-
bankcode: Each payment option is identified with a unique bank code at PayU. You would need to post this parameter with the corresponding payment option’s bankcode value in it. For example, for ICICI Net Banking, the value of bankcode parameter value should be ICIB. For detailed list of bank codes, please contact PayU team.
-
ccnum: This parameter must contain the card (credit/debit) number entered by the customer for the transaction.
-
ccname: This parameter must contain the name on card – as entered by the customer for the transaction.
-
ccvv: This parameter must contain the cvv number of the card – as entered by the customer for the transaction.
-
ccexpmon: This parameter must contain the card’s expiry month - as entered by the customer for the transaction. Please make sure that this is always in 2 digits. For months 1-9, this parameter must be appended with 0 – like 01,02...09.
-
ccexpyr: The customer must contain the card’s expiry year – as entered by the customer for the transaction. It must be of 4 digits. For example - 2017, 2029 etc.
-
To integrate with the PayU Android SDK, download the source code and import it into your IDE, and add it as a dependency in your project.
-
Changes in App’s AndroidManifest.xml : Define the following tags within your application tag-
<metadata android:name="payu_merchant_id" android:value="XXXXXXX"/>
<metadata android:name="payu_merchant_salt" android:value="XXXXXX"/>
- In case of SDK Hash Generation, set SDK_HASH_GENERATION = fasle in Constants.java file.
- To disable back button on Web View, add this tag:
<metadata android:name="payu_disable_back" android:value="true"/>
-
Define the following activities:
<activity android:name="com.payu.sdk.PaymentOptionsActivity" android:configChanges= "orientation|keyboard|screenSize"
<activity android:name="com.payu.sdk.ProcessPaymentActivity" android:configChanges="orientation|screenSize" />
-
Add these following permissions to your app:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
-
In your main activity, create a HashMap (for Java ) with the mandatory parameteres-
HashMap<String, String> params = new HashMap<String, String>();
params.put(PayU.TXNID, "0nf7" + System.currentTimeMillis());
params.put(PayU.PRODUCT_INFO, "product");
params.put(PayU.USER_CREDENTIALS, "xxxxx:1msdf");
params.put(PayU.FURL, "https://dl.dropboxusercontent.com/s/1goxkgkx18sg5sm/failure.html");
params.put(PayU.SURL, "https://dl.dropboxusercontent.com/s/dtnvwz5p4uymjvg/success.html");