Web Services for Core SDK
This page describes how to make api calls from SDK.
This section provides a reference for the following Web Service APIs for Code iOS Core:
- Fetch Payment Option
- VAS
- Check Offer Status
- Get Offer Status
- Get EMI According to Interest
- Verify Payment
- Check is Domestic
- Get Transaction Info
- Get Bin Info
- Get Checkout Details
- Lookup API
- Tokenization
Step 1: Initialise Merchant web service
Create an object of MerchantWebService with any of the supported API commands.
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey); // Merchant key
merchantWebService.setCommand(<Api Commands>); // Pass the command name
merchantWebService.setVar1(<Pass var 1 value>) // Pass the var1 calue
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
For more information on Web Service hash generation, refer to Generate Hash.
Generate Hash for MerchantWebService
To generate Hash refer to Hash Generation.
Formula :-sha512(key|command|var1|salt)
where
key= "Your Key"
command= <"Api Commands"> // Pass Command Name
var1= <"default"> // Pass the var1 value
salt= "Your SALT"
Step 2: Create Merchant web service PostData
PostData postData = new MerchantWebServicePostParams(merchantWebService).getMerchantWebServicePostParams();
if (postData.getCode() == PayuErrors.NO_ERROR) {
payuConfig.setData(postData.getResult());
}
If the PostData code snippet (above) is returning errors, check the data point set in merchantWebService.
Supported API commands
The following API commands are offered in the PayUConstants
class.
Commands | Description | Task | Listener |
---|---|---|---|
PAYMENT_RELATED_DETAILS_FOR_MOBILE_SDK | To get all enabled payment options | GetPaymentRelatedDetailsTask payuTask = GetPaymentRelatedDetailsTask(this); payuTask.execute(payuConfig); | PaymentRelatedDetailsListener |
VAS_FOR_MOBILE_SDK | To get the health status of payment options | ValueAddedServiceTask payuTask = ValueAddedServiceTask(this); payuTask.execute(payuConfig); | ValueAddedServiceApiListener |
GET_BIN_INFO | Get Bin information on CC/DC | BinInfoTask binInfoTask = new BinInfoTask(this); binInfoTask.execute(payuConfig); | GetCardInformationApiListener |
CHECK_IS_DOMESTIC | Get Card information on CC/DC | GetCardInformationTask payuTask = GetCardInformationTask(this); payuTask.execute(payuConfig); | |
GET_TRANSACTION_INFO | Getting Transaction information | GetTransactionInfoTask payuTask = GetTransactionInfoTask(this); payuTask.execute(payuConfig); | GetTransactionInfoApiListener |
VERIFY_PAYMENT | Verify Payment Status | VerifyPaymentTask payuTask = VerifyPaymentTask(this); payuTask.execute(payuConfig); | VerifyPaymentApiListener |
CHECK_OFFER_DETAILS | To get the offer details. | CheckOfferDetailsTask payuTask = CheckOfferDetailsTask(this); payuTask.execute(payuConfig); | CheckOfferDetailsApiListener |
API_GET_EMI_AMOUNT_ACCORDING_INTEREST | To get the EMI amount according to interest. | GetEmiAmountAccordingToInterestTask payuTask = GetEmiAmountAccordingToInterestTask(this); payuTask.execute(payuConfig); | GetEmiAmountAccordingToInterestApiListener |
CHECK_OFFER_STATUS | To check the status of the offer | GetOfferStatusTask payuTask = GetOfferStatusTask(this); payuTask.execute(payuConfig); | GetOfferStatusApiListener |
ELIGIBLE_BINS_FOR_EMI | To check if the bin is eligible for EMI | EligibleBinsForEMITask payuTask = EligibleBinsForEMITask(this); payuTask.execute(payuConfig); | EligibleBinsForEMIApiListener |
GET_CHECKOUT_DETAILS | To get info about additional charges, bank down, tax info, and offers | GetCheckoutDetailsTask getCheckoutDetailsTask = GetCheckoutDetailsTask(this); getCheckoutDetailsTask.execute(payuConfig); | CheckoutDetailsListener |
GET_PAYMENT_INSTRUMENT | To get stored cards of the user | GetTokenisedCardTask getTokenisedCardTask = GetTokenisedCardTask(this); getTokenisedCardTask.execute(payuConfig); | GetTokenisedCardApiListener |
DELETE_PAYMENT_INSTRUMENT | To delete the stored card of the user | DeleteTokenisedCardTask deleteTokenisedCardTask = DeleteTokenisedCardTask(this); deleteTokenisedCardTask.execute(payuConfig); | DeleteTokenisedCardApiListener |
GET_PAYMENT_DETAILS | To get details of the stored card to make payment on another PG | GetTokenisedCardDetailsTask getTokenisedCardDetailsTask = GetTokenisedCardDetailsTask(this); getTokenisedCardDetailsTask.execute(payuConfig); | GetTokenisedCardDetailsApiListener |
CHECK_BALANCE | To get info about Sodexo saved Card | CheckBalanceTask checkBalanceTask= CheckBalanceTask(this); checkBalanceTask.execute(payuConfig); | CheckBalanceListener |
Additional APIs
Enable Payment Options for Merchant Web Services
This section describes how to get all payment options enabled on your merchant key, along with additional information like stored cards and payment option details.
Step 1: Call GetPaymentRelatedDetailsTask
GetPaymentRelatedDetailsTask paymentRelatedDetailsForMobileSdkTask = new GetPaymentRelatedDetailsTask(this);
paymentRelatedDetailsForMobileSdkTask.execute(payuConfig);
//where ,
//Input param (this) is the instance of class which implements PaymentRelatedDetailsListener
//‘PaymentRelatedDetailsListener’ is interface with abstract method, which is
//public void onPaymentRelatedDetailsResponse(PayuResponse payuResponse)
After you execute the GetPaymentRelatedDetailsTask
, onPaymentRelatedDetailsResponse
callback is called. Check for the available methods to check if the selected payment option is available.
@Override
public void onPaymentRelatedDetailsResponse(PayuResponse payuResponse) {
mPayuResponse = payuResponse;
// Check if UPI as payment option available.
if(payuResponse.isUpiAvailable()){
// To check if UPI as payment option is available
}
if(payuResponse.isGoogleTezAvailable()){
// To check if Google Pay as payment option is available
}
if(payuResponse.isPhonePeIntentAvailable()){
// To check if Phonepe as payment option is available
}
if(payuResponse.isLazyPayAvailable()){
// To check if LazyPay as payment option is available
}
if(payuResponse.isGenericIntentAvailable()){
// To check if Generic Intent as payment option is available
}
//For SI Payments
if(payuResponse.isNBAvailableFoSI){
//Fetch SI NB List from payuResponse.getSiBankList() method
}
}
Get Checkout details API
The Get Check Out Details API provides information on the bank down status, tax info, and offers enabled on a merchant key. You can call this API similar to other Web Services. The only difference is that it requires a JSON in var1 as in the following code block:
{
"requestId":"1614595430980",
"transactionDetails":{
"amount":5000
},
"customerDetails": {
// optional
"mobile": "9999999999", // optional
},
"useCase":{
"getAdditionalCharges":true,
"getTaxSpecification":true,
"checkDownStatus":true,
"getExtendedPaymentDetails":true,
"getOfferDetails":true
}
}
Note
In the above example,
requestId
is a unique random number passed in the request.
Step 1: Create var1
Mobile SDK has a Utility class to create a JSON, as explained above. The implementation is similar to the following code snippet:
Usecase.Builder usecase = new Usecase.Builder()
.setCheckCustomerEligibility(true)
.shouldCheckDownStatus(true) // set it to true to fetch bank down status for each payment option
.shouldGetAdditionalCharges(true) // set it to true to fetch additional charges applicable on each payment option
.shouldGetOfferDetails(true) // set it to true to fetch offers enabled on merchant key
.shouldGetExtendedPaymentDetails(true) // set it to true to get extended payment details
.shouldGetTaxSpecification(true) // set it to true to fetch tax info applicable on each payment mode
.build();
GetTransactionDetails.Builder transactionDetails = new GetTransactionDetails.Builder()
.setAmount(1000.0)//transaction amount in double
.build();
//Passing Customer Details is optional and can be used
//to check EMI eligibility based on mobile number
CustomerDetails.Builder customerDetails = new CustomerDetails.Builder()
.setMobile("9999999999") //pass the mobile number if want to get eligibility status in payment option
.build()
String var1 = new GetCheckoutDetailsRequest.Builder()
.setUsecase(usecase)
.setCustomerDetails(customerDetails)
.setTransactionDetails(transactionDetails)
.build().prepareJSON();
After getting var1, pass that in Merchant Web Service with the commandPayuConstants.GET_CHECKOUT_DETAILS
.
Get API Response
PayuResponse is received in the onCheckoutDetailsResponse() callback method of CheckoutDetailsListener as mentioned in the API Commands Supported table.
Get Additional Charges, Bank Down Status and Offers
Additional Charges are returned in the PaymentDetails object for each payment option. The following example code snippet is for fetching Additional Charges for Net Banking:
//if netbanking is available on merchant key
if(payuResponse.isNetBanksAvailable()){
ArrayList<PaymentDetails> = payuResponse.getNetbanks();
}
Additional Charge is available inside each PaymentDetails object and can be accessed using the paymentDetails.getAdditionalCharge()
method
Similarly, bank health is available inside each PaymentDetails object and can be accessed using the paymentDetails.isBankDown()
method.
For Offers, An ArrayList<PayuOffer>
is available inside each PaymentDetails object. To get the offers list, use paymentDetails.getOfferDetailsList()
.
Get Tax Info
Tax is not applied on individual Net Banking or card schemes but instead applied at the payment mode-level for all CC(Credit Card), DC(Debit Card), NB(Net Banking), Wallets, etc. So, to fetch the Tax Specification, use the following code block:
if(payuResponse.isTaxSpecificationAvailable())
TaxSpecification taxSpecification = payuResponse.getTaxSpecification();
taxSpecification.getCcTaxValue() //tax applicable on CC transactions
taxSpecification.getDcTaxValue() //tax applicable on DC transactions
taxSpecification.getNbTaxValue() //tax applicable on NB transactions
taxSpecification.getCashTaxValue() //tax applicable on Wallet transactions
...
Look up API
Step 1: Create request
The Lookup API needs a JSON request. Product type needs to be passed either as DCC or MCP. DCC means Direct Currency Conversion, that is, it returns the conversion prices for card currency only. To get all enabled currencies on Merchant Access Key and their conversion prices, use product type as MCP. For DCC, cardBin is mandatory, but cardBin is not required for MCP.
The following example is a request for DCC as the product type.
{
"merchantAccessKey":"E5ABOXOWAAZNXB6JEF5Z",
"baseAmount":{
"value":10000.00,
"currency":"INR"
},
"cardBin":"513382",
"merchantOrderId":"OBE-JU89-13151-110",
"productType":"DCC",
"signature":"be5a56667354d9e2ea5ea1c6af78b0afc1894eb2"
}
To create the Lookup API request as above, use the LookupApiRequestBuilder class similar to the following code block:
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();
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()
The following example request is for MCP as the product type.
{
"merchantAccessKey":"E5ABOXOWAAZNXB6JEF5Z",
"baseAmount":{
"value":10000.00,
"currency":"INR"
},
"merchantOrderId":"OBE-JU89-13151-110",
"productType":"MCP",
"signature":"be5a56667354d9e2ea5ea1c6af78b0afc1894eb2"
}
To create the Lookup API request for MCP, use the LookupApiRequestBuilder class similar to the following code block:
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();
val postData = LookupRequest.LookupApiRequestBuilder()
.setAmount("10000.00")
.setCurrency("INR")
.setMerchantAccessKey("E5ABOXOWAAZNXB6JEF5Z")
.setMerchantOrderId("OBE-JU89-13151-110")
.setProductType(LookupRequest.ProductType.MCP)
.setSignature(hash)
.build().prepareJSON()
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 the HmacSHA1
hash of the following 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,
baseCurrency = "INR"
merchantOrderId = "OBE-JU89-13151-110"
baseAmount = "10000.00"
hashString = INROBE-JU89-13151-11010000.00
Step 2: Call LookupTask
Here, this is an object of a class that implements LookupApiListener
. The following is a signature of LookupApiListener:
public interface LookupApiListener {
void onLookupApiResponse(PayuResponse payuResponse);
}
interface LookupApiListener {
fun onLookupApiResponse(payuResponse: PayuResponse?)
}
Step 3: Get LookUp API response
After you execute LookupTask, the onLookupApiResponse
callback method is called:
@Override
public void onLookupApiResponse(PayuResponse payuResponse){
//Fetch lookup Details using below code
LookupDetails lookupDetails = payuResponse.getLookupDetails();
}
override fun onLookupApiResponse(payuResponse: PayuResponse?){
//Fetch lookup Details using below code
val lookupDetails = payuResponse.lookupDetails
}
VAS API
Note :
You can check if a particular NetBanking service is down or not by just passing the bankCode or card-bin (first 6 digits of card number) and in payuResponse, the response will be fetched, for instance.
This API is used to get the list of down Net Banking and down card BIN. Integrate this API by calling the ValueAddedServiceTask
method:
Step 1: Call ValueAddedServiceTask
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.VAS_FOR_MOBILE_SDK);
merchantWebService.setVar1(PayuConstants.DEFAULT);
merchantWebService.setVar2(PayuConstants.DEFAULT);
merchantWebService.setVar3(PayuConstants.DEFAULT);
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
Step 2: Get onValueAddedServiceApiResponse
After you execute ValueAddedServiceTask, the onValueAddedServiceApiResponse
callback method is called:
@Override
public void onValueAddedServiceApiResponse(PayuResponse payuResponse) {
if (mPayuResponse != null) {
// It means given NetBanking code or cardnumber is not down i.e. it is in good to go condition
} else {
// It means given NetBanking code or cardnumber is down and you can display the responseMessage if you want or you can customize it
}
}
}
EligibleBinsForEMI API
This API fetches a list of eligible Bins for EMI corresponding to each Bank name along with minimum amount. For this API, you need to set params as below:
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.ELIGIBLE_BINS_FOR_EMI);
merchantWebService.setVar1("BIN"); // This parameter needs can include either Bin or NET.
merchantWebService.setVar2(cardBin); // The first 6/8/9 digits of card number or network token.
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
@Override
public void onEligibleBinsForEMIApiResponse(PayuResponse payuResponse) {
Log.d(TAG, "onEligibleBinsForEMIApiResponse: " + payuResponse.getRawResponse());
}
GetEMIAccordingToInterest API
Use this API to get information to get details related to EMI such as EMI amount, tenure in month, interest rate, etc.
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.API_GET_EMI_AMOUNT_ACCORDING_INTEREST);
merchantWebService.setVar1(amount); // The amount that must be converted to EMI.
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
@Override
public void onGetEmiAmountAccordingToInterestApiResponse(PayuResponse payuResponse) {
Log.d(TAG, "onGetEmiAmountAccordingToInterestApiResponse: " + payuResponse.getRawResponse());
}
Get Transaction Info API
This API is used to extract the transaction details between two given time periods. The API takes the input as two dates and the 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. Set startTime and endTime in the payment params as described in the following code block:
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.GET_TRANSACTION_INFO);
merchantWebService.setVar1(startDate); // The starting Time (from when the transaction details are needed
merchantWebService.setVar2(endDate); // The end Time (till when the transaction details are needed).
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
@Override
public void onGetTransactionApiListener(PayuResponse payuResponse) {
Log.d(TAG, "onGetTransactionApiListener: " + payuResponse.getRawResponse());
}
VerifyPayment API
This web service is used to reconcile the transaction with PayU. When PayU posts back the final response to you (merchant), PayU provides a list of parameters (including the status of the transaction). For example, success, failure, etc. On a few occasions, the transaction response is initiated from our end, but it does not reach you due to network issues or user activity (like refreshing the browser, etc.).
Note:
PayU strongly recommends 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 parameters for instance:
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.VERIFY_PAYMENT);
merchantWebService.setVar1(txnId); // In this parameter, you can put all the transaction IDs, that is, txnid (your transaction ID/order ID) values separated by pipe or PayU ID.
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
Note: You can send multiple txnIDs (transaction IDs) using the pipe symbol(|) as a separator.
@Override
public void onVerifyPaymentResponse(PayuResponse payuResponse) {
Log.d(TAG, "onVerifyPaymentResponse: " + payuResponse.getRawResponse());
}
Get BIN Info API
The getBinInfo API is used to get the following using the BIN number, that is, the first six digits of a credit card or debit card:
BIN information
- Detect whether a particular BIN number is international or domestic.
- Determine the card’s issuing bank, the card type brand, that is, Visa, Master, etc.,
- Determine the card category, that is, credit, debit, etc.
This API is used to get the card BIN details. For this API, you need to set the following parameter in the payment params similar to the following code block:
Step 1: Create Post Request for Get BIN Info API
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey); // Merchant key
merchantWebService.setCommand(PayuConstants.GET_BIN_INFO);
merchantWebService.setVar1("1")
merchantWebService.setVar2("1") //only for SI
merchantWebService.setVar5("<pass card BIN Number>") // Pass card BIN Number
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
Step 2: Get onBinInfoApiResponse
@Override
public void onBinInfoApiResponse(PayuResponse payuResponse) {
}
Get Card Information (Check isDomestic)
This API is used to get if the card (passed in cardBin info API) is domestic or international. This API returns the following parameters: card_type, category, issuing_bank, is_atmpin_card, etc..
For this API, you need to set the following parameter in the payment params similar to the following code block:
Step 1: Create Post Request for Get Card Info API
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey); // Merchant key
merchantWebService.setCommand(PayuConstants.CHECK_IS_DOMESTIC);
merchantWebService.setVar1("<pass the card Bin number>")
merchantWebService.setHash(<Api Command Hash>) // Pass the Hash value, and use the below formula
Step 2: Get onGetCardInformationResponse
@Override
public void onGetCardInformationResponse(PayuResponse payuResponse) {
Log.d(TAG, "onGetCardInformationResponse: " + payuResponse.getRawResponse());
}
Offer API
Fetch Offer Details
Use this API to fetch the offer list available for the merchant.
To integrate this API call the fetchOfferDetails pass the requestData as parameters as shown in the code snippet below:
payuConfig = new PayuConfig();
payuConfig.setEnvironment(PayuConstants.STAGING_ENV);
V2ApiTask v2ApiTask = new V2ApiTask(merchantKey, payuConfig);
FetchOfferApiRequest fetchOfferApiRequest = new FetchOfferApiRequest.Builder().setAmount(100.00).setUserToken("56789067890").build();
v2ApiTask.getOffers(fetchOfferApiRequest, new HashGenerationListener() {
@Override
public void generateSignature(HashMap<String, String> hashMap, HashCompletionListener hashCompletionListener) {
String hashName = hashMap.get(PayuConstants.CP_HASH_NAME);
String hashData = hashMap.get(PayuConstants.CP_HASH_STRING);
Log.d(TAG, "generateSignature: " + hashName);
Log.d(TAG, "generateSignature: " + hashData);
String hash = HashGenerationUtils.generateHashFromSDK(hashData, salt);
HashMap hashMap1 = new HashMap();
hashMap1.put(hashName, hash);
hashCompletionListener.onSignatureGenerated(hashMap1); // If you are passing wrong Hash then you will get null response
}
}, new FetchOfferDetailsListener() {
@Override
public void onFetchOfferDetailsResponse(PayuResponse payuResponse) {
Log.d(TAG, "onFetchOfferDetailsResponse: " + payuResponse.getRawResponse());
}
});
Validate Offer API
Use this API to validate the offer for the merchants.
To integrate this API call the method validateOfferDetails and pass the requestData as parameters as shown in the code snippet below:
List<String> offerKey = new ArrayList<>();
offerKey.add("<pass the offer key>");
PaymentDetailsForOffer paymentDetailsForOffer = new PaymentDetailsForOffer.Builder().setPaymentCode("CC").setCardNumber("5123456789012346").setCategory("CREDITCARD").build();
UserDetailsForOffer userDetailsForOffer = new UserDetailsForOffer.Builder().setUserToken("56789067890").build();
payuConfig = new PayuConfig();
payuConfig.setEnvironment(PayuConstants.STAGING_ENV);
V2ApiTask v2ApiTask = new V2ApiTask(merchantKey, payuConfig);
ValidateOfferRequest validateOfferRequest = new ValidateOfferRequest.Builder().setAmount("100.00").setOfferKey(offerKey).setPaymentDetails(paymentDetailsForOffer).setuserDetails(userDetailsForOffer).setAutoApply(false).build();
v2ApiTask.validateOffers(validateOfferRequest, new HashGenerationListener() {
@Override
public void generateSignature(HashMap<String, String> hashMap, HashCompletionListener hashCompletionListener) {
String hashName = hashMap.get(PayuConstants.CP_HASH_NAME);
String hashData = hashMap.get(PayuConstants.CP_HASH_STRING);
Log.d(TAG, "generateSignature: " + hashName);
Log.d(TAG, "generateSignature: " + hashData);
String hash = HashGenerationUtils.generateHashFromSDK(hashData, salt);
HashMap hashMap1 = new HashMap();
hashMap1.put(hashName, hash);
hashCompletionListener.onSignatureGenerated(hashMap1); // If you are passing wrong Hash then you will get null response
}
}, new ValidateOfferApiListener() {
@Override
public void onValiDateOfferResponse(PayuResponse payuResponse) {
Log.d(TAG, "onValiDateOfferResponse: " + payuResponse.getRawResponse());
}
});
CheckBalance API
This can be used to fetch detail of the Sodexo card with the source ID:
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey(merchantKey);
merchantWebService.setCommand(PayuConstants.CHECK_BALANCE);
merchantWebService.setVar1(sodexoSourceId); // This parameter must contain the Sodexo Source ID
merchantWebService.setHash(HashGenerationUtils.generateHashFromSDK(hashData, salt));
@Override
public void onCheckBalanceResponse(PayuResponse payuResponse) {
Log.d(TAG, "onCheckBalanceResponse: " + payuResponse.getRawResponse());
}
Tokenized Payment
You can store and get stored card details from the vault.
Get Tokenized Stored Cards
This API is helpful in getting all the stored cards for a particular user. For this API, you need to set theuserCredentials
in the payment params similar to the following:
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey("<pass the merchant key>");
merchantWebService.setCommand(PayuConstants.GET_TOKENISED_USER_CARD);
merchantWebService.setVar1(user_credentials); //In var1, pass the user_credential
merchantWebService.setHash("<pass the hash value>");
To integrate this API call the getTokenizedStoredCards method similar to the following:
@Override
public void onGetTokenisedCardResponse(PayuResponse payuResponse) {
}
Get Tokenized Stored Card Details
Get details of the stored card to make payment on another PG.
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey("<pass the merchant key>");
merchantWebService.setCommand(PayuConstants.GET_TOKENISED_CARD_DETAILS);
merchantWebService.setVar1("<user_credentials>"); //In var1, pass the user_credential
merchantWebService.setVar2("<cardToken>"); //In var2, pass the cardToken to get the saved card details
merchantWebService.setHash("<pass the hash value>");
@Override
public void onTokenisedCardDetailsResponse(PayuResponse payuResponse) {
}
Delete Tokenized stored cards
This API is helpful in deleting stored cards.
MerchantWebService merchantWebService = new MerchantWebService();
merchantWebService.setKey("<pass the merchant key>");
merchantWebService.setCommand(PayuConstants.DELETE_TOKENISED_USER_CARD);
merchantWebService.setVar1("<user_credentials>"); //In var1, pass the user_credential
merchantWebService.setVar2("<cardToken>"); //In var2, pass the cardToken to delete the saved card details
merchantWebService.setHash("<pass the hash value>");
To integrate this API call the deleteTokenizedStoredCard method similar to the following:
@Override
public void onDeleteTokenisedCardResponse(PayuResponse payuResponse) {
}
Updated 3 months ago