-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.php
More file actions
55 lines (42 loc) · 1.45 KB
/
Copy pathindex.php
File metadata and controls
55 lines (42 loc) · 1.45 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
spl_autoload('LkNpdNalogApi');
$api = new LkNpdNalogApi(
'Логин для ЛК ФНС (обязательно)',
'Пароль для ЛК ФНС (обязательно)',
'Asia/Yekaterinburg' // Часовой пояс (необязательно, нужен для верного отображения времени в чеке). По умолчанию - Europe/Moscow
);
/**
* Создание нового чека
*/
echo '<h2>Создание нового чека</h2>';
$args = [
'name' => 'Название товара',
'amount' => 149,
'clientContactPhone' => null,
'clientDisplayName' => null
];
$api->createReceipt($args);
if (!$api->error){
echo "receiptUuid: {$api->receiptUuid}<br>";
echo "receiptUrlPrint: {$api->receiptUrlPrint}<br>";
echo "receiptUrlJson: {$api->receiptUrlJson}<br>";
}else{
echo "errorMessage: {$api->errorMessage}<br>";
echo "errorExceptionMessage: {$api->errorExceptionMessage}<br>";
}
/**
* Отмена ранее выданного чека
*/
echo '<h2>Отмена ранее выданного чека</h2>';
$args = [
'reason' => 'CANCEL', // REFUND
'receiptUuid' => $api->receiptUuid
];
$api->cancelReceipt($args);
if (!$api->error){
echo "receiptUuid: {$api->receiptUuid}<br>";
}else{
echo "errorMessage: {$api->errorMessage}<br>";
echo "errorExceptionMessage: {$api->errorExceptionMessage}<br>";
}
echo "<h2>Response</h2> {$api->response}";