PHP code example of rilong / monobank-installments
1. Go to this page and download the library: Download rilong/monobank-installments 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/ */
rilong / monobank-installments example snippets
use Rilong\MonobankInstallments\MonobankInstallments;
MonobankInstallments::configure(
storeId: env('MONOBANK_STORE_ID'),
storeSecret: env('MONOBANK_STORE_SECRET'),
);
$response = MonobankInstallments::checkPaid('order-id');
$response->fullyPaid; // true once all installments are settled
$response->bankCanReturnMoneyToCard; // true if a card refund is available
$response = MonobankInstallments::getState('order-id');
match ($response->orderSubState) {
OrderSubState::WaitingForStoreConfirm => MonobankInstallments::confirmOrder($response->orderId),
OrderSubState::RejectedByClient => // notify the customer,
OrderSubState::Done => // order fully complete,
default => // handle other states,
};
$response = MonobankInstallments::checkPaid('order-id');
$response->fullyPaid; // true, якщо всі платежі погашено
$response->bankCanReturnMoneyToCard; // true, якщо доступне повернення на картку
$response = MonobankInstallments::getState('order-id');
match ($response->orderSubState) {
OrderSubState::WaitingForStoreConfirm => MonobankInstallments::confirmOrder($response->orderId),
OrderSubState::RejectedByClient => // сповістити клієнта,
OrderSubState::Done => // заявка повністю завершена,
default => // обробка інших статусів,
};