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
- Checkout Pro SDK will generate hash like
generateHash(Map<String, String> hashMap).
PayUHashGenerationResult
method is called with the prepared map. - Merchant App will:
- Extract values for keys
PayUCheckoutProConstants.CP_HASH_NAME
andPayUCheckoutProConstants.CP_HASH_STRING
from the hashmap received in thegenerateHash()
method. - Pass this hash string to your server (Merchant Server) for hash calculation.
- Extract values for keys
- Merchant Server will append the hash string that was received with a salt at the end to form a pipe-separated string.
- Merchant Server will generate a SHA-512 hash from this string.
- 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.
- Prepare a map with the key as the value of
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 Name | Description |
---|---|
getBinInfo | It 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 |
validateVPA | It 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_details | It is used to get detail of additional charges, down status, tax info, offer. |
lookup api hash | It 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. |
checkBalanceApiHash | It is used to get sodexocard detail. |
postSalt | It 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.
Updated 3 months ago