-
Notifications
You must be signed in to change notification settings - Fork 21
Home
The documentation below is applicable for version 2.0.2. For integrating latest version on PayUmoney or PnP, please contact [email protected]
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 = @"";
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.
self.params.environment = PUMEnvironmentTest;
Send the SURL/FURL, MerchantId and key accordingly for test and live mode.
Apple has started complaining if app contains simulator architectures during distribution. There is a quick fix to this issue. Be careful though as after doing following steps, you will not be able to run app on simulator. Do it just before deploying the app on Testflight/App-store
Go inside the PayUmoney_SDK.framework folder of your project from terminal.
Run following commands:
lipo -remove i386 PayUmoney_SDK -o PayUmoney_SDK
lipo -remove x86_64 PayUmoney_SDK -o PayUmoney_SDK
Now the binary is thinned
We know the solution is not very elegant. We are making a script which should automate this process for merchants.