Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error : "Invalid Hash." #28

Open
dhaval951 opened this issue Jan 9, 2024 · 1 comment
Open

getting error : "Invalid Hash." #28

dhaval951 opened this issue Jan 9, 2024 · 1 comment

Comments

@dhaval951
Copy link

dhaval951 commented Jan 9, 2024

on delegate method of PayUCheckoutProDelegate:
-> func onError(_ error: Error?) :

Error Domain=com.payu.PayUCheckoutPro Code=9999 "Invalid Hash." UserInfo={NSLocalizedDescription=Invalid Hash. IOS

in

func generateHash(for param: DictOfString, onCompletion: @escaping PayUHashGenerationCompletion) {
print("generateHash param\n (param) )")

    let commandName = (param[HashConstant.hashName] ?? "")
    let hashStringWithoutSalt = (param[HashConstant.hashString] ?? "")
    let postSalt = param[HashConstant.postSalt]
    // get hash for "commandName" from server
    // get hash for "hashStringWithoutSalt" from server

    // After fetching hash set its value in below variable "hashValue"
    var hashValue = ""
    if commandName == HashConstant.mcpLookup {
        hashValue = "<hmacsha1 hash for hashStringWithoutSalt and secret>"
    } else if let postSalt = postSalt {
        let hashString = hashStringWithoutSalt + (saltTextField.text ?? "") + postSalt
        hashValue = "<hmacsha512 hash for hashStringWithoutSalt and secret>"
    } else {
        hashValue = "<hmacsha512 hash for hashStringWithoutSalt and salt>"
    }
    print("hashValue is :\n\(hashValue) )")

    onCompletion([commandName: hashValue])
}

Like got console details is : 

generateHash param

["hashString": "{"phone":"9876543210","userToken":"","amount":"1"}|Tue, 09 Jan 2024 04:19:38|", "hashName": "fetch_quick_pay_option"] )
hashValue is :
)

Please provide me solution of this "Invalid Hash."

@umangarya336 Please help me

@ShubhGar
Copy link
Contributor

@dhaval951 You need to append salt and then convert it to SHA512 hash on your server. please connect with [email protected]. And for security reason please delete all the data, you provided in your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants