1. Go to this page and download the library: Download djalone/kkm-server-classes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
djalone / kkm-server-classes example snippets
...
/* Получите ИНН и ФИО кассира обычным для вас способом */
$cashierINN = $lib->getCashierInn();
$cashierName = $lib->getCashierName();
...
/* Выведите ссылку на меню */
echo "<a href=\"path-to-your-vendor-dir/frontend/menu.php?cashierName={$cashierName}&cashierVatin={$cashierVatin}\">Меню работы с ККТ </a>";
...
use Djalone\KkmServerClasses\Cheque;
use Djalone\KkmServerClasses\Cheque\Enums\PaymentTypes;
use Djalone\KkmServerClasses\Cheque\Items\Position;
use Djalone\KkmServerClasses\Services\CustomGUID;
use Djalone\KkmServerClasses\Services\Serializer;
use Djalone\KkmServerClasses\Services\Helper;
�икальный идентификатор команды
);
// Установка информации о клиенте
$cheque
->setClientAddress('+791-------')
->setClientInfo('Иванов Иван Иванович');
// Добавление товара в чек
$cheque->addItem(
(new Position('Товар 1', 1000, 2000)) // название, цена в копейках, количество в тысячных долях
->setPaymentType(PaymentTypes::Electronic)
);
// Определите ссылку callBack для получения ответа от фронтенда
$callBackUrl = '/my-callback-url.php';
...
// Выведите форму на экран с разу выполните переход
echo Helper::echoForm($cheque,$callBackUrl);
...
public function __construct(
string $cashierName = '',
string $cashierVatin = '',
string $kktNumber = '',
string $idCommand = ''
)
public function __construct(
string $name, // Название товара
int $price, // Цена в копейках
int $quantity // Количество в тысячных долях (1000 = 1 шт)
)
public static function serializeCheque(Cheque $cheque): string
// Возвращает JSON-строку команды чека
public static function deserializeCheque(string $json): Cheque
// Десериализует JSON обратно в объект Cheque