- docs/AFFILIATE.md: the owner's setup in Telegram (profile editor or
BotFather's Mini App), commission and duration rules (raise only, end
with commission 0, about 24 hours), who counts as referred, the link
formats, and the no-double-rewards rule. Checked against Telegram's
current pages.
- Affiliate purchases go through Stars invoices inside the Mini App
(createInvoiceLink and WebApp.openInvoice, from Phase 4).
- /start accepts any payload; only our own rf_ (and old ref_) links set
an inviter. A test sends payloads of every shape, Telegram's affiliate
prefix included.
- Mini App Me page: an Earn section explaining both programs, with how
to join Telegram's from the bot's profile, behind AFFILIATE_ENABLED.
No affiliate numbers are computed or shown.
- /referral notes that Stars purchases earn through Telegram's program.
- The optional MTProto CLI is left out, with the reason in the docs.
- The Mini App browser test checks the Earn section in en, es and nl.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Stars as a second payment method for passes and credit packs, next to
Lightning (STARS_ENABLED, prices in [stars_prices] / STARS_PRICES, set
on their own). Invoices in XTR with no provider token and one price;
pre-checkout checks payer, state, currency and amount;
successful_payment settles through the same transaction as Lightning,
so entitlement is identical. Idempotent by telegram_payment_charge_id
(unique index).
- Migration 00009: payment_method on purchases and ledger entries, plus
stars_amount, tg_charge_id and refunded_at on purchases. Stars
purchases never reach LNbits.
- Chat: buy screen, /credits, /account and the over-limit offer show
Lightning first and a Pay with Stars button.
- Mini App: Lightning and Stars switch on Buy; Stars use
createInvoiceLink and WebApp.openInvoice, confirmed by the server-side
payment event.
- Owner /refund <purchase or charge ID> calls refundStarPayment and takes
back the credits or pass; refunded_payment messages do the same once.
/stats shows revenue by payment method.
- The sats referral reward counts Lightning purchases only.
- The bot now asks Telegram for pre_checkout_query updates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>