-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle_kassa.php
More file actions
28 lines (23 loc) · 1 KB
/
Copy pathsingle_kassa.php
File metadata and controls
28 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
$key = 'YOUR_KASSA_SECRET_KEY';
$checkSum = hash('sha256', $_POST['cashboxCode'].'&'.$_POST['orderId'].'&'.$_POST['baseSum'].'&'.$_POST['totalSum'].'&'.$_POST['contact'].'&'.$_POST['paymentCode'].'&'.$_POST['cashboxCurrencyCode'].'&'.$_POST['paymentCurrencyCode'].'&'.$_POST['customInfo'].'&'.$key );
//Checking
if( empty($_POST['sha256_hash']) || $_POST['sha256_hash'] != $checkSum )
exit();
/*
* Use $_POST to work with your Orders/Users/etc
* Example:
*/
//Add balance to user (Note! orderId must be unique)
function yourBalanceFunction( int $user_id, float $sum, string $currency ) {}
yourBalanceFunction( $_POST['customInfo'], $_POST['baseSum'], $_POST['paymentCurrencyCode'] );
//Payment verification for order
function orderPayment( int $order_id, float $sum, string $currency ) {
if(
ceil($sum) != ceil($order_sum) ||
$currency != $order_currency
)
return false;
//SUCCESS!
}
orderPayment( $_POST['orderId'], $_POST['baseSum'], $_POST['paymentCurrencyCode'] );