Integrate PayU Money Payment Gateway in iOS Swift 4

Posted By : Vasu Saini | 13-Dec-2017

PayU money is nowadays popular payment gateway for Indian currency but problem is that it is not available for swift and even payu not provide support for integration in swift, here we will know how to integrate it in swift 4.

Here are steps to integrate
in application:

Step 1. Open/Create project in which you want to integrate payu

Step 2. Install following pod in  it
               pod 'PayUmoney_PnP'

Step 3.Create a  account on payumoney sandbox for testing from url given below
          
https://test.payumoney.com/

Step 4.Create a  account on payumoney production  from url given below
          
https://www.payumoney.com/

Step 5Register yourself and follow steps given there to get MerchantId,key and salt respectively.

Step 6. Now Downlpad zip from given link below, extract it and add PayUServiceHelper folder to your project
            https://s3.amazonaws.com/oodles-blogs/blog-images/28a8c465-a633-46ea-ade3-c881ca3980ec.zip

Step 7. Now Add PayUServiceHelper.h to your bridging header 

Step 8. Here are some changes you have to done in PayUServiceHelper.m

#pragma mark Sandbox Crenditials
    txnParam.environment = PUMEnvironmentTest;
    txnParam.key = @"";
    txnParam.merchantid = @"";
    self.payu_salt = @"";

#pragma mark Production Crenditials
//    txnParam.environment = PUMEnvironmentProduction;
//    txnParam.key = @"";
//    txnParam.merchantid = @"";
//    self.payu_salt = @"";

Step 9. In above mentioned code add all your sandbox and production crenditials

Step 10. If you are using for testing or staging comment you production credintials and open sandbox credintials and vice versa.

Step 11. You can also change here fileds such like merchantdisplay name, product info etc.

Step 12. Now open controller class in which you want payment process and on buttonAction call the function getPayment of the PayUServiceHelper.m as follows

 PayUServiceHelper.sharedManager().getPayment("Controller", "[email protected]", "+91-9896952757", "Name", "Amount 0011", didComplete: { (dict, error) in
 if let error = error {
     print("Error")
 }else {    
  print("Sucess")
 }
 }) { (error) in
    print("Payment Process Breaked")
 }

Step 13. Pass all params in the method as required, and your payment process will start and will give you callback of sucess or failure.

Step 14. All done

 

About Author

Author Image
Vasu Saini

Vasu Saini is Passionate to deploy ideas into real world, Have zeal to learn new technologies. working as iOS Developer in Oodles Technologies. Sports Freak, Calisthenics ,Parkour, Love to play football, swimmer, athletics etc

Request for Proposal

Name is required

Comment is required

Sending message..