O
O
obkrs2020-09-27 11:17:01
Payment systems
obkrs, 2020-09-27 11:17:01

Replenishment of the balance on the site through Ya.Dengi?

Hello, I'm trying to make a wallet replenishment through Yandex Money on the site.
There is very little experience in this, I once connected Robokassa, it’s somehow easier there, they have a Demo version on their website and there are error codes, then everything worked out.
It's more complicated here, I still can't quite figure out which way to go. I have already tried 20 options, mostly three errors - 1. Money comes, but is not recorded on the user's account, 2. Verification is not passed. SHA1_HASH does not match. 3. The site api.yandex.ru redirected too many times. or The site yandex.ru is blocked.
The last option - I made the form myself, the handler found it on this forum.

<form method="POST" action="https://money.yandex.ru/quickpay/confirm.xml">
<input type="hidden" name="shop_id" value="<?=$ppu['shop_id']?>">
<input type="hidden" name="receiver" value="4100177663388159">
<input type="hidden" name="quickpay-form" value="donate">
 <input type="hidden" name="targets" value="Пополнение кошелька"> 
<input type="hidden" name="label" value="<?=$id['user']?>">
<input type="hidden" name="sum" value="<?=$summa_v?>" data-type="number">
<input type="hidden" name="payment_id" value="<?=time()?>">
<input type="hidden" name="baggage_fields" value="<?=$_SESSION['ID_P'][1]?>">
<input type="hidden" name="need-email" value="true">

<input class="submit" type="submit" name="process" value='Пополнить кошелек на сумму <?=$summa_v?>  <?=$rru['cena_valuta']?> через платежный шлюз <?=$kassa?>' >
</form>
<?
include ('result.php');
?>

<?
require_once('../connect/connect.php');
$pu=mysqli_query($link,"SELECT * FROM service");
$ppu=mysqli_fetch_array($pu);

$id_user=intval($_REQUEST['baggage_fields']);
$summa=floatval($_REQUEST['sum']);

$key = '4FPtFWmgrdEDPSc9F0+BNNz7';
$id      =trim($_POST['label']);    
$order   =trim($_POST['operation_id']);       
$payer   =trim($_POST['sender']);      
$odate   =trim($_POST['datetime']);   
$code    =trim($_POST['codepro']);       
$amount  =trim($_POST['amount']);    
$wamount =trim($_POST['withdraw_amount']);   
$cur     =trim($_POST['currency']);   
$type    =trim($_POST['notification_type']);  
$hash    =trim($_POST['sha1_hash']);

$hash_gen = hash("sha1", $type.'&'.$order.'&'.$amount.'&'.$cur.'&'.$odate.'&'.$payer.'&'.$code.'&'.$key.'&'.$id);
if($hash_gen!=$hash) {
    file_put_contents('history.txt', 'ошибка', FILE_APPEND);
}

file_put_contents('history.txt', $amount, FILE_APPEND);

if(!$pdt) exit();

$r=mysqli_query($link,"SELECT * FROM akk WHERE id_akk='".$id_user."'");
$nr=mysqli_num_rows($r);
if(!$nr) exit();

mysqli_query($link,"INSERT INTO plateg (summa, id_akk, typ, data, opis)  VALUES ('".$summa."', '".$id_user."', 1, NOW(), 'Пополнение кошелька через Yandex_money')");
include('../../balans.php');
?>


Who understands please tell me my mistakes

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
obkrs, 2020-09-29
@obkrs

And what does Borya Moiseev think about this? Code experts are silent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question