Create SKU Based Offers for Android Checkout Pro

PayU allows merchants to create offers for specific Products/SKUs in the cart and for whole cart. SKU offers will be shown only when the specific product is added by the user and hence can be used by the merchant to promote specific products.

Create an offer on dashboard

  1. Merchant Creates offers on dashboard. For SKU offers they need to provide product details with skuid, sku price range.
  2. Merchant pass these sku details and user token when he initialising CheckoutPro SDK.
  3. SDK fetch offers from PayU Server and show list of offers.
  4. User can select any offer and can see the benefit (instant/ cashback) of offer.
  5. If user did not select any offer we will auto apply best offer.
  6. User can pay offered amount and can avail offers.

Steps to integrate

  1. Step 1: Update depencies
  2. Step 2: Initialise the SDK
  3. Step 3: Create SKU Details
  4. Step 4: Set SKU Details
  5. Step 5: Generate Hash

Step 1: Update dependencies

Add below dependency in your app level gradle file.

implementation 'in.payu:payu-checkout-pro:2.2.1'

Step 2: Initialise the SDK


Make sure you integrate with CheckoutPro SDK for Android

Refer to Android CheckoutPro Integration Steps integrate Checkout Pro in App.

Step 3: Create SKU Details

Initalise Object of SKU details with vaild SKU’s.

SkuDetails: It contains below properties
SkuDetails(val skus: List<SKU>)
skus: "<ArrayList of SKU>"

    val quantity: Int,
    val skuAmount: String,
    val skuId: String,
    val skuName: String,
    var offerKeys:ArrayList<String>?=null

skuId: "<Product Id which you use when creating offer on dashboard >"
skuName: "<Name of product>"
skuAmount: "<Amount of product>"
quantity: "<total quantity of product>"
offerKeys: "<Optional - Provide offer keys only if want to restrict offer for mention products, else set null>"


Step 4: Set SKU Details

Create list of SKU as per products added in cart and add this list in SKU details. and set sku detials to PayUPaymentParams.

        .setIsProduction(<Boolean>)  //set is to true for Production and false for UAT
        .setSurl(<String>) //Pass your own surl your
        .setFurl(<String>) //Pass your own furl your
        .setUserCredential(<String>) // Optional, 
        .setPayUSIParams(<SiDetails>)// only for SI transaction
        .setSkuDetails(<SkuDetails>) // create SKU Details as mention above
        .setUserToken(<String>) // compulsory to fetch offer


Keep in mind

if we are adding details of SKU offers, the amount passed in PayUPaymentParam must be equal to the sum of quantities * skuAmount of each item.

Step 5: Generate Hash

This integration requires dynamic hashes. We will get hash string in map again CP_HASH_STRING key in generateHash. We need to send this string to server and append salt there, after appending salt convert string to sha512 hash and return back to sdk.

public void generateHash(@NotNull HashMap map, @NotNull PayUHashGenerationListener hashGenerationListener) {