synclovisdevs / react-native-payu

PayUMoney Library for react-native by using native SDK
MIT License
2 stars 2 forks source link

Hash value mismatch in iOS #1

Closed Sneha1231 closed 3 years ago

Sneha1231 commented 3 years ago

Hi, While stating payment in iOS getting hash value mismatch alert. It is working fine in android. I am creating hash values at server side and passing the same to the startPayment. Screenshot 2021-04-12 at 4 07 56 PM

sanmish16 commented 3 years ago

Hi @Sneha1231,

Please try PayU.getHash function and try to match that hash code with your server hash code. If it's not matching then check how you are generating hashcode in your server end.

Sneha1231 commented 3 years ago

@sanmish16 I checked that and it is same as the server one

sanmish16 commented 3 years ago

@Sneha1231 please share the data you are passing with PayU.startPayment except key and salt

Sneha1231 commented 3 years ago

@sanmish16 {"amount": "200", "email": "", "failedUrl": "", "firstName": "", "hash": "", "isSandbox": true, "key": "", "merchantId": "", "phone": "", "productName": "*", "successUrl": "*", "txnId": ""} , These are the parameters we passing to startPayment. I couldn't share the values since it is confidential.

sanmish16 commented 3 years ago

@Sneha1231 to generate hash in server u have to pass all the data in the same order including udf1 to udf10 (is not available pass it as the empty string). You can use the below function

function payUHash(payUData){ const hashString = ${payUData.key}|${payUData.txnId}|${payUData.amount}|${payUData.productName}|${payUData.firstName}|${payUData.email}|${payUData.udf1}|${payUData.udf2}|${payUData.udf3}|${payUData.udf4}|${payUData.udf5}|${payUData.udf6}|${payUData.udf7}|${payUData.udf8}|${payUData.udf9}|${payUData.udf10}|${payUData.salt}; //In case you are not passing udf values then set it as empty string return sha512(hashString); }

Sneha1231 commented 3 years ago

@sanmish16 We are using the same format and it is working fine for android. Only facing the issue in iOS. Is there any additional set up we need to do apart from "pod install" command. My react-native version is 0.62.2 and iOS 14.2

sanmish16 commented 3 years ago

Add the following line in your Podfile and run pod install

pod 'react-native-payu', :path => '../node_modules/react-native-payu'` pod 'PayUmoney_PnP'

I guess pod 'PayUmoney_PnP' is missing

Sneha1231 commented 3 years ago

Add the following line in your Podfile and run pod install

pod 'react-native-payu', :path => '../node_modules/react-native-payu'` pod 'PayUmoney_PnP'

I guess pod 'PayUmoney_PnP' is missing

@sanmish16 Are there steps for version <= 0.59 ?. Mine is .62. I tried adding the same and ran pod install. still getting the issue.

sanmish16 commented 3 years ago

pod 'PayUmoney_PnP' you have to add manually in your podfile

Sneha1231 commented 3 years ago

pod 'PayUmoney_PnP' you have to add manually in your podfile

@sanmish16 Should I be mentioning any path for this

sanmish16 commented 3 years ago

no need to mention any path just add it like

pod 'PayUmoney_PnP'

Sneha1231 commented 3 years ago

no need to mention any path just add it like

pod 'PayUmoney_PnP'

Added and executed pod install. Still getting the issue

sanmish16 commented 3 years ago

After doing pod install, clean & build your project. If it still not working then please try with sample data provided with library and let me know if it works.

Sneha1231 commented 3 years ago

@sanmish16 Looks like issue is with the email id we are using. For testing purpose we are reusing the existing mail id by appending "+" followed by random numbers(eg: "sneha1231+1@gmail.com"). Issue is happening with these accounts. The mail id without these alternations are working fine. But in android this is not making any issue and we are allowed to do payment. Could you please provide some insight on this.

sanmish16 commented 3 years ago

@Sneha1231 I guess if the email id is not valid then it should not work in both android & iOS. But like you said it's working in android then I guess it's because of some extra validation happening in iOS from payU end.

I guess your issue is resolved. SO, I am closing it.