Suraj-Tiwari / react-native-payumoney

React Native Payumoney (Android/IOS)
MIT License
18 stars 9 forks source link

error {success: false} #6

Closed i-suraj closed 6 years ago

i-suraj commented 6 years ago

i tried many times still getting this error... {success: false}

my option parameters are as follows:-

amount:1
email:"test@gmail.com"
furl:"https://www.payumoney.com/mobileapp/payumoney/failure.php"
hash:"64c37b20ca532949386f04f092e379b1bad80f22a0471eed3656a0c92530961fcf4f09ed85ee9f213552d71a168dcdb80d354b5f84e3272472518d101e203d72"
id:"6308905"
key:"gez8KIo6"
name:"Name"
phone:"8826343434"
productId:"test"
sandbox:true
surl:"https://www.payumoney.com/mobileapp/payumoney/success.php"
txid:"1534073035308"

my salt is rwsdJ8ZkJw

Suraj-Tiwari commented 6 years ago

That hash is manually defined.. if you want to test it with your data create hash using this php function and replace data accordingly

<?php
echo makeHash("LLKwG0","123123123","10.0","test","Name","test@gmail.com");

function makeHash($key, $txnid, $amount, $productinfo, $firstname, $email){
    $salt = "qauKbEAJ";
    $payhash_str = $key . '|' . checkNull($txnid) . '|' . checkNull($amount) . '|' . checkNull($productinfo) . '|' . checkNull($firstname) . '|' . checkNull($email) . '|||||||||||' . $salt;
    $hash = strtolower(hash('sha512', $payhash_str));
    return $hash;
}

function checkNull($value)
{
    if ($value == null) {
        return '';
    } else {
        return $value;
    }
}

?>
Suraj-Tiwari commented 6 years ago

To know how payumoney works have a look at PayuMoney Docs and check (Integration reference)

Suraj-Tiwari commented 6 years ago

I checked your code and found following issues

I tried your credentials in this function

<?php

//(key,txid,amount, productId, name,email)

echo makeHash("gez8KIo6","1534073035308","1.0","test","Name","test@gmail.com");

function makeHash($key, $txnid, $amount, $productinfo, $firstname, $email){
    $salt = "rwsdJ8ZkJw";
    $payhash_str = $key . '|' . checkNull($txnid) . '|' . checkNull($amount) . '|' . checkNull($productinfo) . '|' . checkNull($firstname) . '|' . checkNull($email) . '|||||||||||' . $salt;
    $hash = strtolower(hash('sha512', $payhash_str));
    return $hash;
}

function checkNull($value)
{
    if ($value == null) {
        return '';
    } else {
        return $value;
    }
}

and I got de7f81c1c972272beea1b091d75a92556a9726b9e6118deb3e9de2ee410f0c9a11ff41d9902b92b1d2868730e467472bd69f1709a6c10c12e064d09419be8697

this is different from your hash tested on

Suraj-Tiwari commented 6 years ago

Due to inactivity closing this issue

zesu00 commented 5 years ago

I have tried everything, but it still give me the error message {"success":false}

i-suraj commented 5 years ago

I had same issue but i was able to solve this just by setting the amount to as let amount= parseFloat("10"); The issue is with data type. This solution worked for me. Hope this will help you.

manubodhi commented 5 years ago

passing this float amount is not working for whole numbers, we have to pass transactions like 10 rupees 100 rupees and all, this will send as 10 only and causing issue taking it as integer and crashing the SDK.