A
A
AlexUnknow2017-04-05 10:47:42
PHP
AlexUnknow, 2017-04-05 10:47:42

How to correctly set up a robokassa on a website using a free form?

Robokassa has a solution. which works, but for a number of reasons it does not suit me.
The solution proposed as an example by the robocash itself:

<?php
  $mrh_login = "login";
  $mrh_pass1 = "pass1";
  $inv_id = 0;
  $inv_desc = "Оплата услуг";
  $def_sum = "0";
  $crc = md5("$mrh_login::$inv_id:$mrh_pass1");
  print "<html><script language=JavaScript ".
      "src='https://auth.robokassa.ru/Merchant/PaymentForm/FormFL.js?".
      "MerchantLogin=$mrh_login&DefaultSum=$def_sum&InvoiceID=$inv_id".
      "&Description=$inv_desc&SignatureValue=$crc'></script></html>";  

?>

Used the following solution based on what was stated in the demo:
<form action="https://auth.robokassa.ru/Merchant/Index.aspx" method="POST">
                    	<input type="text" name="psh-name" placeholder="Название УК или ТСЖ" required>
                    	<input type="text" name="psh-phone" placeholder="Номер телефона" required>
                    	<input type="text" name="email" placeholder="E-mail (не обязательное поле)">
                    	<input type="text" name="DefaultSum" placeholder="Сумма платежа" required>
                    	<input type=submit value='Оплатить'>
                    </form>

<?php
  $mrh_login = "login";
  $mrh_pass1 = "pass";
  $Email = trim($_GET["email"]);
  $inv_desc = "Оплата услуг";
  $def_sum = trim($_GET["DefaultSum"]);
  $shp_phone = trim($_GET["psh-name"]);
  $shp_name = trim($_GET["psh-phone"]);
  $encoding = "utf-8";
  $inv_id = 0; 
  $crc = md5("$mrh_login::$inv_id:$mrh_pass1:$def_sum:$psh_phone:$psh_name:$encoding:Email");
  ?>

As a result, I received an error: "MerchantLogin - incorrect", despite the fact that in the example with their standard button, with the same login and password, everything works fine. Those. support didn't help much. What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
trevoga_su, 2017-04-05
@AlexUnknow

just read the documentation carefully

$crc = md5("$mrh_login::$inv_id:$mrh_pass1:$def_sum:$psh_phone:$psh_name:$encoding:Email");
nonsense is written here

A
AlexUnknow, 2017-04-05
@AlexUnknow

Solved this problem, thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question