payu-intrepos / PayUMoney-IOS-SDK

Easy to integrate SDK for iOS to facilitate fast mobile checkout
https://www.payumoney.com/
MIT License
11 stars 21 forks source link

Hash mismatch: iOS 13 xcode 11 #49

Closed bhushanbafana closed 5 years ago

bhushanbafana commented 5 years ago

Hi, I am getting error hash mismatch in iOS 13 while doing payment, its working properly in iOS 12.
i also attached screenshot, please check the issue. Error_ScreenShot

arshabhullar commented 4 years ago

did you find the solution?

bhushanbafana commented 4 years ago

yes, actually I was generating hash key on app side and on Xcode 11, while generating hash key it was adding some extra hash text so I asked to there tech support team they recommend to generate the Hash key on server side so it will not create any problem.

arshabhullar commented 4 years ago

Sir, how can i get a hash from server.

bhushanbafana commented 4 years ago

From your Backend team u need to tell them to create hash as per Payu team has given format Format for Hash or Checksum - key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt I have refer there document https://www.payumoney.com/pdf/PayUMoney-Technical-Integration-Document.pdf

arshabhullar commented 4 years ago

May you live long. 🙏🏻

davinderkumar commented 4 years ago

I am also getting this error. I am just compiling the SDK code with my key / salt, and error is showing up. I compared the SHA512 generated by app and php (using online utilities) it is same. I also changed

NSString *hashSequence = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@",txnParam.key,txnParam.txnID,txnParam.amount,txnParam.productInfo,txnParam.firstname,txnParam.email,txnParam.udf1,txnParam.udf2,txnParam.udf3,txnParam.udf4,txnParam.udf5,txnParam.udf6,txnParam.udf7,txnParam.udf8,txnParam.udf9,txnParam.udf10,salt];

to

NSString *hashSequence = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@||||||%@",txnParam.key,txnParam.txnID,txnParam.amount,txnParam.productInfo,txnParam.firstname,txnParam.email,txnParam.udf1,txnParam.udf2,txnParam.udf3,txnParam.udf4,txnParam.udf5,salt];

to avoid any extra space in udf6-udf10 but no success.

I'm on Xcode 13.

arshbhullar commented 4 years ago

I was finally able to properly integrate after reading this article https://www.google.co.in/amp/s/www.knowband.com/blog/mobile-app/payu-integration-ios-using-swift/amp/

Hope it helps you too.

umangarya336 commented 4 years ago

I am also getting this error. I am just compiling the SDK code with my key / salt, and error is showing up. I compared the SHA512 generated by app and php (using online utilities) it is same. I also changed

NSString *hashSequence = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@",txnParam.key,txnParam.txnID,txnParam.amount,txnParam.productInfo,txnParam.firstname,txnParam.email,txnParam.udf1,txnParam.udf2,txnParam.udf3,txnParam.udf4,txnParam.udf5,txnParam.udf6,txnParam.udf7,txnParam.udf8,txnParam.udf9,txnParam.udf10,salt];

to

NSString *hashSequence = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@||||||%@",txnParam.key,txnParam.txnID,txnParam.amount,txnParam.productInfo,txnParam.firstname,txnParam.email,txnParam.udf1,txnParam.udf2,txnParam.udf3,txnParam.udf4,txnParam.udf5,salt];

to avoid any extra space in udf6-udf10 but no success.

I'm on Xcode 13.

We strongly recommend to generate hash from server reason behind this is, If your app gets compromised than your salt will also get compromised and attacker can misuse your app. Hash generation from app is only for testing purpose.

davinderkumar commented 4 years ago

Agree but code does not work although hash is same.