Repository navigation
v3.0.0
Telegram Shop Bot v3.0.0
One guided command to launch. A durable payment core when money gets complicated.
v3 makes the shop dramatically easier to start and makes Telegram Stars and CryptoBot payments deterministic, auditable, and recoverable.
🚀 One-command setup
- Run
telegram-shop-bot quickstartand answer only two questions: the BotFather token and your Telegram admin ID. - The initializer validates the bot with Telegram, derives
BOT_USERNAME, creates.envatomically without overwriting an existing file, and applies private permissions on Unix. - New
doctordiagnostics check configuration, SQLite migrations, optional Redis, Telegram identity, webhook state, and pending updates without exposing secrets. init,doctor,quickstart,run,version, andhelpship in the same binary. Running the binary without arguments remains compatible with previous releases.
💳 Durable commerce ledger
- Order, payment, and fulfillment now have independent states instead of sharing one overloaded order status.
- Captures, refunds, anomalies, payment attempts, and operator resolutions are stored in append-only timelines.
- Provider ID, payer, amount, currency, and occurrence time are validated before settlement.
- Exact replays remain idempotent: stock, loyalty rewards, referrals, and subscription access are not applied twice.
- Telegram webhook and polling acknowledgements wait until every Stars charge is either settled or durably quarantined.
- Recurring Stars payment and entitlement updates commit atomically; refunds revoke or roll back access consistently.
🧰 Guarded payment operations
reconcile-starsperforms a bounded, read-only comparison between Telegram and the local ledger.payment-reviewlists quarantined Stars and CryptoBot facts with redacted output.- Recovery is preview-first and requires explicit
--applyplus exact order confirmation. - Revenue analytics now separates gross captures, refunds, and net revenue.
🔐 Webhook and CryptoBot hardening
WEBHOOK_URLis now the public base URL. Telegram uses/telegram-webhook; CryptoBot uses/cryptobot-webhook.- Every public Telegram webhook requires a strong
TELEGRAM_WEBHOOK_SECRET, regardless of application mode. - CryptoBot now uses exact decimal conversion, provider occurrence timestamps, durable malformed-fact preservation, and mutable-head-safe pagination.
- Transient SQLite lock conflicts are retried through a bounded settlement path.
- Startup transport errors are sanitized so BotFather tokens do not appear in logs.
⚠️ Upgrade notes
- Create a verified SQLite backup before the first v3 start.
- Migrations
017_commerce_ledger.sqland018_provider_fact_immutability.sqlapply automatically. - Set
WEBHOOK_URLto the HTTPS base URL only; remove old/webhook/...suffixes. - When webhook mode is enabled, configure a 32–256 character
TELEGRAM_WEBHOOK_SECRET. - Forks calling the Go payment service directly should migrate to
ConfirmPaymentReceiptwith a validated provider receipt. - Monitor the first live recurring Stars renewal after upgrading.
Docker
docker pull ghcr.io/jumpcodefrog/telegram-shop-bot:v3.0.0Quick start
./telegram-shop-bot quickstartTelegram Shop Bot v3.0.0 — по-русски
Одна команда для запуска. Надёжный платёжный контур для реальных денег.
🚀 Проще начать
telegram-shop-bot quickstartспрашивает только BotFather-токен и Telegram ID администратора, проверяет их, создаёт приватный.env, запускает диагностику и магазин.- Новый
doctorпроверяет конфигурацию, SQLite, Redis, Telegram и webhook без вывода секретов. - Все команды находятся в одном бинарнике; запуск без аргументов работает как раньше.
💳 Платежи под контролем
- Состояния заказа, оплаты и исполнения разделены.
- Captures, refunds, anomalies и решения оператора сохраняются в неизменяемом журнале.
- Повтор одного платежа не списывает товар, не начисляет бонусы и не продлевает подписку второй раз.
- Stars webhook и polling подтверждают update только после сохранённого settlement или quarantine.
- Оплата подписки и выдача доступа проходят атомарно; возврат корректно отзывает доступ.
- Аналитика показывает gross, refunds и net revenue отдельно.
🧰 Восстановление без опасной автоматики
reconcile-starsвыполняет только чтение и сверку с Telegram.payment-reviewпоказывает спорные операции без секретов и требует preview,--applyи точное подтверждение заказа.- CryptoBot получил точные суммы, provider timestamps и пагинацию без пропуска новых оплаченных инвойсов.
⚠️ Перед обновлением
- Сделайте проверенный бэкап SQLite.
- Миграции
017и018применятся автоматически. - Укажите в
WEBHOOK_URLтолько базовый HTTPS URL. - При webhook-режиме задайте сильный
TELEGRAM_WEBHOOK_SECRETдлиной 32–256 символов. - Проверьте первое живое продление Stars после обновления.
Полный список изменений: CHANGELOG.md.