@
@
@tsstsd2019-02-21 02:13:47
PHP
@tsstsd, 2019-02-21 02:13:47

Robokassa how to set the result url so that after payment it sends an email with a link?

It is necessary to fasten the ROBOKASSA payment gateway to the landing. All settings are made in the system. Next, I created an html page with a form, passed the fields of the buyer's mail in it and sent it to the handler, made according to the platform template (RoboCash).
I'm trying to make a real payment of 1 ruble, everything goes ok. Money comes in, redirection to the desired page is set up in the success.php file, but the letter does not go to the buyer's mail with a link to purchase. Tell me what's wrong.
Here is the result.php code:

<?

// регистрационная информация (пароль #2)
// registration info (password #2)
$mrh_pass2 = "пароль2";

//установка текущего времени
//current date
$tm=getdate(time()+9*3600);
$date="$tm[year]-$tm[mon]-$tm[mday] $tm[hours]:$tm[minutes]:$tm[seconds]";

// чтение параметров
// read parameters
$out_summ = $_REQUEST["OutSum"];
$inv_id = $_REQUEST["InvId"];
$shpa_item = $_REQUEST["Shpa_item"];
$crc = $_REQUEST["SignatureValue"];

$shpb_mulo = $_POST['Shpb_mulo']; // принимаем дополнительный параметр
$shpc_names = $_POST['Shpc_names']; // принимаем дополнительный параметр

$shpd_url = $_REQUEST["Shpd_url"];

$crc = strtoupper($crc);

$my_crc = strtoupper(md5("$out_summ:$inv_id:$mrh_pass2:Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url"));

// проверка корректности подписи
// check signature

if ($my_crc != $crc)
{
require 'http://mysaita.ru/lend/action.php';
echo "OK$InvId\n";
    if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $shpc_names = $_POST['Shpc_names'];


$shpb_mulo = $_POST['Shpb_mulo'];



 //session_start();
 //$shpb_mulo = $_SESION['Shpb_mulo'];

mail($shpb_mulo, "Покупка", "Вот вам ссылка на покупку: https://yadi.sk/d/pk9V9ood3QheoA");
}
  exit();
}
else
  {
    echo "bad sign\n";
 		exit();
  }

// запись в файл информации о проведенной операции
// save order info to file
[email protected]("order.txt","a+") or
          die("error");
fputs($f,"order_num :$inv_id;Summ :$out_summ;Date :$date\n");
fclose($f);

?>

Here is the handler code:
<?
if(!empty($_POST["shpc_names"]) && !empty($_POST["Shpb_mulo"])){ // если был пост

    $shpc_names = trim(htmlspecialchars(strip_tags(base64_encode(urlencode($_POST["shpc_names"]))))); // принимаем параметры с формы
    $shpb_mulo = trim(htmlspecialchars(strip_tags(base64_encode(urlencode($_POST["Shpb_mulo"]))))); // принимаем параметры с формы
 }
 if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $shpc_names = $_POST['Shpc_names'];


$shpb_mulo = $_POST['Shpb_mulo'];
 //session_start();

 //$_SESION['Shpb_mulo'] = $shpb_mulo;

}
// 1.
// Оплата заданной суммы с выбором валюты на сайте мерчанта
// Payment of the set sum with a choice of currency on merchant site

// регистрационная информация (логин, пароль #1)
// registration info (login, password #1)
$mrh_login = "mysaitaru";
$mrh_pass1 = "пасс1";

// номер заказа
// number of order
$inv_id = "0";

// описание заказа
// order description
$inv_desc = "Universal Landing";

// сумма заказа
// sum of order
$out_summ = "0.85";

// тип товара
// code of goods
$shpa_item = "1";

// Адрес электронной почты покупателя
// E-mail
$shpb_mulo = $_POST['Shpb_mulo'];

$shpc_names = $_POST['shpc_names'];

$shpd_url = "bit.ly/2CzDpSE"; // цылка на товар




// предлагаемая валюта платежа
// default payment e-currency
$in_curr = "";

// язык
// language
$culture = "ru";

// кодировка
// encoding
$encoding = "utf-8";



// формирование подписи
// generate signature
$crc  = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url");



// Перенаправляем пользователя на страницу оплаты
    header("Refresh: 5; https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin=$mrh_login&OutSum=$out_summ&InvId=$inv_id&IncCurrLabel=$in_curr".
      "&Desc=$inv_desc&SignatureValue=$crc&Shpa_item=$shpa_item:Shpb_mulo=$shpb_mulo:Shpc_names=$shpc_names:Shpd_url=$shpd_url".
      "&Culture=$culture&Encoding=$encoding");
echo 'Через 5 секунд вы будете перенаправлены на страницу оплаты';

?>

Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-02-24
@dimonchik2013


decompose little code
first write to a file on the server
then deal with soap
then with antispam

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question