Seamless
Using your UI
To download iOS SDK through cocoa-pod, please go here first.
To run our Sample app do the following:
  • Download latest SDK version and unzip it.
  • Now unzip Release-Universal, now drag and drop the content of unzipped file into Sample App

Initial Setup

  • To integrate with iOS SDK, download the latest SDK from here.
  • Drag and drop PayUBizCoreSDK.framework into your project
Import our SDK as below:
Objective-C/Swift
1
#import <PayUBizCoreKit/PayUBizCoreKit.h>
Copied!
While working with swift project add the above code in Bridging-Header.h file.
  • Get all the required parameters
Create an object of PayUModelPaymentParams and set all the parameter in it
Objective-C
Swift
1
@property (strong, nonatomic) PayUModelPaymentParams *paymentParamForPassing;
2
self.paymentParamForPassing = [PayUModelPaymentParams new];
3
self.paymentParamForPassing.key = @"0MQaQP";
4
self.paymentParamForPassing.transactionID = @"Ywism0Q9XC88qvy";
5
self.paymentParamForPassing.amount = @"10.0";
6
self.paymentParamForPassing.productInfo = @"Nokia";
7
self.paymentParamForPassing.firstName = @"Ram";
8
self.paymentParamForPassing.email = @"[email protected]";
9
self.paymentParamForPassing.userCredentials = @"ra:ra";
10
self.paymentParamForPassing.phoneNumber = @"1111111111";
11
self.paymentParamForPassing.SURL = @"https://payu.herokuapp.com/ios_success";
12
self.paymentParamForPassing.FURL = @"https://payu.herokuapp.com/ios_failure";
13
self.paymentParamForPassing.udf1 = @"u1";
14
self.paymentParamForPassing.udf2 = @"u2";
15
self.paymentParamForPassing.udf3 = @"u3";
16
self.paymentParamForPassing.udf4 = @"u4";
17
self.paymentParamForPassing.udf5 = @"u5";
18
self.paymentParamForPassing.environment= ENVIRONMENT_PRODUCTION;
19
self.paymentParamForPassing.offerKey = @"[email protected]";
Copied!
1
let paymentParamForPassing = PayUModelPaymentParams()
2
paymentParamForPassing.key = "0MQaQP"
3
paymentParamForPassing.transactionID = "Ywism0Q9XC88qvy"
4
paymentParamForPassing.amount = "10.0"
5
paymentParamForPassing.productInfo = "Nokia"
6
paymentParamForPassing.firstName = "Ram"
7
paymentParamForPassing.email = "[email protected]"
8
paymentParamForPassing.userCredentials = "ra:ra"
9
paymentParamForPassing.phoneNumber = "1111111111"
10
paymentParamForPassing.surl = "https://payu.herokuapp.com/ios_success"
11
paymentParamForPassing.furl = "https://payu.herokuapp.com/ios_failure"
12
paymentParamForPassing.udf1 = "u1"
13
paymentParamForPassing.udf2 = "u2"
14
paymentParamForPassing.udf3 = "u3"
15
paymentParamForPassing.udf4 = "u4"
16
paymentParamForPassing.udf5 = "u5"
17
paymentParamForPassing.environment = ENVIRONMENT_PRODUCTION
18
paymentParamForPassing.offerKey = "[email protected]"
Copied!
You don't need to set udf1-5 in case you are not using them email and firstname can be empty strings "" if you don't want to use them For store user card feature you need to set userCredentials
Objective-C
Swift
1
self.paymentParamForPassing.userCredentials = @"ra:ra"
Copied!
1
paymentParamForPassing.userCredentials = "ra:ra"
Copied!
For offers you need to set offerKey
Objective-C
Swift
1
self.paymentParamForPassing.offerKey = @"[email protected]"
Copied!
1
paymentParamForPassing.offerKey = "[email protected]"
Copied!
For any other payment default param (like phone and others)
Objective-C
Swift
1
self.paymentParamForPassing.phoneNumber = @"1111111111";
Copied!
1
paymentParamForPassing.phoneNumber = "1111111111"
Copied!
Get the required hashes by using your own server. Set the hashes as below
Objective-C
Swift
1
self.paymentParamForPassing.hashes.paymentHash = @"ade84bf6dd9da35d0aab50a5bf61d6272ab0fc488b361b65c66745054aacf1900e3c60b5022d2114bae7360174ebcb3cd7185a5d472e5c99701e5e7e1eccec34";
2
self.paymentParamForPassing.hashes.paymentRelatedDetailsHash = @"915299224c80eff0eb2407b945a5087556292f58baca25fd05a0bceb6826aa9eb531810001dd4b4677dd928dd60d39eecf843b2189f213f9bb82c5a9483e3aac";
3
self.paymentParamForPassing.hashes.VASForMobileSDKHash = @"5c0314c2781876f7e0a53676b0d08e1457dafe904d2d15d948626b57409538d51093eef4f15c792b1b9651be7b5659efdd45926e43a1145d68cea094687011ca";
4
self.paymentParamForPassing.hashes.deleteUserCardHash = @"03e10e892005755f91061121036fb1b10f46202b4138d182f153c5de5c7fd44930ed94b32fac230e59bac1e4ca123aca3297e4b9d25024bf13237db9721fec1a";
5
self.paymentParamForPassing.hashes.offerHash = @"1e99fdb59bd91c1a85624104c0fcfae34d7fcb850dd17a0b75e7efe49857d15fdefc47dd0d86ca34cbc3a8b580839aea6341a573e4e60dc1ddcf7ecc32bf9cae";
Copied!
1
paymentParamForPassing.hashes.paymentHash = "ade84bf6dd9da35d0aab50a5bf61d6272ab0fc488b361b65c66745054aacf1900e3c60b5022d2114bae7360174ebcb3cd7185a5d472e5c99701e5e7e1eccec34"
2
paymentParamForPassing.hashes.paymentRelatedDetailsHash = "915299224c80eff0eb2407b945a5087556292f58baca25fd05a0bceb6826aa9eb531810001dd4b4677dd928dd60d39eecf843b2189f213f9bb82c5a9483e3aac"
3
paymentParamForPassing.hashes.vasForMobileSDKHash = "5c0314c2781876f7e0a53676b0d08e1457dafe904d2d15d948626b57409538d51093eef4f15c792b1b9651be7b5659efdd45926e43a1145d68cea094687011ca"
4
paymentParamForPassing.hashes.deleteUserCardHash = "03e10e892005755f91061121036fb1b10f46202b4138d182f153c5de5c7fd44930ed94b32fac230e59bac1e4ca123aca3297e4b9d25024bf13237db9721fec1a"
5
paymentParamForPassing.hashes.offerHash = "1e99fdb59bd91c1a85624104c0fcfae34d7fcb850dd17a0b75e7efe49857d15fdefc47dd0d86ca34cbc3a8b580839aea6341a573e4e60dc1ddcf7ecc32bf9cae"
Copied!

Generating URLRequest (and post parameters) for Payment

To get request, create an object of class PayUCreateRequest as below. The callbacks give your URLRequest as well as post parameters (NSString format). You can use these post parameters to initialize Custom Browser Instance.
Objective-C
Swift
1
@property (nonatomic, strong) PayUCreateRequest *createRequest;
Copied!
1
let createRequest = PayUCreateRequest()
Copied!

CC/DC

To Pay using CCDC, we need to set CCDC parameter as below:
Objective-C
Swift
1
self.paymentParamForPassing.cardNumber = @"5123456789012346";//cardNumber
2
self.paymentParamForPassing.nameOnCard = @"name";//Name on card
3
self.paymentParamForPassing.expYear = @"2018";//Expiry year
4
self.paymentParamForPassing.expMonth = @"11";//ExpiryMonth
5
self.paymentParamForPassing.CVV = @"123";//CVV
6
self.paymentParamForPassing.storeCardName = @"My TestCard";//If you want to save card then pass StoreCardName otherwise it will not save & make sure userCredentials are provided
Copied!
1
paymentParamForPassing.cardNumber = "5123456789012346" //cardNumber
2
paymentParamForPassing.nameOnCard = "name" //Name on card
3
paymentParamForPassing.expYear = "2018" //Expiry year
4
paymentParamForPassing.expMonth = "11" //ExpiryMonth
5
paymentParamForPassing.cvv = "123" //CVV
6
paymentParamForPassing.storeCardName = "My TestCard" //If you want to save card then pass StoreCardName otherwise it will not save & make sure userCredentials are provided
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_CCDC withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
}
9
}];
Copied!
1
createRequest().createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_CCDC, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

StoredCard

To Pay using StoredCard, we need to set StoredCard parameter as below:
Objective-C
Swift
1
PayUModelStoredCard *modelStoredCard = [self.paymentRelatedDetail.storedCardArray objectAtIndex:indexPath.row];
2
3
self.paymentParamForPassing.cardToken = modelStoredCard.cardToken;
4
self.paymentParamForPassing.cardBin = modelStoredCard.cardBin;
5
self.paymentParamForPassing.CVV = @"123";//CVV
Copied!
1
let modelStoredCard = paymentRelatedDetail.storedCardArray[indexPath.row] as? PayUModelStoredCard
2
3
paymentParamForPassing.cardToken = modelStoredCard?.cardToken
4
paymentParamForPassing.cardBin = modelStoredCard?.cardBin
5
paymentParamForPassing.cvv = "123" //CVV
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_STOREDCARD withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
}
9
}];
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_STOREDCARD, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

NetBanking

To Pay using NetBanking, we need to set NetBanking parameter as below:
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = @"AXIB";//BankCode
Copied!
1
paymentParamForPassing.bankCode = "AXIB" //BankCode
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_NET_BANKING withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
}
9
}];
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_NET_BANKING, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

CashCard

To Pay using CashCard, we need to set cashcard parameter as below:
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = @"AXIB";//BankCode
Copied!
1
paymentParamForPassing.bankCode = "AXIB" //BankCode
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing
3
forPaymentType:PAYMENT_PG_CASHCARD withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
4
if (error == nil) {
5
//It is good to go state. You can use request parameter in webview to open Payment Page
6
}
7
else{
8
//Something went wrong with Parameter, error contains the error Message string
9
}
10
}];
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_CASHCARD, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

EMI

To Pay using EMI, you need to set EMI parameter as below:
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = @"EMI03";//BankCode
2
self.paymentParamForPassing.expiryYear = @"2019";
3
self.paymentParamForPassing.expiryMonth = @"12";
4
self.paymentParamForPassing.nameOnCard = @"test";
5
self.paymentParamForPassing.cardNumber = @"5123456789012346";
6
self.paymentParamForPassing.CVV = @"123";
Copied!
1
paymentParamForPassing.bankCode = "EMI03" //BankCode
2
paymentParamForPassing.expiryYear = "2019"
3
paymentParamForPassing.expiryMonth = "12"
4
paymentParamForPassing.nameOnCard = "test"
5
paymentParamForPassing.cardNumber = "5123456789012346"
6
paymentParamForPassing.cvv = "123"
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_EMI withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
9
}
10
}];
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_EMI, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!
Cardless EMI
To Pay using Cardless EMI, you need to set parameter as below:
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = @"ZESTMON";//BankID
2
self.paymentParamForPassing.isCardlessEMI = true;
3
self.paymentParamForPassing.phoneNumber = @"9999999999";
4
Copied!
1
paymentParamForPassing.bankCode = "ZESTMON" //BankID
2
paymentParamForPassing.isCardlessEMI = true
3
paymentParamForPassing.phoneNumber = "99999999"
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam

PayUMoney

To Pay using PayUMoney, we need to set only the mandatory payment param and we can get the request by using createRequestWithPaymentParam method as below:
Objective-C
Swift
1
PayUCreateRequest *createRequest = [PayUCreateRequest new];
2
[createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_PAYU_MONEY withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
9
}
10
}];
Copied!
1
createRequest.init(paymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_PAYU_MONEY, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

Subvention EMI

Pay via Subvention EMI

To Pay using Subvention EMI, we need to set subventionAmount parameter of paymentParams
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = @"EMI03";//BankCode
2
self.paymentParamForPassing.expiryYear = @"2019";
3
self.paymentParamForPassing.expiryMonth = @"12";
4
self.paymentParamForPassing.nameOnCard = @"test";
5
self.paymentParamForPassing.cardNumber = @"5123456789012346";
6
self.paymentParamForPassing.CVV = @"123";
7
8
self.paymentParamForPassing.subventionAmount = @"3000";
Copied!
1
paymentParamForPassing.bankCode = "EMI03" //BankCode
2
paymentParamForPassing.expiryYear = "2019"
3
paymentParamForPassing.expiryMonth = "12"
4
paymentParamForPassing.nameOnCard = "test"
5
paymentParamForPassing.cardNumber = "5123456789012346"
6
paymentParamForPassing.cvv = "123"
7
8
paymentParamForPassing.subventionAmount = "3000"
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below:
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_EMI withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
3
if (error == nil) {
4
//It is good to go state. You can use request parameter in webview to open Payment Page
5
}
6
else{
7
//Something went wrong with Parameter, error contains the error Message string
8
}
9
}];
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_EMI, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go state. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

Hash Calculation

If subventionAmount is passed than hash formula for payment hash will be
1
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT|SubventionAmount)
Copied!
Otherwise it will remain same as earlier.

Fetch List

To get list of No Cost EMI supporting banks, pass subventionEligibility as "all" in Fetch Payment Option WebService.

LazyPay

To Pay using LazyPay, we need to set the below parameters :
Notify Url – Callback URL of merchant where a notification of transaction status will be sent on completion of transaction. It should be HTTPS.
Objective-C
Swift
1
self.paymentParamForPassing.notifyURL= @"https://notifyURL.com";
Copied!
1
paymentParamForPassing.notifyURL = "https://notifyURL.com"
Copied!
After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below
Objective-C
Swift
1
self.createRequest = [PayUCreateRequest new];
2
3
[self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_LAZYPAY withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
4
if (error == nil) {
5
//It is good to go. You can use request parameter in webview to open Payment Page
6
}
7
else{
8
//Something went wrong with Parameter, error contains the error Message string
9
}
10
}];
11
Copied!
1
createRequest.createRequest(withPaymentParam: paymentParamForPassing, forPaymentType: PAYMENT_PG_LAZYPAY, withCompletionBlock: { request, postParam, error in
2
if error == nil {
3
//It is good to go. You can use request parameter in webview to open Payment Page
4
} else {
5
//Something went wrong with Parameter, error contains the error Message string
6
}
7
})
Copied!

TwidPay

To Pay using TwidPay, create the post data with CASH_CARD_TWID :
Objective-C
Swift
1
self.paymentParamForPassing.bankCode = CASH_CARD_TWID;//BankCode
Copied!
1
paymentParamForPassing.bankCode = CASH_CARD_TWID //BankCode
Copied!
After a successful payment, you would get the Twid customer hash in the field5 param of PayuResponse, which can be used in next transactions to skip authentication.
Objective-C
Swift
1
self.paymentParamForPassing.twidCustomerHash = @"Twid customer hash";
2
Copied!
1
self.paymentParamForPassing.twidCustomerHash = "Twid customer hash"
Copied!
Last modified 2mo ago