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. 1.
    Merchant Access Key
  2. 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
1
{
2
"merchantAccessKey":"E5ABOXOWAAZNXB6JEF5Z",
3
"baseAmount":{
4
"value":10000.00,
5
"currency":"INR"
6
},
7
"cardBin":"513382",
8
"merchantOrderId":"OBE-JU89-13151-110",
9
"productType":"DCC",
10
"signature":"be5a56667354d9e2ea5ea1c6af78b0afc1894eb2"
11
}
Copied!
To create Lookup API request like above, use LookupApiRequestBuilder class as below
Java
Kotlin
1
String postData = new LookupRequest.LookupApiRequestBuilder()
2
.setAmount("10000.00")
3
.setCardBin("513382")
4
.setCurrency("INR")
5
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
6
.setMerchantOrderId("OBE-JU89-13151-110")
7
.setProductType(LookupRequest.ProductType.DCC)
8
.setSignature(hash)
9
.build().prepareJSON();
Copied!
1
val postData = LookupRequest.LookupApiRequestBuilder()
2
.setAmount("10000.00")
3
.setCardBin("513382")
4
.setCurrency("INR")
5
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
6
.setMerchantOrderId("OBE-JU89-13151-110")
7
.setProductType(LookupRequest.ProductType.DCC)
8
.setSignature(hash)
9
.build().prepareJSON()
Copied!
Below is example request for MCP as product type
1
{
2
"merchantAccessKey":"E5ABOXOWAAZNXB6JEF5Z",
3
"baseAmount":{
4
"value":10000.00,
5
"currency":"INR"
6
},
7
"merchantOrderId":"OBE-JU89-13151-110",
8
"productType":"MCP",
9
"signature":"be5a56667354d9e2ea5ea1c6af78b0afc1894eb2"
10
}
Copied!
To create Lookup API request for MCP, use LookupApiRequestBuilder class as below
Java
Kotlin
1
String postData = new LookupRequest.LookupApiRequestBuilder()
2
.setAmount("10000.00")
3
.setCurrency("INR")
4
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
5
.setMerchantOrderId("OBE-JU89-13151-110")
6
.setProductType(LookupRequest.ProductType.MCP)
7
.setSignature(hash)
8
.build().prepareJSON();
Copied!
1
val postData = LookupRequest.LookupApiRequestBuilder()
2
.setAmount("10000.00")
3
.setCurrency("INR")
4
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
5
.setMerchantOrderId("OBE-JU89-13151-110")
6
.setProductType(LookupRequest.ProductType.MCP)
7
.setSignature(hash)
8
.build().prepareJSON()
Copied!
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
1
Signature =HMAC-SHA1(data, key);
2
Data = baseCurrency+merchantOrderId+baseAmount
3
Key = Secret Key shared with the merchant at the time of on-boarding
4
5
6
Example data,
7
baseCurrency = "INR"
8
merchantOrderId = "OBE-JU89-13151-110"
9
baseAmount = "10000.00"
10
11
hashString = INROBE-JU89-13151-11010000.00
Copied!

Call LookupTask

Java
Kotlin
1
payuConfig.setData(postData);
2
LookupTask lookupTask = new LookupTask(this);
3
lookupTask.execute(payuConfig);
Copied!
1
payuConfig.data = postData
2
val lookupTask =LookupTask (this)
3
lookupTask.execute(payuConfig)
Copied!
Here, this is object of a class that implements LookupApiListener. Below is signature of LookupApiListener
Java
Kotlin
1
public interface LookupApiListener {
2
void onLookupApiResponse(PayuResponse payuResponse);
3
}
Copied!
1
interface LookupApiListener {
2
fun onLookupApiResponse(payuResponse: PayuResponse?)
3
}
Copied!

Get Lookup Api Response

Once you call ‘execute’ on LookupTask, ‘onLookupApiResponse’ callback method is called.
Java
Kotlin
1
@Override
2
public void onLookupApiResponse(PayuResponse payuResponse){
3
4
//Fetch lookup Details using below code
5
LookupDetails lookupDetails = payuResponse.getLookupDetails();
6
}
Copied!
1
override fun onLookupApiResponse(payuResponse: PayuResponse?){
2
3
//Fetch lookup Details using below code
4
val lookupDetails = payuResponse.lookupDetails
5
}
Copied!
Last modified 6mo ago