<?
$mrh_login = "********";
$mrh_pass1 = "********";
//2 *******
// номер заказа
$inv_id = rand();
// описание заказа
$inv_desc = $_GET[desc];
// сумма заказа
$out_summ = $_GET[sum];
// артикул товара товара
$name = "Имя: $_POST[name],";
$email = "Email: $_POST[email],";
$phone = "Телефон: $_POST[phone],";
$shp_item = $_POST[shp_item];
$encoding = "utf-8";
// язык
$culture = "ru";
// формирование подписи
$crc = md5("$mrh_login:$out_summ:$inv_id:$mrh_pass1:Shp_item=$shp_item");
$to = "********"; /*Укажите адрес, га который должно приходить письмо*/
$headers .= 'From: *****' . "\r\n";
$subject = "*****";
$message = "Услуга: $inv_desc
Сумма: $out_summ
Номер заказа: $inv_id
$name
$email
$phone";
$send = mail ($to, $subject, $message, $headers);
// форма оплаты товара
///https://auth.robokassa.ru/Merchant/Index.aspx
print "<html>".
"<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'></script>".
"<form id='target' action='https://merchant.roboxchange.com/Index.aspx' method=POST>".
"<input type=hidden name=MrchLogin value=$mrh_login>".
"<input type=hidden name=OutSum value=$out_summ>".
"<input type=hidden name=InvId value=$inv_id>".
"<input type=hidden name=Desc value='$inv_desc'>".
"<input type=hidden name=SignatureValue value=$crc>".
"<input type=hidden name=Culture value=$culture>".
"<input type=hidden name=Encoding value=$encoding>".
"<input type=hidden name=Shp_item value='$shp_item'>".
"<input type=submit class='submit' value='Pay'>".
"</form><script src='/js/pay.js'></script></html>";
?>
<?php
// цена продукта
$product_price = 2500;
$pay_methods = [];
$login = 'trevoga';
$pay_methods_url = 'https://auth.robokassa.ru/Merchant/WebService/Service.asmx/GetRates?MerchantLogin=' . $login . '&IncCurrLabel=&Language=ru&OutSum=' . $product_price;
$pay_methods = [];
$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
if ($dom->load($pay_methods_url)) {
$groups = $dom->getElementsByTagName('Group');
if ($groups->length) {
foreach ($groups as $group) {
if ($group->getElementsByTagName('Items')->length) {
$currencyList = $group->getElementsByTagName('Items')[0]->getElementsByTagName('Currency');
if ($currencyList->length) {
foreach ($currencyList as $currency) {
$price_rate = $currency->firstChild->getAttribute('IncSum');
$rate = $price_rate - $product_price;
$rate_round = ceil($rate);
$price_rate_round = ceil($price_rate);
$pay_methods[$group->getAttribute('Description')][] = [
'Alias' => $currency->getAttribute('Label'),
'Name' => $currency->getAttribute('Name'),
'price' => $product_price,
'rate' => $rate,
'rate_round' => $rate_round,
'price_rate' => $price_rate,
'price_rate_round' => $price_rate_round,
];
}
}
}
}
}
}
print_r($pay_methods);