Generate Dynamic Hash

The dynamic hashes must be generated at runtime for each transaction and will vary based on the transaction parameters.

📘

Hashing logic for SDK and Web Integration is different

For the hashing logic for web integration, refer to Generate Hash.

Recommended workflow for Dynamic Hashing

  1. Checkout Pro SDK will generate hash like generateHash(Map<String, String> hashMap). PayUHashGenerationResult method is called with the prepared map.
  2. Merchant App will:
    • Extract values for keys PayUCheckoutProConstants.CP_HASH_NAME and PayUCheckoutProConstants.CP_HASH_STRING from the hashmap received in the generateHash() method.
    • Pass this hash string to your server (Merchant Server) for hash calculation.
  3. Merchant Server will append the hash string that was received with a salt at the end to form a pipe-separated string.
  4. Merchant Server will generate a SHA-512 hash from this string.
  5. Merchant App will:
    • Prepare a map with the key as the value of PayUCheckoutProConstants.CP_HASH_NAME received in step 2 and its value as the hash received in Step 3.
    • Send this map instead of PayUHashGenerationResult that was received in Step 1.

Procedure

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