PayUmoney Payment Gateway Integration Android Tutorial
Step By Step Process
- Create Account & Get merchant key & salt key
- Upload server side PHP files for checksum HASH
- Add dependency in android gradle file
- Get checksum hash using retrofit
- Start PayUmoney payment transactions
Add dependency in Android gradle file
Open android studio project gradle file and add these lines. Also you need to use Retrofit library to get security hash from server. NOTE: you can use Volley library or AsyncTask in place of Retrofit.
Retrofit is best for client server communication that’s why I used only retrofit on all android projects. If you don’t know how to use retrofit library,
So the complete gradle file will be
Create two edit text on activity_main.xml file so you can add phone number and amount at run time.
activity.xml
MainActivity.java file get phone number and amount from edit text and pass as intent parameter to next activity.
Get checksum hash using Retrofit
Now Create payumoney builder variable and initialize it with value like below. You need to hit the URL of PHP files that you have uploaded on your server. I am using Retrofit Library but you can use volley or AsyncTask. On successful Response you will get security hash from server.
payumoneybuilder variable:-
Start PayUmoney payment transactions
Once you get the security checksum hash from server, set it on builder as merchantHash(). its time to start payumooney payment transaction using
From there onward PayUmoney SDK and plug-n-play SDK will take care of every thing. You will get the status response as “Success” OR “Failure”. Below is the sample response when your transaction get successful.
Complete code
Run the Code
Run this code in real device or in emulator. You test payment transaction you need test cart details. Test cart details is already given in Merchant Dashboard. Here I am also giving test cart details. Following screen you will see on your phone.
Cart number – 5123456789012346 expiry – 05/20 CVV – 123