Lookup API

The Lookup API is used when integrating multi-currency payments. To use Lookup API for iOs, follow these subsections:

Prerequisites

πŸ“˜

Before you begin

Connect with your Key Account Manager at PayU to get the following credentials:

  • Merchant Access Key
  • Merchant Secret Key

Lookup API needs a JSON request. Product types need to be passed either as DCC or MCP. Direct Currency Conversion (DCC) 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

The following example is to request for MCP as a 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 the amount, lookupAPIHash, and lookuprequestId parameters in the payment parameters for instance.

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

Request parameters

The details of the parameters used in the Lookup API are:

ParameterDescription
AmountTransaction Amount
Card BinFirst 6 digits of the card number
CurrencyBase Currency of Transaction (β€œINR”)
Merchant Access KeyMerchant Access Key provided by PayU
Merchant OrderIdA unique request id for the Lookup API request
Product TypeUse MCP to get all enabled currency on Merchant Access Key or DCC to get direct currency conversion for card currency
SignatureHmac SHA1 hash created with formula explained below

Calculate the signature for hash

Use the following data to calculate the signature for creating the HmacSHA1 hash.

  • Signature =HMAC-SHA1(data, key);
  • Data = baseCurrency+merchantOrderId+baseAmount
  • Key = Secret Key shared with the merchant at the time of onboarding
  • Example: INROBE-JU89-13151-11010000.00

To integrate this API, call the mcpLookup method for instance:

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

πŸ“˜

Reference:

For more information on Static Hashing, refer to Generate Static Hash.