<?php

require ($_SERVER['DOCUMENT_ROOT'].'/core/sys.php');
$pay = $db->prepare('SELECT * FROM `pay` WHERE `id` = ?');
$pay -> execute([$_SESSION['payment']]);
$pay = $pay -> fetch(PDO :: FETCH_ASSOC);
if($pay['type'] == 1){
header('Location: /');
exit;
}
/*Присваиваем статус */
$sql = $db->prepare('UPDATE `pay` SET `status` = ? WHERE `id` = ?');
$sql -> execute(['success',$pay['id']]);

/*END*/
header('Location: /api/payment/success.php'); 
?>