GetCheckoutDetails API

As mentioned in table, it provides information of additionalCharges, bank down status , tax info and offers 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":"1614595430980",
   "transactionDetails":{
      "amount":5000
   },
    "customerDetails": {
      // optional
      "mobile": "9999999999", // optional
    },
   "useCase":{
      "getAdditionalCharges":true,
      "getTaxSpecification":true,
      "checkDownStatus":true,
      "getExtendedPaymentDetails":true,
      "getOfferDetails":true
   }
}

here, requestId is a random unique number passed in request

Creating var1 for GetCheckoutDetails API

SDK has a Utility class to create a JSON as above. Refer code below

  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 command as PayuConstants.GET_CHECKOUT_DETAILS here . Follow the steps of making a Web Service call.

Getting API response

PayuResponse is received in onCheckoutDetailsResponse() callback method of CheckoutDetailsListener as mentioned in table

Getting Additional Charges, Bank Down Status and Offers

Additional Charges are return in PaymentDetails object for each payment option. Refer below example for fetching Additional Charges for NetBanking

//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 paymentDetails.getAdditionalCharge() method

In Similar way bank down is available inside each PaymentDetails object and can be accessed using paymentDetails.isBankDown() method

For Offers, An ArrayList<PayuOffer> is available inside each PaymentDetails object and to use it , paymentDetails.getOfferDetailsList()

Getting Tax Info

Tax is not applied on individual NetBanks or card schemes but instead applied on Payment Mode level like for all CC,DC, NB, Wallets, etc. So, to fetch the Tax Specification use below code

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
...

Last updated