· 6 years ago · Sep 27, 2019, 05:26 PM
1<?php
2
3 include_once "inc/start.php";
4 include_once "inc/protect.php";
5
6 if (empty($_SESSION['id'])){
7 echo 'Ошибка: [Доступно только авторизованным]';
8 exit(json_encode(array('status' => '2')));
9 }
10 if($conf->token == 1 && ($_SESSION['token'] != clean($_POST['token'],null))) {
11 log_error("Неверный токен");
12 echo 'Ошибка: [Неверный токен]';
13 exit(json_encode(array('status' => '2')));
14 }
15
16 require (__DIR__ . '/vendor/autoload.php');
17
18 const SECRET_KEY = 'тута был приват кей';
19
20 $billPayments = new Qiwi\Api\BillPayments(SECRET_KEY);
21
22 $billId = $billPayments->generateId();
23 $fields = [
24 'amount' => $_POST['amount'],
25 'currency' => 'RUB',
26 'comment' => 'Пополнение баланса аккаунта № ' . $_SESSION['id'] . 'на сайте mircs.ru',
27 'expirationDateTime' => $billPayments->getLifetimeByDay(1),
28 'email' => $_POST['email'],
29 'user_id' => $_SESSION['id']
30 ];
31
32 /** @var \Qiwi\Api\BillPayments $billPayments */
33 $response = $billPayments->createBill($billId, $fields);
34
35 exit(json_encode($response));