Skip to content
AshishPayU edited this page Jan 20, 2017 · 11 revisions

Technical Integration

Drag and drop the ‘PayUmoney_SDK.framework’ into your project

In your target’s general settings, make sure you have entry ‘PayUmoney_SDK.framework’ in Embedded Binaries and ‘Linked Frameworks and Libraries’ Import umbrella header file into the View Controller from where you to initiate the payment

    #import <PayUmoney_SDK/PayUmoney_SDK.h>

Please identify your checkout View Controller and add below property

    @property(nonatomic,strong) PUMRequestParams * params;

To start the payment process, you need to create an object of type ‘PUMRequestParams’

    self.params = [PUMRequestParams sharedParams];

Set the mandatory properties of ‘params’ object

    self.params.environment = PUMEnvironmentProduction;
    self.params.surl = @“https://www.payumoney.com/mobileapp/payumoney/success.php”
    self.params.furl = @“https://www.payumoney.com/mobileapp/payumoney/failure.php”
    self.params.amount = @"100";
    self.params.key = @"pass your own key here";
    self.params.merchantid = @"pass your unique id here";
    self.params.txnid =@"pass random transaction id each time";
    self.params.delegate = self;

Set below params as per your requirement

    self.params.firstname = @"Ashish";
    self.params.productinfo = @"iPhone";
    self.params.email = @"[email protected]";
    self.params.phone = @"9876543210";
    self.params.udf1 = @"";
    self.params.udf2 = @"";
    self.params.udf3 = @"";
    self.params.udf4 = @"";
    self.params.udf5 = @"";
    self.params.udf6 = @"";
    self.params.udf7 = @"";
    self.params.udf8 = @"";
    self.params.udf9 = @"";
    self.params.udf10 = @"";

get hash from your server self.params.hashValue = @“hash from server”; HASH CALCULATION

    hashSequence = key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt.

Calculate the hash at your server side by using the above format of hash sequence. Encrypt it in SHA-512 and pass in params.hash.

Please Note – udf1 to udf5 are user-defined fields. These are meant to send any additional valuesthat you need to post. However, if you don’t feel the need to post any additional params, even then you will need post these params with blank values. Create a view controller of type PUMMainVController Create a UINavigationController with controller created in step 7 as root view controller Present the navigation controller created in step 8.

    PUMMainVController *paymentVC = [[PUMMainVController alloc] init];
    UINavigationController *paymentNavController = [[UINavigationController alloc]         initWithRootViewController:paymentVC];    

    [self presentViewController:paymentNavController
    animated:YES
    completion:nil];

PAYMENT COMPLETION

To know when the payment has completed, implement the following methods in your controller and get success/failure response:

    -(void)transactionCompletedWithResponse:(NSDictionary*)response
    errorDescription:(NSError* )error {    
    }
    -(void)transactinFailedWithResponse:(NSDictionary* )response
    errorDescription:(NSError* )error {
    }
    -(void)transactinExpiredWithResponse: (NSString *)msg {
    }
    -(void)transactinCanceledByUser {    
    }

USING SDK IN TEST MODE

For using SDK in test mode you need to follow the below mentioned steps.

    params.test = PUMEnvironmentTest

Send the SURL/FURL, MerchantId and key accordingly for test and live mode.

Clone this wiki locally