Integrate with PayU Hosted Checkout
With the PayU Hosted Checkout integration, the entire payment experience is controlled by PayU. The following sections describe how to use the PayU Hosted Integration to collect payments with various types of offers:
General customer journey
-
Customer clicks Pay on your mobile application or website.
-
Customer is redirected to the PayU Hosted Checkout page.
The PayU Hosted Checkout page on Desktop is similar to the following screenshot. In case offer keys have been passed by the merchant, the same would be filtered and displayed to the customer.
The PayU Hosted Checkout page on Mobile is similar to the following screenshot:
- Customer is shown the applicable offers on the checkout page for that transaction.
- Customer will have an option to apply the offer. If the offer is applicable on a specific payment option, the customer will be redirected to the specific payment option.
The PayU Hosted Checkout page for specify payment option on Mobile is similar to the following screenshot:
- Alternatively, the customer can choose the payment option. If only an offer is applicable for that payment option, the offer will be automatically applied.
- For Instant Discount, the amount is reduced after the offer is applied, whereas, in the case of cashback, the amount will not be reduced after the offer is applied.
- Customer completes the 2FA payment on the adjusted amount.
- Customer is redirected back to the merchant mobile application or website.
Instant Discount or Cashback
With the PayU Hosted Checkout integration, the entire payment experience is controlled by PayU. This section describes how to use the PayU Hosted Integration to collect payments with offers.
Customer journey on PayU Hosted Checkout
-
Customer clicks Pay on your mobile application or website.
-
Customer is redirected to the PayU Hosted Checkout page.
The PayU Hosted Checkout page on Desktop is similar to the following screenshot. In case offer keys have been passed by the merchant, the same would be filtered and displayed to the customer.
The PayU Hosted Checkout page on Mobile is similar to the following screenshot:
- Customer is shown the applicable offers on the checkout page for that transaction.
- Customer will have the option to apply the offer. If the offer is applicable to a specific payment option, the customer will be redirected to the specific payment option.
The PayU Hosted Checkout page for specific payment option on Mobile is similar to the following screenshot:
- Alternatively, the customer can choose the payment option. If only an offer is applicable for that payment option, the offer will be automatically applied.
- For Instant Discount, the amount is reduced after the offer is applied, whereas, in the case of cashback, the amount will not be reduced after the offer is applied.
- Customer completes the 2FA payment on the adjusted amount.
- Customer is redirected back to the merchantβs mobile application or website.
Integration steps
To integrate offers using PayU Hosted Checkout integration:
Reference:
For the PayU Hosted Checkout flow, refer to PayU Hosted Checkout.
-
Make the payment request to PayU:
You need to send an additional parameter (user token), api_version as 14, and hash as described in the following table. This user token would be used to identify the customer for applying velocity rules.
Parameter | Description | Example |
---|---|---|
api_version mandatory | The API version of the _payment API must be specified as 14. | 14 |
user_token mandatory for UPI, NB, Wallet | The use for this param is to allow the offer engine to apply velocity rules at a user level. - Card Based OffersΒ (CC, DC, EMI): In case of card payment mode offers, if this parameter is passed the velocity rules would be applied on this token, if not passed the same would be applied on the card number. - UPI, NB, Wallet: It is mandatory for UPI, NB, and Wallet payment modes. If not passed the validation rules would not apply. | |
hash mandatory | It is used to avoid the possibility of transaction tampering. Note: The following order must be used for hashing: key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10|offer_key|offer_auto_apply|SALT For more information on hash generation process, refer to Generate Hash . |
-
Check the response from PayU.
You need to understand the following parameters to handle the payment response as the net amount debit may be different from the amount sent by you in the request.
Parameter | Description | Example |
---|---|---|
discount | This will specify the offer value provided to the user. | 10.00 |
net_amount_debit | This will specify the actual amount deducted from the customerβs payment instrument. In case of Instant discount this amount would be lesser than the amount passed by you in the request. | 100.00 |
offer | This parameter is used to post the offer key. | newoffer1@5686 |
offer_type | This parameter is used to post any of the following offer_type: - instant - cashback | instant |
-
Verify the payment.
Similar to the payment response, the same parameters can be handled as part of the verify_payment API. For more information, refer to Verify Payment API,
Parameter | Description | Example |
---|---|---|
transaction_amount | This parameter contains the total transaction amount before discount. | 50000.00 |
net_amount_debit | This parameter contains the actual amount deducted from the customerβs payment instrument. In case of Instant discount this amount would be lesser than the amount passed by you in the request. | 47500.00 |
discount | This parameter contains the offer value provided to the user. This value will specify the offer amount for both Instant discount and Cashback offers. | 2500.00 |
For the sample request and response from PayU, refer to Collect Payment API - PayU Hosted Checkout.
- If you want to refund the payment to customer. refer to Refund APIs.
PayU would refund the exact amount passed by you in the Refund request. For more information, refer to Refunds for Offers.Β
Note:
You can enable the Enforce Offer flag by requesting your PayU Key Account Manager. If you enable the Enforce Offer flag, all the offers passed are visible to the customer and the customer chooses an offer that they wish to apply.
SKU-Based offer
After you create an SKU-based offer on PayU Dashboard, you can start collecting payments for products with an SKU-based offer.
This section describes the customer workflow with an SKU-based offer on the PayU Payment page when redirected from your website for payment and request parameters for the _payment API to collect payments with an SKU-Based Offer.
Note:
For payment journey of instant discount offers using Redirection Flow or PayU Hosted Checkout, refer to Integrate with PayU Hosted Checkout.
Customer journey
After your customer selects the items from your website (for example, mobile online shopping), the customer is redirected to the PayU page for payment and involves the following steps:
- Select Offers at the top-right corner.
All the offers for the products in the shopping cart (if any) are listed.
-
Select the Product Offers tab.
The Product Offers tab is displayed on the Offer & Discount page.
-
Apply an offer using the Use Offer button for the offer you wish to apply.
The Offer Applied! pop-up page is displayed.
-
Click Thanks.
The page to collect your credit card details is displayed.
- Click Proceed to make payment and then enter the OTP sent by bank to your mobile to complete the purchase.
- Close this page to return back to the merchant website.
Integration steps
Step 1: Post request parameters
Additional request parameters for SKU-Based Offer
The following request parameters are posted along with request parameters posted for a PayU Hosted Checkout transaction. For the checkout flow and list of request parameters required for the Offer integration, refer to Collect Payment API - PayU Hosted Checkout.
Field | Description |
---|---|
cart_details mandatory for SKU | JSON Object The card details is specified in this parameter in a JSON format. Note: If given null, no cart will be created for the transaction. |
cart_details.amount mandatory | String The amount for the SKU-based offer. |
cart_details.surcharges conditional | String Total txn amount is now increased, but the cart_details.amount is lesser, to handle the difference, the additonal amount added by the merchant should be passed in surcharges field |
cart_details.pre_discount conditional | String If there are any pre discount given by merchant on their checkout page. Total txn amount is now reduced, but the cart_details.amount is higher, to handle the difference, the discount given by the merchant should be passed in pre_discount field |
cart_details.items mandatory | String The number of the items for the SKU-based offer. |
cart_details.sku_details mandatory | JSON Object The SKU details is specified in this parameter in a JSON format. |
cart_details.sku_details.sku_id mandatory | String This parameter contains the unique identifier for SKU. Note: The Product ID in the Excel file as described in the Create a SKU-Based Offer section and the skuId request parameter used in the Merchant Hosted Checkout Integration for SKU-based offer have the same function, Hence, after you create Product IDs on Dashboard, use them as values for the skuId parameter. |
sku_details.sku_name mandatory | String This parameter contains the SKU name. |
sku_details.quantity mandatory | String The parameter must contain the quantity of SKU added in cart. |
sku_details.amount_per_sku mandatory | String The parameter must contain the per SKU amount. |
sku_details.offer_key mandatory | String This parameter must contain the Offer Key(s) which can be used for this transaction. | |
sku_details.offer_auto_apply mandatory | _String_This parameter contains the flag for when to enable auto application of best offer on this SKU. |
cart_details object in sample request
"cart_details": {
"amount": 55000,
"items": 2,
"surcharges": 10,
"pre_discount": 5,
"sku_details": [
{
"sku_id": "smartphone234",
"sku_name": "Smartphone",
"amount_per_sku": "45000",
"quantity": 1,
"offer_key": null,
"offer_auto_apply": true
},
{
"sku_id": "smartwatch132",
"sku_name": "Smartwatch",
"amount_per_sku": "10000",
"quantity": 1,
"offer_key": [
"flat500@2022"
],
"offer_auto_apply": false
}
]
}
Step 2: Check the PayU response
Success scenario
The cart_details JSON Object in the response (sample):
{"cart_details": {
"id": "18",
"payu_id": "999000000000983",
"total_items": "2",
"total_cart_amount": "55000",
"offer_applied": null,
"offer_availed": null,
"instant_discount": "1000",
"cashback_discount": "500",
"total_discount": "1500",
"net_cart_amount": "54000",
"created_at": null,
"updated_at": null,
"sku_details": [
{
"id": "35",
"cart_id": "18",
"payu_id": "999000000000983",
"mid": "180012",
"sku_id": "smartphone234",
"sku_name": "Smartphone",
"amount_per_sku": "45000.00",
"quantity": "1",
"amount_before_discount": "45000",
"discount": "1000",
"amount_after_discount": "44000",
"offer_key": null,
"offer_status": null,
"offer_type": null,
"created_at": null,
"updated_at": null
},
{
"id": "36",
"cart_id": "18",
"payu_id": "999000000000983",
"mid": "180012",
"sku_id": "smartwatch132",
"sku_name": "Smartwatch",
"amount_per_sku": "10000.00",
"quantity": "1",
"amount_before_discount": "10000.00",
"discount": "500",
"amount_after_discount": "10000.00",
"offer_key": null,
"offer_status": null,
"offer_type": null,
"created_at": null,
"updated_at": null
}
]
}}
Failure scenarios
For a list of error messages for the failure scenarios, refer toΒ Error Codes for Offers Integration.
Step 3: Verify Payment
Verify the payment using the Verify Payment API. For more information, For API reference, refer to Verify Payment API. For the sample response using the Verify Payment API from PayU involving offers, refer to Additional Info for General APIsI.
Updated about 1 month ago