PayUMoney Android Integration Tutorial – Robust Way To Collect In-App Payments
29 Aug. 2016 Mobile App
PayUMoney is one of the most trusted payment gateways which offers secure mobile payments. Executing PayUMoney Integration in Android is fast and easy albeit it may present you to some challenges. So, let’s begin with checking out the challenges you may face while integrating.
Integrate PayUMoney in Android
Challenges Faced While Integrating PayUMoney:
- Getting real-time notifications for success or failure of transactions: If a merchant or PayUMoney updates their payment pages while a customer is processing the payment, the transaction can result into a failure. In such scenario, the integration must enable real-time notifications for the success or failure of the transactions.
- Deciding whether to go with seamless and non-seamless integration: The app owner and developer after choosing a payment gateway needs to decide on the appropriate workflow for the app. Seamless integration requires more work by the developer in terms of developing a UI to collect card/bank details and passing it on to PayUMoney servers. This can be a challenge because no financial information should be passed to the merchant server during the process.
- Developing relevant user experience based on success or failure of payment: The user needs to see the transaction details in the app once the flow is completed and a successful charge is placed on the card/bank. If the transaction is terminated in the process either due to bad connectivity, low inventory or any other reason, the user needs to be notified about the same.
There are two ways for PayUMoney payment gateway integration in Android application:
- Non-seamless Integration: It is a standard method where during a transaction, the customer is re-directed to PayUMoney landing page from the merchant’s app, wherein the payment option and card details are to be entered. Thereafter, PayUMoney redirects the customer to bank’s web page for further authentication.
- Seamless Integration: In this method, the customer enters all the payment details on the merchant’s app or website without having to visit the PayUMoney page. The merchant then processes the payment details to PayUMoney and should be PCI-DSS certified. This method minimizes the website redirect efforts offering a better user experience. The integration kits (code) provided by PayUMoney simplifies the seamless integration method.
Steps to Implement Seamless PayUMoney Android Integration Method:
- You first need to setup a test page with PayUMoney to initiate the integration. A test merchant account along with test credit card credentials will be given to experience the overall transaction flow. You first need to make a transaction request on PayUMoney’s test server. Once this is done, you can move to PayUMoney’s production server.
- Next step is to generate a ‘Post Request’ to initiate the transaction. This must have mandatory and optional parameters. The ‘Post Request’ needs to hit the PayUMoney URLs mentioned below:
- For PayU Test Server:
POST URL: https://test.payu.in/_payment
- For PayU Production (LIVE) Server:
POST URL: https://secure.payu.in/_payment
- One of the mandatory parameters in the merchant-initiated ‘Post Request’ is termed as hash. You need to calculate the hash correctly, which in most cases is critical.
- Once the transaction ‘Post Request’ hits the PayUMoney server, it creates a new transaction entry in the database. And to identify each new transaction in the database, a unique identifier is generated every time at PayUMoney’s end. The identifier that is created is called as the PayUMoney ID or MihPayID.
- The customer will now be redirected to PayUMoney’s payment page with the ‘Post Request’. The customer can select a particular payment option and click on ‘Pay Now’ button. PayUMoney then redirects the customer to the desired bank. Now they need to go through the authentication process on bank’s login page after which the bank gives the success or failure response to PayUMoney.
- On the basis of the response from the bank, PayUMoney marks the transaction status and provides the final transaction response string to the merchant via ‘Post Response’.
- Along with ‘Post Response,’ you will also receive the hash parameters. As mentioned in step 3, calculating the hash is critical. So you need to verify the hash value correctly at your end and then accept or reject the invoice order. This will help you avoid any tampering by the user and ensure a secure transaction experience.
Integrating a renowned payment gateway like PayUMoney can keep your business functions streamlined. Apart from PayUMoney, you can also integrate PayPal in iOS and Android app for delivering secure payments.