Set up the payment hashes
(Mandatory Step)
Passing static hashes
paymentParam.additionalParam[HashConstant.paymentRelatedDetailForMobileSDK] = <#T##String#>
paymentParam.additionalParam[HashConstant.vasForMobileSDK] = <#T##String#>
paymentParam.additionalParam[HashConstant.getEmiAmountAccordingToInterest] = <#T##String#>
paymentParam.additionalParam[HashConstant.eligibleBinsForEMI] = <#T##String#>
paymentParam.additionalParam[HashConstant.deleteUserCard] = <#T##String#>
paymentParam.additionalParam[HashConstant.payment] = <#T##String#>
paymentParam.additionalParam = [[NSDictionary alloc] initWithObjectsAndKeys:
<#(NSString)#>, HashConstant.paymentRelatedDetailForMobileSDK,
<#(NSString)#>, HashConstant.vasForMobileSDK,
<#(NSString)#>, HashConstant.getEmiAmountAccordingToInterest,
<#(NSString)#>, HashConstant.eligibleBinsForEMI,
<#(NSString)#>, HashConstant.deleteUserCard,
<#(NSString)#>, HashConstant.payment,
nil];Passing dynamic hashes
/// Use this function to provide hashes
/// - Parameters:
/// - param: Dictionary that contains key as HashConstant.hashName & HashConstant.hashString
/// - onCompletion: Once you fetch the hash from server, pass that hash with key as param[HashConstant.hashName]
func generateHash(for param: DictOfString, onCompletion: @escaping PayUHashGenerationCompletion) {
// Send this string to your backend and append the salt at the end and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
let hashStringWithoutSalt = param[HashConstant.hashString] ?? ""
// Or you can send below string hashName to your backend and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
let hashName = param[HashConstant.hashName] ?? ""
// Set the hash in below string which is fetched from your server
let hashFetchedFromServer = <#T##String#>
onCompletion([hashName : hashFetchedFromServer])
}/// Use this function to provide hashes
/// @param param NSDictionary that contains key as HashConstant.hashName & HashConstant.hashString
/// @param onCompletion Once you fetch the hash from server, pass that hash with key as param[HashConstant.hashName]
- (void)generateHashFor:(NSDictionary<NSString *, NSString *> * _Nonnull)param onCompletion:(void (^ _Nonnull)(NSDictionary<NSString *, NSString *> * _Nonnull))onCompletion {
// Send below string hashStringWithoutSalt to your backend and append the salt at the end and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
NSString *hashStringWithoutSalt = [param objectForKey:HashConstant.hashString];
// Or you can send below string hashName to your backend and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
NSString * hashName = [param objectForKey:HashConstant.hashName];
// Set the hash in below string which is fetched from your server
NSString *hashFetchedFromServer = <#(NSString)#>;
NSDictionary *hashResponseDict = [NSDictionary dictionaryWithObjectsAndKeys:hashFetchedFromServer, hashName, nil];
onCompletion(hashResponseDict);
}Getting Hash Data to calculate hash
Passing generated hash to SDK
Last updated