telegram-bot-essentials / billing
Invoices, payments and a pluggable gateway registry for telegram-bot-essentials/essence
Package info
github.com/Telegram-Bot-Essentials/billing
pkg:composer/telegram-bot-essentials/billing
Requires
- php: ^8.3
- laravel/framework: ^12 || ^13
- telegram-bot-essentials/essence: ^0.12
- telegram-bot-essentials/settings: ~0.0.17
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.7 || ^4.0
- pestphp/pest-plugin-laravel: ^3.1 || ^4.0
This package is auto-updated.
Last update: 2026-09-02 12:18:09 UTC
README
Invoices, payment attempts, a pluggable gateway registry, and currency conversion on top of
telegram-bot-essentials/essence.
Billing does not talk to any payment provider itself — that's what
gateway-card and
gateway-zibal are for. It
defines the contract they implement, plus the invoice lifecycle and admin UI everything
else plugs into.
Depends on telegram-bot-essentials/settings.
Installation
composer require telegram-bot-essentials/billing
php artisan migrate
# optional — customize supported currencies
php artisan vendor:publish --tag=tbe-billing-config
Usage
Make your sellable thing an Order:
use TelegramBotEssentials\Billing\Models\Abstract\Order; class SubscriptionOrder extends Order { public function getPaidAtAttribute(): ?Carbon { /* ... */ } public function getAmountAttribute(): string { /* ... */ } public function getDescriptionAttribute(): string { /* ... */ } public function invoicePaidHook(): void { /* fulfil the order */ } public function cancelOrderHook(): void { /* invoice was revoked — undo it */ } }
Create and drive an invoice:
$invoice = billing()->createInvoice($order); $invoice->markAsPaid(); // fires InvoicePaid → your invoicePaidHook() runs automatically
Status transitions always go through markAsPaid() / markAsFailed() / markAsPending(),
never a raw update(), so each one fires its event and runs in the correct webhook context
even when triggered from a gateway's server-to-server callback.
Gateway packages register themselves into gateways(); the member-facing InvoiceFeature
renders a "choose a payment method" screen from whatever is registered. When
user-management is installed,
Billing adds a per-payable-type revenue breakdown to the user-list header.
MarkOverdueInvoicesAsFailed runs hourly — make sure Laravel's scheduler
(schedule:run via cron, or schedule:work) is running in production.
Documentation
Full documentation — the Order / HasInvoice / PaymentAttempt contracts, the gateway
registry, currency conversion, and the revenue stats block — lives on the Telegram Bot
Essentials documentation site under Modules → Billing.
License
MIT.