payUmoney Payment Gateway Integration in iOS App (Objective C)



We have many Payment Gateways available such as Paypal, CCAvenue, Zaakpay, etc.

payUmoney is the best Payment Gateway available in India now; according to me.
I am saying this with my personal experience with payUmoney Technical Support Team.

They offer 2.9% Transaction charges without any Enrolment, Setup, AMC or other Hidden charges.

payUmoney Home Page Link: Home_Page

payUmoney Contact Details:
 Address: 
 5th Floor, Pearl Towers Plot 51, Sector 32 Gurgaon, 122002

 Phone: 
 0124-6624956,
 0124-6624970

 Email: 
 techsupport@payumoney.com


Steps to integrate payUmoney gateway:

1. Create a new iOS Objective C app in XCode.
2. Open Main.storyboard in you app.
3. Add UIWebView and set its Delegate. [Screenshot 1]
4. Set Frames & Constraints as per design requirements.
5. Link UIWebView by creating IBOutlet to either .h or .m file. [Screenshot 2]
6. Signup and create an account on payUmoney. Test Envirnment: http://test.payumoney.com/ or Production Environment: https://www.payumoney.com/
7. Follow below mentioned procedure to complete the registration process:

  
 Test Environment:

 Recently, payUmoney has done some modifications in test environment due to which test key-JBZaLc and salt-GQs7yium will not work anymore.

 In order to test the gateway using a test key and salt, kindly follow these steps:

     1 - Go on http://test.payumoney.com/
     2 - Sign up as a merchant - use any of your valid email ids - kindly do not use a random email id.
     3 - Use a valid Mobile Number and for Phone/Landline No use your valid mobile number with a preceeding 0. (e.g. Mobile No: 9762159571 so the Landline No: 09762159571)
     4 - Complete the "Business Details"  - you may use PAN no. ABCDE1234F and DOB - 01/04/1990
     5 - Complete "Bank Account Details" (You may use IFSC- ALLA0212632)
     6 - Please leave the bank verification part.
     7 - Go to below mentioned location to get the Test Merchant Id :
          Seller Dashboard -> Settings -> My account -> Profile Settings

 Once you provide your test merchant id, payUmoney will approve it so that you can find your test key and salt at :
 Seller Dashboard -> Settings -> My account -> Merchant Key - Salt


 Production Environment:

 kindly register to https://www.payumoney.com/ and follow above steps with all your Genuine Bank details, contact numbers & adresses.
 Please note that the Key and Salt for Production server are different from the one we get from Test server.



8. payUmoney requires some mandatory fields to make a web-call:
    txnidkey, amount, productinfo, firstname, email, phone, surl, furl, hash, service_provider.
9. We have to create a Transaction ID which must be unique SHA512 encrypted value.
10. Take all values from user except txnid, key, surl, furl,  hash & service_provider.
11. Create a NSString by appending all the values in sequence as below:
NSString *hashValue = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|||||||||||%@",key,txnid1,amount,productInfo,firstname,email,Salt];
12. Use SHA512 encryption to hash the hashValue.
13. Create a NSDictionary of with all the values we have.
14. Make a POST type NSMutableURLRequest and pass the required parameters.
15. Load the NSMutableURLRequest to WebView and we are done.





















Download code from Github Repo: Code


Special Thanks to:
Stackoverflow_Link
payUmoney_Link


Comments

  1. Thank you so much for sharing this post with us. Can your provide more information about other mobile payment gateway service providers in India. What are their services and fee structure???

    ReplyDelete
    Replies
    1. Here you can find some information regarding other payment gateways:
      http://techwelkin.com/best-payment-gateways-india-no-setup-fee
      http://www.nextbigwhat.com/comparison-payment-gateways-in-india-2014-edition-297/
      http://www.raywenderlich.com/87300/apple-pay-tutorial

      Delete
  2. hi presently
    https://test.payu.in/ is not working it is throwing this error
    Page Not Found! Please check the url.
    Error: 404.
    how can i check this

    ReplyDelete
    Replies
    1. Can you check whether you have missed any step or using any wrong url, merchant id, etc.

      Delete

  3. nice blogs.
    Friend chatMake new friend’s without revealing yourself. Dial 543216 at Rs 2/min and monthly subscription of Rs 30/ 30 days.

    ReplyDelete
  4. We have design bitcoin payment gateway integration for merchants who intend to integrate payment system in their project and receive payment through bitcoins. The main objective is to handle transactions. If you need any help visit us at: http://www.cryptextechnologies.com/

    ReplyDelete
  5. Is there any way to integrate this sdk into swift project?

    ReplyDelete
    Replies
    1. We can integrate Objective C code in a Swift Project and vice-versa.

      Below are few links to achieve the same:
      https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
      http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift
      http://www.theappguruz.com/blog/integrate-objective-c-file-swift

      Delete
  6. nice blog...

    I want to know, user sign in to his payU money account for payment once... If he wants to make another payment, is it compulsory to login again..?
    can we track this to do only once?

    ReplyDelete
    Replies
    1. For this you need to talk to the payumoney technical team. Cause signing in each time is meant for the Security purpose of the user's account, which authenticates each time and allows you to make the payments once authorized.

      Delete
  7. hey thanks for the code. In my app if payment is successfull then only order details goes to api. so pls tell me where i can write code to send data. i mean in which method.

    ReplyDelete
    Replies
    1. In webViewDidFinishLoad method we can check whether we are getting success or failure by evaluating the requestURL. In case of success do the action to make api call to order details.

      Delete
  8. hey can you provide me your contact details please....

    ReplyDelete
    Replies
    1. You can mail me on: surajmirajkar@yahoo.com/mirajkarsuraj@gmail.com

      Delete
  9. i have applied same code with my merchant id and salt which i got from seller dashboard but still i get error https://test.payu.in/_payment .. please let me know what can i do !!!

    ReplyDelete
    Replies
    1. As the error message suggest you are missing a mandatory parameter, can you cross check the parameters you are sending.

      Delete
  10. Hi I am using the same code,but when I am trying to do payment with random mail ids, it always says user already exists.

    ReplyDelete
    Replies
    1. This surely means you have already used those mail id's for Transaction.

      Delete
  11. When i using this base url "https://www.payumoney.com/" then it's open the site of payumoney.What can i do for using production enviroment and then i want to store it on app store.Please help.

    ReplyDelete
    Replies
    1. use "https://secure.payu.in" for production. Make sure the complete url would be "https://secure.payu.in/_payment".
      Make sure the merchant key and salt are valid by checking the pay u client dashboard. This will definitely work.

      Delete
  12. hello sir i am having card no,cvc no,expiray date and card holder name then how i can accept payment in my app.

    ReplyDelete
    Replies
    1. You must go through the Post and it will help you understand accepting payment in your app.

      Delete
    2. This comment has been removed by the author.

      Delete
  13. Can you plz post your code in swift as i am not able to change it in swift

    ReplyDelete
    Replies
    1. Sorry but i haven't worked much on Swift. You have to do it on your own.

      Delete
  14. Ya i want to swift code

    ReplyDelete
    Replies
    1. Sorry but i haven't worked much on Swift. You have to do it on your own.

      Delete




  15. Excellent blogs!!!!you have for sharing them effect information..we developer very learning to easy

    Google App Integration Chennai

    ReplyDelete
  16. Hi.... Thanks for the great tutorial. I have integrated PayU successfully into my app using swift. But when I am going to delete the stored card the app is crashing because cardCVV and isExpired parameter I am getting in as int32 data type but these two parameter has been defined as string in sdk. I convert these two parameters in string and request for deleteStoredCard method still no luck. can you please look into this?

    ReplyDelete
  17. hi i am new in payumoney intigration in ios. my question is how can i get responce data after the transaction is successfull ?

    ReplyDelete
  18. possible in swift pls give me demo

    ReplyDelete
  19. Hi, i m working on CCAvenue in swift can u help me....

    ReplyDelete
    Replies
    1. CCAvenue has provided their own Framework, you can integrate it and use it.

      Delete
  20. sir test.payment.in is working but live www.secure.payu.in not working i want to do payment process for columbia city please suggest me

    ReplyDelete
  21. hey suraj can you help me out with the payumoney ios sdk integeration

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Hello,
    please run your code. I am getting blank screen in webview. response url is "https://test.payumoney.com/payments/#/user/53A9BDD2278FD8BB56EEA8D576D653C8"
    what does this mean..

    ReplyDelete
  24. Good article, and of course good payment gateway in india but I used Instamojo

    ReplyDelete
  25. hello sir,

    i want to use this payment gateway in my project so can you give me these functions in swift?

    Thanking you
    Regards
    Nitesh

    ReplyDelete
    Replies
    1. Hai Nitish u got any solution for pay u money in swift???

      Delete
  26. This comment has been removed by the author.

    ReplyDelete
  27. hello, can you please give me the solution when payment is pay successfully then how to redirect in our app?? i'm couldn't find PAY BUTTON delegate.

    ReplyDelete
  28. Help to get the PayUMoney Customer Care as I wants to confirm about Payumoney Points and where to buy them.

    ReplyDelete
  29. payumoney when integrated with swift  always giving error

    ReplyDelete
  30. It is very easy thank you. But I have some doubt... In above procedure where you are using pay u money sdk? Can u please explain the flow. I am new to iOS

    ReplyDelete
  31. hi i am new in payumoney intigration in ios. my question is how can i get responce data after the transaction is successfull ?

    ReplyDelete
  32. This comment has been removed by the author.

    ReplyDelete
  33. can u send me the demo of pay u money in swift 3 language

    ReplyDelete
  34. This blog gives very important info about iOS Thanks for sharing
    iOS Online Course Bangalore

    ReplyDelete
  35. If you are ready to accept payments through credit cards for your online services or products bought by your customers, you need to have a payment gateway. If you are looking for Payment Gateway in Qatar, you should check out PaymentsMe.

    ReplyDelete
  36. Thanks for sharing this...the Indian e-commerce field is an important part of the world's commercial field. Leading payment gateways are renowned for giving the best payment gateway in India with advanced and secure services.

    ReplyDelete

Post a Comment

Popular posts from this blog

UITableView - Add or Remove Rows Dynamically (Objective C & Swift Source codes)

Check Internet Connectivity Using AFNetworking 2.0