payu-intrepos / payu-non-seamless-react

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

{"errorCode": "5014", "errorMsg": "Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject"} #4

Closed rajmaxi closed 3 years ago

rajmaxi commented 3 years ago

Hi, Iam also getting the same error

{"errorCode": "5014", "errorMsg": "Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject"}

kindly resolve this..

Vaibhavshyoran commented 3 years ago

You are passing string that not to be converted into JSON. Please check your config.

sujitgawas19 commented 3 years ago

Im facing the same problem. @Vaibhavshyoran Can you please tell which string are you talking about?

Vaibhavshyoran commented 3 years ago

Im facing the same problem. Can you please tell which string are you talking about?

Can you please share your code snippet?

sujitgawas19 commented 3 years ago

@Vaibhavshyoran Here is the sample code:

    let payUPaymentParams = {
        key: 'key',
        transactionId: 'payu123',
        amount: "1",
        productInfo: 'bueno-loan-repayment',
        firstName: 'sujit',
        email: 'sujit@ajency.in',
        phone: '9988776655',
        android_surl: 'https://test.in.success',
        android_furl: 'https://test.in/failure',
        environment: "1",
        userCredential: 'aj-sujit',
        additionalParam: {
            "payment_related_details_for_mobile_sdk": "hash",
            "vas_for_mobile_sdk": "hash",
            "payment": "hash"
        }
    }

    var payUCheckoutProConfig = {
        merchantName: 'Bueno Finance',
        showExitConfirmationOnCheckoutScreen: true,
        showExitConfirmationOnPaymentScreen: true,
        surePayCount: 0,
        merchantResponseTimeout: 50000,
        autoSelectOtp: true,
        // Android specific property
        autoApprove: true,
        merchantSMSPermission: true,
        showCbToolbar: true,
    }

    let paymentObject = {
        payUPaymentParams: payUPaymentParams,
        payUCheckoutProConfig: payUCheckoutProConfig
    }

    PayUBizSdk.openCheckoutScreen(paymentObject);
sujitgawas19 commented 3 years ago

@rajmaxi is your issue resolved?

Vaibhavshyoran commented 3 years ago

@Vaibhavshyoran Here is the sample code:

    let payUPaymentParams = {
        key: 'key',
        transactionId: 'payu123',
        amount: "1",
        productInfo: 'bueno-loan-repayment',
        firstName: 'sujit',
        email: 'sujit@ajency.in',
        phone: '9988776655',
        android_surl: 'https://test.in.success',
        android_furl: 'https://test.in/failure',
        environment: "1",
        userCredential: 'aj-sujit',
        additionalParam: {
            "payment_related_details_for_mobile_sdk": "hash",
            "vas_for_mobile_sdk": "hash",
            "payment": "hash"
        }
    }

    var payUCheckoutProConfig = {
        merchantName: 'Bueno Finance',
        showExitConfirmationOnCheckoutScreen: true,
        showExitConfirmationOnPaymentScreen: true,
        surePayCount: 0,
        merchantResponseTimeout: 50000,
        autoSelectOtp: true,
        // Android specific property
        autoApprove: true,
        merchantSMSPermission: true,
        showCbToolbar: true,
    }

    let paymentObject = {
        payUPaymentParams: payUPaymentParams,
        payUCheckoutProConfig: payUCheckoutProConfig
    }

    PayUBizSdk.openCheckoutScreen(paymentObject);

Pleae double check your hash send function to the SDK sendBackHash = (hashName, hashData) => { console.log(hashName); var hashValue = this.calculateHash(hashData); var result = { [hashName]: hashValue }; console.log(result); PayUBizSdk.hashGenerated(result); }

I think you are sending result as a string.

sujitgawas19 commented 3 years ago

@Vaibhavshyoran generateHash event is not getting triggered. onError event gets triggered with this error - {"errorCode": "5014", "errorMsg": "Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject"}

sujitgawas19 commented 3 years ago

Issue is resolved. Was facing the issue because of wrong key.

anirudhmalik commented 3 years ago

@sujitgawas19 can explain how you fixed this error I am facing the same.

sujitgawas19 commented 3 years ago

The key and the salt which i was using was incorrect. Got proper key and the salt from the PayU team.

anirudhmalik commented 3 years ago

@sujitgawas19 Yes, I was using wrong key it was 5 character length, later found it is usually 6 character long. now got fixed.

eramudeep commented 3 years ago

can anyone tell me how to use this module? i am almost fucked up. spent 8 Hours

anirudhmalik commented 3 years ago

can anyone tell me how to use this module? i am almost fucked up. spent 8 Hour Stucked were ??

eramudeep commented 3 years ago

can anyone tell me how to use this module? i am almost fucked up. spent 8 Hour Stucked were ??

Thanks for Reply i resolved i found a documentation link https://github.com/payu-intrepos/payu-non-seamless-react/issues/5