Creating a Payment
With Tegro.money, both the seller and the buyer get an "electronic cashier," which significantly simplifies operations and speeds up payments.
To create a payment, you need to send the necessary parameters to a special URL: https://tegro.money/pay/?params
Mandatory Parameters
Key | Description |
---|---|
shop_id | Public key of the project |
amount | Payment amount |
order_id | Order identifier (payment number or customer email) |
currency | Payment currency (RUB, USD, EUR) |
sign | Request signature |
Additional Parameters
Key | Description |
---|---|
lang | Interface language (ru, en) |
test | If specified with value "1" - payment will be processed in test mode |
payment_system | Payment system ID |
success_url | Success URL |
fail_url | Error URL |
notify_url | Notification URL |
To create a signature, it is necessary to sort all mandatory parameters by key, combine key/value pairs with an "&" symbol, and append your secret key to the end. Then hash the resulting string using MD5, for example:
<?php
$secret = 'GB%^&*YJni677';
$data = array(
'shop_id' => 'D0F98E7D7742609DC508D86BB7500914',
'amount' => 100,
'currency' => 'RUB',
'order_id' => '123',
);
ksort($data);
$str = http_build_query($data);
$sign = md5($str . $secret);
?>
Attention! If the test payment flag test=1 was passed to the payment form, this parameter also participates in creating the signature:
<?php
$secret = 'GB%^&*YJni677';
$data = array(
'shop_id' => 'D0F98E7D7742609DC508D86BB7500914',
'amount' => 100,
'currency' => 'RUB',
'order_id' => '123',
);
ksort($data);
$str = http_build_query($data);
$sign = md5($str . $secret);
?>
Immediate transition to the payment system is possible if you are ready to pass all payment data in the incoming request. To do this, you need to send the data using the POST method to the URL: https://tegro.money/pay/form/. Be sure to specify the payment_system parameter and pass all mandatory fields for this payment method. In most cases, this would be an email. For additional information, contact customer support.
Example:
<form action="https://tegro.money/pay/form/" method="post">
<input type="hidden" name="shop_id" value="D0F98E7D7742609DC508D86BB7500914">
<input type="hidden" name="amount" value="100">
<input type="hidden" name="order_id" value="123">
<input type="hidden" name="lang" value="ru">
<input type="hidden" name="currency" value="RUB">
<input type="hidden" name="payment_system" value="11">
<input type="hidden" name="fields[email]" value="[email protected]">
<input type="hidden" name="sign" value="e51845e62b106d245cc96c431d8aae42">
<input type="submit" value="Оплатить">
</form>