Offers Integration
(Optional Step)
Follow this section if you want to integrate Offers in PayUCheckoutPro SDK

Create Offers List

Create a list of offers that you want to pass to the CheckoutPro SDK. For each offer in list, offer title, offer description, offer key and offer payment types need to be passed. On Checkout Page SDK will show the best offer applicable on that payment mode based on the offers list sent to the SDK. Below is an example code for offers list
Java
Kotlin
1
ArrayList<PayUOfferDetails> offerDetails = new ArrayList<>();
2
PayUOfferDetails payUOfferDetails1 = new PayUOfferDetails();
3
payUOfferDetails1.setOfferTitle("Instant discount of Rs.2");
4
payUOfferDetails1.setOfferDescription("Get Instant dicount of Rs.2 on all Credit and Debit card transactions");
5
payUOfferDetails1.setOfferKey("[email protected]");
6
7
ArrayList<PaymentType> offerPaymentTypes1 = new ArrayList<>();
8
offerPaymentTypes1.add(PaymentType.CARD);
9
payUOfferDetails1.setOfferPaymentTypes(offerPaymentTypes1);
10
11
PayUOfferDetails payUOfferDetails2 = new PayUOfferDetails();
12
payUOfferDetails2.setOfferTitle("Instant discount of Rs.2");
13
payUOfferDetails2.setOfferDescription("Get Instant dicount of Rs.2 on all NetBanking transactions");
14
payUOfferDetails2.setOfferKey("[email protected]");
15
16
ArrayList<PaymentType> offerPaymentTypes2 = new ArrayList<>();
17
offerPaymentTypes2.add(PaymentType.NB);
18
payUOfferDetails2.setOfferPaymentTypes(offerPaymentTypes2);
19
20
offerDetails.add(payUOfferDetails1);
21
offerDetails.add(payUOfferDetails2);
Copied!
1
val offerDetails = ArrayList<PayUOfferDetails>()
2
offerDetails.add(PayUOfferDetails().also {
3
it.offerTitle = " Instant discount of Rs.2"
4
it.offerDescription = "Get Instant dicount of Rs.2 on all Credit and Debit card transactions"
5
it.offerKey = "[email protected]"
6
it.offerPaymentTypes = ArrayList<PaymentType>().also {
7
it.add(PaymentType.CARD)
8
}
9
})
10
offerDetails.add(PayUOfferDetails().also {
11
it.offerTitle = " Instant discount of Rs.2"
12
it.offerDescription = "Get Instant dicount of Rs.2 on all NetBanking transactions"
13
it.offerKey = "[email protected]"
14
it.offerPaymentTypes = ArrayList<PaymentType>().also {
15
it.add(PaymentType.NB)
16
}
17
})
Copied!

Pass Offers List to SDK

To pass the Offers List created in above section to the SDK. Create a Object of PayUCheckoutProConfig and set Offers List as below
Java
Kotlin
1
PayUCheckoutProConfig checkoutProConfig = new PayUCheckoutProConfig();
2
checkoutProConfig.setOfferDetails(offerDetails);
Copied!
1
val checkoutProConfig = PayUCheckoutProConfig()
2
checkoutProConfig.offerDetails = offerDetails
Copied!
This checkoutProConfig object should be passed in PayUCheckoutPro.open() method as mentioned here
Last modified 7mo ago