Web Services

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];

1 Fetch Payment Option

This API will give payment option enabled for merchant and saved card.

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
}
}];

Note:

  1. paymentRelatedDetails.availablePaymentOptionsArray gives you all the available payment options for you.

  2. paymentRelatedDetails.oneTapStoredCardArray, paymentRelatedDetails.storedCardArray, paymentRelatedDetails.netBankingArray, paymentRelatedDetails.cashCardArray, paymentRelatedDetails.EMIArray, paymentRelatedDetails.NoCostEMIArray gives available OneTapCard,StoredCard, NetBanking, CashCard, EMI and NoCostEMI

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
    	}
	}];

3 Delete Store Card (Deprecated):

Use Delete Tokenised StoredCards

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
            }
        }];

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
    }
}];

5 CheckOfferDetails:

This API is helpful in getting details of offerkey, whether the given offer key is valid or not. If we provide the amount to this API then this API gives the discount value also. We can use this API for payment mode such as CC/DC, StoreCard, OneTap Card and NetBanking To integrate this API call the method getOfferDetails

5.1 For CCDC:

Set the cardnumber in paymentParamForPassing object as below:

self.paymentParamForPassing.cardNumber = @”5123456789012346”;
self.paymentParamForPassing.hashes.offerDetailsHash = @"hash";

After setting cardNumber call the method getOfferDetails by passing second parameter as PAYMENT_PG_CCDC as below:

[webServiceResponse
getOfferDetails:self.paymentParamForPassing forPaymentType:PAYMENT_PG_CCDC withCompletionBlock:^(PayUModelOfferDetails *offerDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // offerDetails object is having the detail of the offer key
      }
    }];

5.2 For StoredCard/OneTapCard:

If merchant want to check offer for one particular storedcard then set the cardtoken as below:

self.paymentParamForPassing.cardToken = @”643567vbhbvgh5678gvv77b”;
self.paymentParamForPassing.hashes.offerDetailsHash = @"hash";

If merchant want to check offer for all storedcard then set cardToken as empty or nil:

    self.paymentParamForPassing.cardToken = nil;
    self.paymentParamForPassing.hashes.offerDetailsHash = @"hash";

Note: For StoredCard/OneTapCard, you must set userCredentials inside your payment params After setting cardToken call the method getOfferDetails by passing second parameter as PAYMENT_PG_STOREDCARD as below:

[webServiceResponse
getOfferDetails:self.paymentParamForPassing forPaymentType:PAYMENT_PG_STOREDCARD withCompletionBlock:^(PayUModelOfferDetails *offerDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // offerDetails object is having the detail of the offer key
      }
    }];    

5.3 For NetBanking:

In case merchants want to know whether any particular Net Banking is eligible for offer then set the bankcode as below:

    self.paymentParamForPassing.bankCode = @”AXIB”;
    self.paymentParamForPassing.hashes.offerDetailsHash = @"hash";

In case Merchant wants to know the list of net bankings which are eligible for any particular Offer then set bankCode as nil or empty as below:

    self.paymentParamForPassing.bankCode = nil;
    self.paymentParamForPassing.hashes.offerDetailsHash = @"hash";

After setting bankcode call the method getOfferDetails by passing second parameter as PAYMENT_PG_NET_BANKING as below:

[webServiceResponse
getOfferDetails:self.paymentParamForPassing forPaymentType:PAYMENT_PG_NET_BANKING withCompletionBlock:^(PayUModelOfferDetails *offerDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // offerDetails object is having the detail of the offer key
      }
    }];

6 GetEMIAmountAccordingToInterest:

This API is helpful in getting details of all the available EMI’s. For this API, you need to set amount in the payment params as below:

    self.paymentParamForPassing.amount = @"100";
    self.paymentParamForPassing.hashes.EMIDetailsHash = @"hash";

To integrate this API call the method getEMIAmountAccordingToInterest as below

[webServiceResponse
getEMIAmountAccordingToInterest:self.paymentParamForPassing withCompletionBlock:^(NSDictionary *dictEMIDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // dictEMIDetails is having the EMI detail
      }
    }];

7 Get User Cards (Deprecated):

Use Get Tokenised StoredCards

This API is helpful in getting all the Stored Card for particular user. For this API, you need to set userCredentials in the payment params as below:

    self.paymentParamForPassing.userCredentials = @"gtKFFx:UmangArya";
    self.paymentParamForPassing.hashes.getUserCardHash = @"hash";

To integrate this API call the method getUserCards as below

[webServiceResponse
getUserCards:self.paymentParamForPassing withCompletionBlock:^(NSDictionary *dictStoredCard, NSString *errorMessage, id extraParam){
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // dictStoredCard is having all the storedcard information
      }
    }];

8 Verify Payment:

This web-service is used to reconcile the transaction with PayU. When we post back the final response to you (merchant), we provide a list of parameters (including the status of the transaction – For example, success, failed etc). On a few occasions, the transaction response is initiated from our end, but it doesn’t reach you due to network issues or user activity (like refreshing the browser etc). We strongly recommend that this API is used to reconcile with PayU’s database once you receive the response. This will protect you from any tampering by the user and help in ensuring safe and secure transaction experience. For this API, you need to set transactionID inside your payment params as below:

    self.paymentParamForPassing.transactionID = @"tnxID1|txnID2|txnID3";
    self.paymentParamForPassing.hashes.verifyTransactionHash = @"hash";

Multiple txnID can be sent by using pipe Symbol(|) as seprator. To integrate this API call the method verifyPayment as below

[webServiceResponse
verifyPayment:self.paymentParamForPassing withCompletionBlock:^(NSDictionary *dictVerifyPayment, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // dictVerifyPayment is having the verifyPayment detail
      }
    }];

9 Edit User Card (Deprecated):

This method is not supported because of RBI guidelines, in order to save or edit the card, please save card by authenticating it doing an actual payment.

This API is used to edit the details of an existing stored card in the vault. Only Card Name and Name on card can be edited. For this API, you need to set following parameter in the payment params as below:

self.paymentParamForPassing.userCredentials = @"gtKFFx:UmangArya";
self.paymentParamForPassing.cardToken = @"745d72e2fd9b7e88824fef4e7ed7dac1f";
self.paymentParamForPassing.cardName = @"UmangHDFC";
self.paymentParamForPassing.cardMode = @"CC";
self.paymentParamForPassing.cardType = @"MAST";
self.paymentParamForPassing.nameOnCard = @"testHDFC";
self.paymentParamForPassing.cardNo = @"5123456789012346";
self.paymentParamForPassing.expiryMonth = @"11";
self.paymentParamForPassing.expiryYear = @"2019";
self.paymentParamForPassing.hashes.editUserCardHash = @"hash";

To integrate this API call the method editUserCard as below

[webServiceResponse
editUserCard:self.paymentParamForPassing withCompletionBlock:^(PayUModelStoredCard *objStoredCard, NSString *errorMessage, id extraParam){
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // objStoredCard object is having the updated stored card parameters
      }
    }];

10 Check Is Domestic:

This API is used to detect whether a particular bin number is international or domestic. It is also useful to determine the card’s issuing bank, the card type brand – i.e, Visa, Master etc and also the Card Category – i.e. Credit/Debit etc. Bin number is the first 6 digits of a Credit/Debit card. For this API, you need to set cardNumber in the payment params as below:

self.paymentParamForPassing.cardNumber = @"512345";
self.paymentParamForPassing.hashes.checkIsDomesticHash = @"hash";

To integrate this API call the method checkIsDomestic as below

[webServiceResponse
checkIsDomestic:self.paymentParamForPassing withCompletionBlock:^(PayUModelCheckIsDomestic *checkIsDomestic, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // checkIsDomestic object is having the required detail
      }
    }];

11 Get Transaction Info:

This API is used to extract the transaction details between two given time periods. The API takes the input as two dates along with time (initial and final), between which the transaction details are needed. The output would consist of the status of the API (success or failed) and all the transaction details in an array format. For this API, you need to set startTime and endTime in the payment params as below:

self.paymentParamForPassing.startTime = @"2014-01-12 16:00:00";
self.paymentParamForPassing.endTime = @"2014-01-12 16:00:50";
self.paymentParamForPassing.hashes.getTransactionInfoHash = @"hash";

To integrate this API call the method getTransactionInfo as below

[webServiceResponse
getTransactionInfo:self.paymentParamForPassing withCompletionBlock:^(NSArray *arrOfGetTxnInfo, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // arrOfGetTxnInfo is the array of PayUModelGetTxnInfo which is having detail of transaction
      }
    }];

12 Save User Card (Deprecated):

This method is not supported because of RBI guidelines, in order to save or edit the card, please save card by authenticating it doing an actual payment.

This API is used for saving a card to the vault. For this API, you need to set following parameter in the payment params as below:

 self.paymentParamForPassing.userCredentials = @"gtKFFx:UmangArya";
 self.paymentParamForPassing.cardName = @"UmangHDFC";
 self.paymentParamForPassing.cardMode = @"CC";
 self.paymentParamForPassing.cardType = @"MAST";
 self.paymentParamForPassing.nameOnCard = @"testHDFC";
 self.paymentParamForPassing.cardNo = @"5123456789012346";
 self.paymentParamForPassing.expiryMonth = @"11";
 self.paymentParamForPassing.expiryYear = @"2019";
 self.paymentParamForPassing.duplicateCheck = @"1";// duplicateCheck = 1 means in response you will get duplicate count otherwise not
 self.paymentParamForPassing.hashes.saveUserCardHash = @"hash";

To integrate this API call the method saveUserCard as below:

[webServiceResponse
saveUserCard:self.paymentParamForPassing withCompletionBlock:^(PayUModelStoredCard *objStoredCard, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // objStoredCard is having the newly save card details
        // objStoredCard.duplicateCardCount gives the number of duplicate card found for that merchant for this card
      }
    }];

    

13 GetBinInfo:

This API is used to detect whether a particular bin number is international or domestic. It is also useful to determine the card’s issuing bank, the card type brand – i.e, Visa, Master etc and also the Card Category – i.e. Credit/Debit etc. Bin number is the first 6 digits of a Credit/Debit card. This API is also helpful in knowing whether the cardbin is eligible for SI or not. For this API, you need to set cardNumber in the payment params as below

This API is used for saving a card to the vault. For this API, you need to set following parameter in the payment params as below:

self.paymentParamForPassing.cardNumber = @"512345";
// set below flag to true, to know whether the given cardBin support standing instructions
self.paymentParamForPassing.isSIInfo = TRUE;
self.paymentParamForPassing.hashes.getBinInfoHash = @"hash";

To integrate this API call the method saveUserCard as below:

[webServiceResponse
getBinInfo:self.paymentParamForPassing withCompletionBlock:^(NSArray<PayUModelCheckIsDomestic *> *allBin, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // checkIsDomestic object is having the required detail
      }
    }];

14 GetCheckoutDetails API:

It provides information of additionalCharges, bank down status, tax info enabled on a merchant key. Calling this API is similar like other Web Services, the only difference is that it requires a JSON in var1 as below

{
  "requestId": "1632372121462",
  "transactionDetails": {
    "amount": 5000
  },
  "customerDetails": {
    "mobile": "9999999999"
  },
  "filters": {
    "paymentOptions": {
      "emi": {
        "cardless": "ZESTMON"
      }
    }
  },
  "useCase": {
    "getExtendedPaymentDetails": true,
    "checkCustomerEligibility": true
  }
}

here, requestId is a random unique number passed in request.

For this API you need to set amount, checkAdditionalCharges, checkDownStatus, checkTaxSpecification, checkCustomerEligibility, phoneNumber in the payment params as below:

self.paymentParamForPassing.checkAdditionalCharges = true;
self.paymentParamForPassing.checkDownStatus = true;
self.paymentParamForPassing.checkTaxSpecification = true;
self.paymentParamForPassing.checkCustomerEligibility = true;
self.paymentParam.phoneNumber = @"<Client's 10 digit Mobile Number>";
self.paymentParamForPassing.amount = @"5000";
self.paymentParamForPassing.hashes.getCheckoutDetailsHash = @"hash";

To integrate this API call the method getCheckoutDetail as below:

[webServiceResponse
getCheckoutDetail:self.paymentParamForPassing withCompletionBlock:^(NSArray<PayUModelPaymentRelatedDetail *> *paymentRelatedDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // paymentRelatedDetails object is having the required detail
      }
    }];

15 Lookup API:

This is used when integrating Multi-Currency Payments. Follow below steps to integrate this API:

Pre-requisites

Kindly connect with your Key Account Manager at PayU to get below credentials -

  1. Merchant Access Key

  2. Merchant Secret Key

Create Request

Lookup Api needs a JSON request. Product Type need to be passed either as DCC or MCP. DCC means Direct Currency Conversion, i.e it returns the conversion prices for card currency only. To get all enabled currencies on Merchant Access Key along with their conversion prices, use product type as MCP. For DCC, cardBin is mandatory, while for MCP cardBin is not required

Below is example request for MCP as product type

{   
  "merchantAccessKey":"E5ABOXOWAAZNXB6JEF5Z", 
  "baseAmount":
  {     
    "value":10000.00,      
     "currency":"INR"   
   },   
    "merchantOrderId":"OBE-JU89-13151-110",   
    "productType":"MCP",   
    "signature":"be5a56667354d9e2ea5ea1c6af78b0afc1894eb2"
  }

For this API you need to set total amount, lookupAPI Hash, lookuprequestId in the payment params as below:

self.paymentParamForPassing.amount = @"Total amount";
self.paymentParamForPassing.hashes.lookupApiHash = @"HMACSHA1 Signature";
self.paymentParamForPassing.lookupRequestId = @"Any unique id";

PFB details for params used in Lookup API

Parameter Name

Description

Amount

Transaction Amount

Card Bin

First 6 digits of card number

Currency

Base Currency of Transaction ("INR")

Merchant Access Key

Merchant Access Key provided by PayU

Merchant OrderId

A unique request id for Lookup API request

Product Type

Use MCP to get all enabled currency on Merchant Access Key or DCC to get direct currency conversion for card currency

Signature

Hmac SHA1 hash created with formula explained below

To calculate signature, Create HmacSHA1 hash of below data

Signature =HMAC-SHA1(data, key);
Data = baseCurrency+merchantOrderId+baseAmount
Key = Secret Key shared with the merchant at the time of on-boarding


Example data = INROBE-JU89-13151-11010000.00

To integrate this API call the method mcpLookup as below:

[webServiceResponse
mcpLookup:self.paymentParamForPassing withCompletionBlock:^(PayUModelMultiCurrencyPayment *paymentRelatedDetails, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // PayUModelMultiCurrencyPayment object is having the required detail
      }
}];

16 Check Sodexo Card Balance:

This can be used to fetch detail of Sodexo card with source id

self.paymentParamForPassing.sodexoSourceId = @"<Sodexo source id>;
self.paymentParamForPassing.hashes.checkBalanceApiHash =  @"hash";

To integrate this API call the method fetchSodexoCardDetails as below:

[webServiceResponse
fetchSodexoCardDetails.paymentParamForPassing withCompletionBlock:^(PayUModelSodexoCardDetail *sodexoCardDetail, NSString *errorMessage, id extraParam) {
      if (errorMessage) {
        // Something went wrong errorMessage is having the Detail
      }
      else{
        // sodexoCardDetail object is having the required detail
      }
    }];

Hash Calculation

Hash formula for check balance is

    sha512(key|check_balance|{"sodexoSourceId":"<sodexoSouceId>"}|SALT)

17 Get Tokenised PaymentDetails:

Get details of stored card to make payment on another PG

self.paymentParam.userCredentials = @"<user_credentials>";  
self.paymentParam.cardToken = @"<cardToken>";    
self.paymentParam.amount = @"100";  
self.paymentParam.currency = @"INR";
self.paymentParamForPassing.hashes.getTokenizedPaymentDetailHash = @"hash";

To integrate this API call the method getTokenizedPaymentDetails as below

[webServiceResponse getTokenizedPaymentDetails.paymentParamForPassing withCompletionBlock:^(PayUModelTokenizedPaymentDetails *tokenizedPaymentdetails,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
            }
        }];

18 Get Tokenised StoredCards:

This API is helpful in getting all the Stored Card for particular user. For this API, you need to set userCredentials in the payment params as below:

self.paymentParam.userCredentials = @"<user_credentials>";  
self.paymentParamForPassing.hashes.getTokenizeddStoredCardHash = @"hash";

To integrate this API call the method getTokenizedStoredCards as below

[webServiceResponse getTokenizedStoredCards:self.paymentParamForPassing withCompletionBlock:^(NSDictionary *dictStoredCard,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
            }
        }];

19 Delete Tokenised StoredCards:

This API is helpful in Deleting StoredCard.

self.paymentParam.userCredentials = @"<user_credentials>";  
self.paymentParam.cardToken = @"<cardToken>";    
self.paymentParam.networkToken = @"<networkToken>";  
self.paymentParam.issuerToken = @"<issuerToken>";
self.paymentParamForPassing.hashes.deleteTokenizedStoredCardHash = @"hash";

To integrate this API call the method deleteTokenizedStoredCard as below

[webServiceResponse deleteTokenizedStoredCard: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
            }
        }];

Last updated