Friday, 24 July 2015

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


55 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. Thanks for sharing information.
    recharge plans
    Videocon Telecom comes up with LOWEST & UNMATCHED TARIFF in Haryana; Offers ALL LOCAL CALLS at only 25P/min.

    ReplyDelete
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. Replies
    1. Sorry but i haven't worked much on Swift. You have to do it on your own.

      Delete




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

    Google App Integration Chennai

    ReplyDelete
  17. 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
  18. hi i am new in payumoney intigration in ios. my question is how can i get responce data after the transaction is successfull ?

    ReplyDelete
  19. possible in swift pls give me demo

    ReplyDelete
  20. 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
  21. 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
  22. hey suraj can you help me out with the payumoney ios sdk integeration

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

    ReplyDelete
  24. 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
  25. Good article, and of course good payment gateway in india but I used Instamojo

    ReplyDelete
  26. 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
  27. This comment has been removed by the author.

    ReplyDelete
  28. 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
  29. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..

    Mobile App Development Company in Chennai
    Android app Development Company in Chennai
    ios app development Company in Chennai

    ReplyDelete
  30. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving.. very specific nice content. And tell people specific ways to live their lives.Sometimes you just have to yell at people and give them a good shake to get your point across.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  31. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  32. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    Mobile App Development Company
    Mobile App Development Companies

    ReplyDelete

  33. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

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

    ReplyDelete
  35. Hello Dear sir

    I like your blog very well, I want to say thank you for giving so good information.
    I have a website duspay.com. We provide payment gateway
    Payment Gateway | Duspay

    ReplyDelete
  36. payumoney when integrated with swift  always giving error

    ReplyDelete
  37. 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
  38. hi i am new in payumoney intigration in ios. my question is how can i get responce data after the transaction is successfull ?

    ReplyDelete
  39. Thank you for sharing this helpful information. We are Payment gateway and Credit Card Processing service provider in Europe and worldwide.

    ReplyDelete