Standard UI – PayU Documentation

Standard UI

 

Overview

 

Our SDK with standard UI or SDKUI as we call it, is the fastest and most hassle free solution for you to collect payments in your mobile app. All you need to do to initiate a transaction is POST a request with mandatory parameters to our SDK and everything from there will be taken care by us. Our Payment UI, where customer needs to fill in the payments details is highly optimised to provide a good customer experience and high success rates with information like bank downtime notifications feature available on the payment page itself.

Read more to find out how to integrate the SDKUI

Steps Involved

 

In order to integrate SDKUI to accept payments, you need to carry out the following steps:

  1. Importing the SDKUI as a module for UI.
  2. Collecting Parameters and sending it to SDKUI.
  3. Creating Android Intent or iOS object and sending it to UI where customer opts the payment mode and fill in the payment details, from where it is taken care by the SDK.
  4. Accepting the response after the transaction.

Importing the SDKUI as a module for UI

 

In a standard UI integration, the part where a customer chooses the payment mode and fill in the related details is done using the UI that we provide and all you need to do is to import the SDKUI as a module for the UI. 

 

Collecting Parameters

 

In order to collect payments using our UI, you will have to create objects and set configurations which are as following:

Payment params:

 

In order to initiate a transaction you will have to send some mandatory parameters which are as follows:

 

Parameters Description Data type Character Limit Example
Key Unique key provided by Payu varchar 20 characters C0Ds8q
Txnid Transaction id/ reference id generated at your end Varchar 25 characters fd3e847h2
Amount Amount payable by customer Number, Float type 2 digits after decimel 10.00
Productinfo Small description of product, a string defining your product Varchar 100 characters tshirt100
Firstname First name of customer Varchar 60 characters Ankit
Email                          Email id of customer Varchar 50 test@gmail.com
Phone Phone number of customer Varchar 50 (numeric) 9999999999
surl Redirect URL (your site) in case of a successful transaction HTTP URL mediumtext success@yoursite.com
furl Redirect URL (your site) in case of a failed transaction HTTP URL mediumtext failure@yoursite.com
Hash Security parameter to avoid tampering SHA 512 Varchar (256)

You can send us these parameters by creating an object (mPaymentParams) and accordingly putting in all the parameter values in this object as shown below:

Hash

 

Generating hash at your server side

Hash is a security parameter to avoid tampering and any man in the middle attacks. You have to  calculate it from  your server and it has to be passed on for each transaction and for each API call.

 

  • Payment Hash

sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt)

  • Webservice Hash

sha512(key|command|var1|salt)

 

Retrieving hash from server to app

Once the hashes have been calculated at server side, you need to retrieve the hash to your app in order to pass it to the SDK (hash is one of the mandatory parameters)

PayU Hash

Once these hashes have been retrieved from server, you will have to create another object (PayuHashes) to push in the values of hash generated so as to send it to our UI to initiate a transaction.

PayU config

 

You will have to create this object in order to configure the environment where you want to make a transaction. Set environment as STAGING_ENV for transacting in test environment and PRODUCTION_ENV for transacting in live environment.

Creating intent and showing Non-seamless UI

The final nail in the coffin to initiate a transaction using the standard UI mode would be to pass the payment params, hash and PayU config to SDKUI. You can create an intent in order to pass this information to PayUBaseActivity of SDKUI.

Doing this will launch our UI.

Response

 

PayUReponse:

PayUResponses is given by PayU after completing the transaction. It will have the transaction details like txnid, amount, status etc. in comma separated string format.