telegram-bot-essentials/billing
Telegram Bot Essentials — Billing
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.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.0.54 | ^8.3 | ^12 || | MIT | |
| v0.0.53 | ^8.3 | ^12 || | MIT | |
| v0.0.52 | ^8.3 | ^12 || | MIT | |
| v0.0.51 | ^8.3 | ^12 || | MIT | |
| v0.0.50 | ^8.3 | ^12 || | MIT | |
| v0.0.49 | ^8.3 | ^12 || | MIT | |
| v0.0.48 | ^8.3 | ^12 || | MIT | |
| v0.0.47 | ^8.3 | ^12 || | MIT | |
| v0.0.46 | ^8.3 | ^12 || | MIT | |
| v0.0.45 | ^8.3 | ^12 || | MIT | |
| v0.0.44 | ^8.3 | ^12 || | MIT | |
| v0.0.43 | ^8.3 | ^12 || | MIT | |
| v0.0.42 | ^8.3 | ^12 || | MIT | |
| v0.0.41 | ^8.3 | ^12 || | MIT | |
| v0.0.40 | ^8.3 | ^12 || | MIT | |
| v0.0.39 | ^8.3 | ^12 || | MIT | |
| v0.0.38 | ^8.3 | ^12 || | MIT | |
| v0.0.37 | ^8.3 | ^12 || | MIT | |
| v0.0.36 | ^8.3 | ^12 || | MIT | |
| v0.0.35 | ^8.3 | ^12 || | MIT | |
| v0.0.34 | ^8.3 | ^12 || | MIT | |
| v0.0.33 | ^8.3 | ^12 || | MIT | |
| v0.0.32 | ^8.3 | ^12 || | MIT | |
| v0.0.31 | ^8.2 | ^12 | MIT | |
| v0.0.30 | ^8.2 | ^12 | MIT | |
| v0.0.29 | ^8.2 | ^12 | MIT | |
| v0.0.28 | ^8.2 | ^12 | MIT | |
| v0.0.27 | ^8.2 | ^12 | MIT | |
| v0.0.26 | ^8.2 | ^12 | MIT | |
| v0.0.25 | ^8.2 | ^12 | MIT |
Showing the latest 30 of 54. See every release on Packagist