PHP code example of telegram-bot-essentials / billing
1. Go to this page and download the library: Download telegram-bot-essentials/billing 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/ */
telegram-bot-essentials / billing example snippets
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 */ }
}
$invoice = billing()->createInvoice($order);
$invoice->markAsPaid(); // fires InvoicePaid → your invoicePaidHook() runs automatically