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 DCC as product type

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

To create Lookup API request like above, use LookupApiRequestBuilder class as below

Java
Kotlin
Java
String postData = new LookupRequest.LookupApiRequestBuilder()
.setAmount("10000.00")
.setCardBin("513382")
.setCurrency("INR")
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
.setMerchantOrderId("OBE-JU89-13151-110")
.setProductType(LookupRequest.ProductType.DCC)
.setSignature(hash)
.build().prepareJSON();
Kotlin
val postData = LookupRequest.LookupApiRequestBuilder()
.setAmount("10000.00")
.setCardBin("513382")
.setCurrency("INR")
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
.setMerchantOrderId("OBE-JU89-13151-110")
.setProductType(LookupRequest.ProductType.DCC)
.setSignature(hash)
.build().prepareJSON()

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"
}

To create Lookup API request for MCP, use LookupApiRequestBuilder class as below

Java
Kotlin
Java
String postData = new LookupRequest.LookupApiRequestBuilder()
.setAmount("10000.00")
.setCurrency("INR")
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
.setMerchantOrderId("OBE-JU89-13151-110")
.setProductType(LookupRequest.ProductType.MCP)
.setSignature(hash)
.build().prepareJSON();
Kotlin
val postData = LookupRequest.LookupApiRequestBuilder()
.setAmount("10000.00")
.setCurrency("INR")
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
.setMerchantOrderId("OBE-JU89-13151-110")
.setProductType(LookupRequest.ProductType.MCP)
.setSignature(hash)
.build().prepareJSON()

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

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

Call LookupTask

Java
Kotlin
Java
payuConfig.setData(postData);
LookupTask lookupTask = new LookupTask(this);
lookupTask.execute(payuConfig);
Kotlin
payuConfig.data = postData
val lookupTask =LookupTask (this)
lookupTask.execute(payuConfig)

Get Lookup Api Response

Once you call ‘execute’ on LookupTask, ‘onLookupApiResponse’ callback method is called.

Java
Kotlin
Java
@Override
public void onLookupApiResponse(PayuResponse payuResponse){
//Fetch lookup Details using below code
LookupDetails lookupDetails = payuResponse.getLookupDetails();
}
Kotlin
override fun onLookupApiResponse(payuResponse: PayuResponse?){
//Fetch lookup Details using below code
val lookupDetails = payuResponse.lookupDetails
}