iOS SDK (Seamless)

Using your UI

1. Initial Setup

  • To integrate with iOS SDK, download sdk version 3.0 from github by clicking here

  • Drag and drop the extracted content (two items - a folder and a static lib) into your project

  • To import our SDK just import PayU_iOS_CoreSDK.h file as below

    #import "PayU_iOS_CoreSDK.h
  • Get all the required parameters

  • Create an object of PayUModelPaymentParams and set all the parameter in it

    @property (strong, nonatomic) PayUModelPaymentParams *paymentParamForPassing;
    self.paymentParamForPassing = [PayUModelPaymentParams new];
    self.paymentParamForPassing.key = @"0MQaQP";
    self.paymentParamForPassing.transactionID = @"Ywism0Q9XC88qvy";
    self.paymentParamForPassing.amount = @"10.0";
    self.paymentParamForPassing.productInfo = @"Nokia";
    self.paymentParamForPassing.firstName = @"Ram";
    self.paymentParamForPassing.email = @"email@testsdk1.com";
    self.paymentParamForPassing.userCredentials = @"ra:ra";
    self.paymentParamForPassing.phoneNumber = @"1111111111";
    self.paymentParamForPassing.SURL = @"httpss://payu.herokuapp.com/ios_success";
    self.paymentParamForPassing.FURL = @"httpss://payu.herokuapp.com/ios_failure";
    self.paymentParamForPassing.udf1 = @"u1";
    self.paymentParamForPassing.udf2 = @"u2";
    self.paymentParamForPassing.udf3 = @"u3";
    self.paymentParamForPassing.udf4 = @"u4";
    self.paymentParamForPassing.udf5 = @"u5";
    self.paymentParamForPassing.Environment = @"0";
    self.paymentParamForPassing.offerKey = @"offertest@1411";
  • 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

    self.paymentParamForPassing.userCredentials = @"ra:ra"
  • For offers you need to set offerKey

    self.paymentParamForPassing.offerKey = @"offertest@1411"
  • For any other payment default param (like phone and others)

    self.paymentParamForPassing.phoneNumber = @"1111111111";
  • Get the required hashes by using your own server. Set the hashes as below

    self.paymentParamForPassing.hashes.paymentHash = @"ade84bf6dd9da35d0aab50a5bf61d6272ab0fc488b361b65c66745054aacf1900e3c60b5022d2114bae7360174ebcb3cd7185a5d472e5c99701e5e7e1eccec34";
    self.paymentParamForPassing.hashes.paymentRelatedDetailsHash = @"915299224c80eff0eb2407b945a5087556292f58baca25fd05a0bceb6826aa9eb531810001dd4b4677dd928dd60d39eecf843b2189f213f9bb82c5a9483e3aac";
    self.paymentParamForPassing.hashes.VASForMobileSDKHash = @"5c0314c2781876f7e0a53676b0d08e1457dafe904d2d15d948626b57409538d51093eef4f15c792b1b9651be7b5659efdd45926e43a1145d68cea094687011ca";
    self.paymentParamForPassing.hashes.deleteUserCardHash = @"03e10e892005755f91061121036fb1b10f46202b4138d182f153c5de5c7fd44930ed94b32fac230e59bac1e4ca123aca3297e4b9d25024bf13237db9721fec1a";
    self.paymentParamForPassing.hashes.offerHash = @"1e99fdb59bd91c1a85624104c0fcfae34d7fcb850dd17a0b75e7efe49857d15fdefc47dd0d86ca34cbc3a8b580839aea6341a573e4e60dc1ddcf7ecc32bf9cae";
  • Environment can be set by

    0 is for Production and 1 is for MobileTest

    self.paymentParamForPassing.Environment = @"0";

2. Webservices

To call any of the below API you need to create an object of class PayUWebServiceResponse and call the respective methods, you will get the result in completion handler of the method. If there is any error in the parameters passed by merchant then it will give the error in errorMessage string else you will get the parsed object.

PayUWebServiceResponse *webServiceResponse = [PayUWebServiceResponse new];

2.1 . payment_related_details_for_mobile_sdk

This API is helpful in getting stored card and available Netbanking.

To integrate this API call the method getPayUPaymentRelatedDetailForMobileSDK as below

[webServiceResponse getPayUPaymentRelatedDetailForMobileSDK:self.paymentParamForPassing withCompletionBlock:^(PayUModelPaymentRelatedDetail *paymentRelatedDetails, NSString *errorMessage, id extraParam) {

if (errorMessage) {
    // Something went wrong errorMessage is having the Detail
}else{
    // It is good to go & paymentRelatedDetails  is having the full detail of it
}
}];

2.2 . VAS

This API is used to get the list of down NetBanking and down cardbin

To integrate this API call the method callVASForMobileSDKWithPaymentParam as below

[webServiceResponse callVASForMobileSDKWithPaymentParam:self.paymentParamForPassing];

Now to check whether the particular NetBanking is down or not just pass the bankCode or cardbin (first 6 digit of cardnumber) to it and in completionBlock you will get the response as below

[webServiceResponse getVASStatusForCardBinOrBankCode:@"AXIB" withCompletionBlock:^(id ResponseMessage, NSString *errorMessage, id extraParam) {
        if (errorMessage == nil) {
                if (ResponseMessage == nil) {
                    // It means given NetBanking code or cardnumber is not down i.e. it is in good to go condition
                }else{
                    NSString * responseMessage = [NSString new];
                    responseMessage = (NSString *) ResponseMessage;
                    // It means given NetBanking code or cardnumber is down and you can display the responseMessage if you want or you can customize it
                }
        }else{
            // Something went wrong errorMessage is having the Detail
        }
    }];

2.3 . Delete Store Card

This API is helpful in Deleting StoredCard.

To integrate this API call the method deleteStoredCard as below

[webServiceResponse deleteStoredCard:self.paymentParamForPassing withCompletionBlock:^(NSString *deleteStoredCardStatus, NSString *deleteStoredCardMessage, NSString *errorMessage, id extraParam) {
            if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
            }
            else{
        //It is good to go & deleteStoredCardMessage is having the full detail of it
            }
        }];

2.4 . Get Offer Status

This API is helpful in checking whether offer is available for given cardNumber or not and if available then it will return the discount amount.

To integrate this API call the method getOfferStatus as below

[webServiceResponse getOfferStatus:self.paymentParamForPassing withCompletionBlock:^(PayUModelOfferStatus *offerStatus, NSString *errorMessage, id extraParam) {
    if (errorMessage == nil) {
        //It is good to go & offerStatus.discount contains the discounted amount if there is any offer & offerStatus.msg contains the message why offer is not available
    }
    else{
        // Something went wrong errorMessage is having the Detail
    }
}];

3. URLRequest for Payment

To get request, create an object of class PayUCreateRequest as below

@property (nonatomic, strong) PayUCreateRequest *createRequest;

3.1 . For CCDC

To Pay using CCDC, we need to set CCDC parameter as below:

        self.paymentParamForPassing.cardNumber = @"5123456789012346";//cardNumber
        self.paymentParamForPassing.nameOnCard = @"name";//Name on card
        self.paymentParamForPassing.expYear = @"2018";//Expiry year
        self.paymentParamForPassing.expMonth = @"11";//ExpiryMonth
        self.paymentParamForPassing.CVV = @"123";//CVV
        self.paymentParamForPassing.saveStoreCard = @"1";//If you want to save card then pass 1 otherwise it will not save & make sure userCredentials are provided
        self.paymentParamForPassing.storeCardName = @"My TestCard";//storeCardName

After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below

        self.createRequest = [PayUCreateRequest new];
        [self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_CCDC withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
        if (error == nil) {
        //It is good to go state. You can use request parameter in webview to open Payment Page
        }
        else{
        //Something went wrong with Parameter, error contains the error Message string
        }
    }];

3.2 . For StoredCard

To Pay using StoredCard, we need to set StoredCard parameter as below:

    self.paymentParamForPassing.storedCard = [self.paymentRelatedDetail.storedCardArray objectAtIndex:index];
    self.paymentParamForPassing.CVV = @"123";//CVV

After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below

    self.createRequest = [PayUCreateRequest new];
    [self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_STOREDCARD withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
    if (error == nil) {
    //It is good to go state. You can use request parameter in webview to open Payment Page
    }
    else{
    //Something went wrong with Parameter, error contains the error Message string
    }
}];

3.3 . For NetBanking

To Pay using NetBanking, we need to set NetBanking parameter as below:

    self.paymentParamForPassing.bankCode = @"AXIB";//BankCode

After setting the above parameters, you can get the request by using createRequestWithPaymentParam method as below

    self.createRequest = [PayUCreateRequest new];
    [self.createRequest createRequestWithPaymentParam:self.paymentParamForPassing forPaymentType:PAYMENT_PG_NET_BANKING withCompletionBlock:^(NSMutableURLRequest *request, NSString *postParam, NSString *error) {
    if (error == nil) {
    //It is good to go state. You can use request parameter in webview to open Payment Page
    }
    else{
    //Something went wrong with Parameter, error contains the error Message string
    }
}];