payu-intrepos / payu-non-seamless-react

Non-Seamless SDK for React Native
5 stars 9 forks source link

how to under solve this? {"errorCode": "5019", "errorMsg": "Invalid Hash."} #44

Open jogi-gaurang opened 1 year ago

jogi-gaurang commented 1 year ago
var txnid = this.transactionId();
        var payUPaymentParams = {
            key: this.state.key,
            transactionId: txnid,
            amount: Data[0].price,
            productInfo: Data[0].title,
            firstName: this.User.data.first_name + this.User.data.last_name,
            email: this.User.data.email,
            phone: this.User.data.mobile_no,
            ios_surl: 'https://payu.herokuapp.com/success',
            ios_furl: 'https://payu.herokuapp.com/failure',
            android_surl: 'https://payu.herokuapp.com/success',
            android_furl: 'https://payu.herokuapp.com/failure',
            environment: '1',
            userCredential: this.state.key + ':' + this.User.data.id,
            additionalParam: {}
        }

        var payUCheckoutProConfig = {
            primaryColor: colors.primary,
            secondaryColor: '',
            merchantName: "sdk",
            merchantLogo: 'logo.png',
            showExitConfirmationOnCheckoutScreen: true,
            showExitConfirmationOnPaymentScreen: true,
            cartDetails: [],
            paymentModesOrder: [],
            surePayCount: 1,
            merchantResponseTimeout: 1000,
            autoSelectOtp: false,
            autoApprove: false,
            merchantSMSPermission: false,
            showCbToolbar: false,
        }

        return {
            payUPaymentParams: payUPaymentParams,
            payUCheckoutProConfig: payUCheckoutProConfig
        };

    generateHash(e) {
        var hashValue = e.hashString;
        var result = { [e.hashName]: hashValue };
        console.log(result)
        PayUBizSdk.hashGenerated(result);
    }

can any one help me how to understand this error what hash need

i try somthing like this also

generateHash(e) {
        var hashValue = sha512(e.hashString);
        var result = { [e.hashName]: hashValue };
        console.log(result)
        PayUBizSdk.hashGenerated(result);
}

generateHash(e) {
        var hashValue = sha512(e.hashString + this.state.merchantSalt);
        var result = { [e.hashName]: hashValue };
        console.log(result)
        PayUBizSdk.hashGenerated(result);
}
KarthiDreamr commented 6 months ago

Salt and merchant key value in documentation and example is wrong

Here's my blog of the problem being resolved:

https://dev.to/karthidreamer/payu-integration-in-react-native-with-checkoutpro-sdk-l13

PayU Officials please do needful to update payu-non-seamless-react package and salt in docs