There are 2 different methods to implement Additional Charges on PayU which are as follows :
Method 1: Enabled from backend at PayU
The merchant would be posting the transaction amount of the product in the transaction request.
1 . Once the customer lands on PayU payment page and clicks on 'Pay Now' option, the additional amount would be added to the amount of the product by PayU (based upon the TDR values) and the total amount would be passed on to the bank’s page while re-directing.
2 . After PayU receives the status of transaction from the bank, it sends the response of back to the merchant. In this response, the amount and additional amount can be differentiated with the below parameters. Original Transaction Amount - amount Additional Amount - additionalCharges
3 . Once you receive the response from PayU, you need to check for reverse hash. If you are verifying the reverse hash at your end (which is strictly recommended to avoid any tamper cases), its formula will also change in case additionalCharges value is sent.
Here, if the additionalCharges parameter is posted in the transaction response, then hash formula is:
4 . If additionalCharges parameter is not posted in the transaction response, then hash formula is the generic reverse hash formula:
Method 2: Merchant Calculates and Posts Additional Charges to PayU
1 . The merchant would be posting both the transaction amount and additional charges in the transaction request. The parameters used for these are amount and additional_charges respectively. The way to pass the additional_charges parameter is as below:
:< additional charge value>, < bankcode2> :< additional charge value> Example: CC:12,AMEX:19,SBIB:98,DINR:2,DC:25,NB:55
2 . In this method of applying additional charges, hash sequence would be affected for both Pre-Transaction and Post-Transaction.
Pre-Transaction hash sequence:
Merchant needs to form the below hash sequence before posting the transaction to PayU:
Where additional_charges value would be same as the value posted in transaction request. For example, CC:12,AMEX:19,SBIB:98,DINR:2,DC:25,NB:55
3 . Now, once the transaction request hits PayU server and re-direction happens, the customer lands upon PayU payment page. Here, depending on the payment option selection by the customer, the additional charge value would be added to transaction amount. For example, for the above example, if the customer selects Credit Card, Rs 12 would be added to the transaction amount. If the customer selects AMEX option, Rs 19 would be added to the transaction amount. For SBI Net Banking, Rs 98 would be added to the transaction amount and so on. Please note that the additional charges would be added only once the customer clicks on 'Pay Now’ option.
4 . When PayU receives the response from Bank, a POST Response is sent to the merchant. Here also, the hash sequence needs to be changed.
Post-Transaction hash sequence:
Merchant needs to form the below hash sequence and verify it with the hash sent by PayU in the Post Response:
Where, additionalCharges value must be same as the value Posted from PayU to the merchant in the response.
This hash value must be compared with the hash value posted by PayU to the merchant. If both match, then only the order should be processed. If they don’t match, then the transaction has been tampered with by the user and hence should not be processed further.