1. Go to this page and download the library: Download haikiri/mikbill 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/ */
haikiri / mikbill example snippets
try {
/**
* Здесь выполняйте запросы к API, чтобы отлавливать ошибки.
*/
} catch (\Haikiri\MikBiLL\Exception\UnauthorizedException $e) {
// Сами придумаете как обрабатывать такие ошибки...
echo "<hr><h2>Не удалось авторизовать запрос: <code>[{$e->getCode()}]</code></h2>";
echo $e->getMessage();
} catch (\Haikiri\MikBiLL\Exception\BillApiException $e) {
echo "<hr><h2>MikBiLL прислал в ответ ошибку: <code>[{$e->getCode()}]</code></h2>";
echo $e->getMessage();
} catch (\Exception $e) {
echo "<hr><h2>Неизвестная ошибка: <code>[{$e->getCode()}]</code></h2>";
echo $e->getMessage();
}
use Haikiri\MikBiLL\MikBiLLApi;
$MikBiLL = new MikBiLLApi(
url: "https://api.example.com/", # Твой Api сервер.
key: "yourApiSignKey", # Твой Api ключ для подписи административных billing запросов.
// debug: false, # Укажи `true` – чтобы включить отладку запросов.
);