Generate Hash

The CheckoutPro SDK requires two types of hashes:

  • Static Hashes (Mandatory) – These hashes can be passed to SDK during integration and do not change between transactions.
  • Dynamic Hashes (Mandatory) – These hashes must be generated at runtime for each transaction and will vary based on the transaction parameters.

Static Hashes

The following table describes all static hashes:

Hash NameDescriptionHash Formula
payment_related_ details_for_mobile_sdkIt is used to fetch enabled payment options. If not passed, checkout screen will not appear.<key>|payment_related_details_for_mobile_sdk|<userCredential>|<salt>
eligibleBinsForEMIIt is used to fetch the eligible bins for EMI when EMI is enabled. If not passed, EMI payment will not work.<key>|eligibleBinsForEMI|default|<salt>
getEmiAmount AccordingToInterestIt is used to fetch EMI details like, amount, interest rate, etc when EMI is enabled. If not passed, EMI payment will not work.<key>|vas_for_mobile_sdk|<amount>|<salt>
PaymentIt is used for making payment. If not passed, payment will not happen.`|||||||||||||`
delete_payment_instrumentIt is used to delete the Tokenised card<key>|delete_payment_instrument|<userCredential| <salt>
get_payment_instrumentIt is used to get all stored tokenised cards<key> |get_payment_instrument|<userCredential|<salt>
get_payment_detailsIt is used to get the payment details of an existing card stored on PayU Vault so that you can use it with third-party tokenisation|get_payment_details|<userCredential|

After setting the values in the above formula, generate sha512 over it and pass the same in additional parameters

For SI Payment

Payment hash is calculated with the following formula for SI transaction:

SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||si_details|SALT)

Example

SHA512(<Your Test Env. Key>|fa3359f205d621c07383|2|Product Info|Payu-Admin|[email protected]|||||||||||{"billingAmount": "150.00","billingCurrency": "INR","billingCycle": "WEEKLY","billingInterval": 1,"paymentStartDate": "2019-09-18","paymentEndDate": "2020-10-20"}|dEvD9ABD)

Free Trail Transaction

For free trial transactions, free trial value should be used in hash calculation as follows:

SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10|si_details|free_trial|SALT)

Example

SHA512(<Your Test Env. Key>|fa3359f205d621c07383|2|Product Info|Payu-Admin|[email protected]|||||||||||{"billingAmount": "150.00","billingCurrency": "INR","billingCycle": "WEEKLY","billingInterval": 1,"paymentStartDate": "2019-09-18","paymentEndDate": "2020-10-20"}|1|<Please_add_salt_here>)  

Dynamic Hashes

For passing dynamic hashes, you will receive a call on the generateHash method of PayUCheckoutProListener.

In the method parameter, you will receive a dictionary or hashMap, extract the value of hashString from that. Pass that value to the server, and now the server will append salt at the end and generate sha512 hash over it. The server will give that hash back to your app, and the app will provide that hash to PayU through a callback mechanism.

There is no need to know the formula for dynamic hashes because PayU SDK gives you the string containing all the required parameters. Your server has to append salt at the end and generate sha512 hash over it.

The following table provides the list of dynamic hashes:

Hash NameDescription
getBinInfoIt is used to fetch Bin details. If not passed, card payments will not happen. For more info refer to: GetBinInfo
get_eligible_payment
_options
It is used when verifying Phone number in OlaMoney Section. If not passed, phone number will not be verified and hence user will not be able to proceed. For more info refer to: get_eligible_payment_options
validateVPAIt is used for validating VPA on UPI Collect screen. If not passed, VPA will not be verified and hence user will not be able to proceed. For more info refer to: VPA Validation
get_checkout_detailsIt is used to get detail of additional charges, down status, tax info, offer.
lookup api hashIt is used to fetch the Multi Currency Conversion details. This is used in MCP Integration.
Note: You need to calculate HMAC-SHA1 instead of SHA512 only for this hash.
checkBalanceApiHashIt is used to get sodexocard detail.
postSaltIt is required to split payment during transaction

V2 Hashes

For passing V2 dynamic hashes, you will receive a call on the generateHash method of PayUCheckoutProListener.

In the method parameter, you will receive a dictionary or hashMap, and extract the value of hashString and hashType from that. if hashType is “V2” Pass that value to the server, and now the server generate sha256 hash with salt as key and hashString as signedString over it. The server will give that hash back to your app, and the app will provide that hash to PayU through a callback mechanism.