Phase 4: Telegram Stars payments
- 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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f7ceadc462
commit
2b5625e9d4
+43
-1
@@ -156,6 +156,9 @@ pick = "Pick a format:"
|
||||
cancelled = "Cancelled."
|
||||
|
||||
[btn]
|
||||
pay_lightning = "⚡ Pay with Lightning"
|
||||
pay_stars = "⭐ Pay with Stars"
|
||||
with_stars = "{{.Label}} · ⭐ {{.Stars}}"
|
||||
qr = "QR code"
|
||||
copy_link = "Copy link"
|
||||
share = "Share"
|
||||
@@ -440,6 +443,10 @@ Page {{.Page}} of {{.Pages}}. Tap one to see it and get it again."""
|
||||
# --- Owner commands ---------------------------------------------------------
|
||||
|
||||
[owner]
|
||||
revenue_title = "<b>Revenue</b>"
|
||||
stars_refunded = "Refunded {{.Amount}} to user {{.User}} for purchase <code>{{.ID}}</code>. What it granted was taken back."
|
||||
stars_refund_failed = "Telegram refused the refund: {{.Reason}}"
|
||||
stars_not_refundable = "This Stars purchase cannot be refunded (status: {{.Status}})."
|
||||
books_ok = "ledger and balances agree"
|
||||
ln_ok = "reachable"
|
||||
ln_down = "NOT reachable"
|
||||
@@ -480,7 +487,11 @@ Create a gift code:
|
||||
gift_code = "Gift code: <code>{{.Code}}</code>\nUses: {{.Uses}}"
|
||||
granted = "Done. The pass of {{.ID}} runs until {{.Until}}."
|
||||
credit_usage = "Example: <code>/credit 123456789 500</code>"
|
||||
refund_usage = "Examples:\n<code>/refund 123456789 500</code>\n<code>/refund 123456789 pass 24h</code>"
|
||||
refund_usage = """
|
||||
Examples:
|
||||
<code>/refund 123456789 500</code>
|
||||
<code>/refund 123456789 pass 24h</code>
|
||||
<code>/refund PURCHASE_ID</code> returns a Stars payment"""
|
||||
no_pass = "That wallet has no active pass to extend."
|
||||
credited = "Done. {{.Amount}} added to {{.ID}}. Balance: {{.Balance}}."
|
||||
blocklist_empty = "The blocklist is empty."
|
||||
@@ -756,6 +767,8 @@ cancel_confirm = "Cancel \"{{.Title}}\"?"
|
||||
cancelled = "Cancelled."
|
||||
|
||||
[app.buy]
|
||||
method_stars = "Telegram Stars ⭐"
|
||||
method_lightning = "Lightning ⚡"
|
||||
unavailable = "Payments are not set up on this bot."
|
||||
step = "Step {{.Step}} of {{.Total}}"
|
||||
target_title = "Who is it for?"
|
||||
@@ -780,6 +793,9 @@ at_once = "At the same time"
|
||||
none = "No limit"
|
||||
|
||||
[app.invoice]
|
||||
refunded = "Refunded"
|
||||
stars_pay = "Open the payment again"
|
||||
stars_waiting = "Waiting for Telegram to confirm the payment…"
|
||||
qr_alt = "Lightning invoice as a QR code"
|
||||
copy = "Copy invoice"
|
||||
waiting = "Waiting for payment · {{.Time}}"
|
||||
@@ -917,3 +933,29 @@ Share your link. When somebody you invited pays for a first purchase in sats (Li
|
||||
|
||||
Invited: {{.Invited}} · Bought something: {{.Converted}}
|
||||
Earned: {{.Earned}} · Waiting: {{.Pending}}"""
|
||||
|
||||
[unit.stars]
|
||||
one = "{{.N}} Star"
|
||||
other = "{{.N}} Stars"
|
||||
|
||||
[stars]
|
||||
refunded = "Your payment for {{.Title}} was refunded: {{.Amount}} went back to your Telegram balance."
|
||||
payment_problem = "Your payment arrived, but I could not match it to an order. The bot owner can see it and will sort it out."
|
||||
precheck_closed = "This invoice is closed. Please start the purchase again."
|
||||
precheck_failed = "This invoice does not match your order. Please start the purchase again."
|
||||
invoice_description = "{{.Title}} for The Noderunners Download Bot, yours as soon as the payment arrives."
|
||||
credits_title = "{{.Amount}} in credits"
|
||||
offer = """
|
||||
<b>Pay with Telegram Stars</b>
|
||||
A pass covers this download. It starts as soon as the payment arrives."""
|
||||
intro = """
|
||||
<b>Pay with Telegram Stars</b>
|
||||
The same passes and credits, paid from your Stars balance in Telegram."""
|
||||
|
||||
[owner.revenue_lightning]
|
||||
one = "Lightning: {{.Amount}} from {{.Count}} purchase"
|
||||
other = "Lightning: {{.Amount}} from {{.Count}} purchases"
|
||||
|
||||
[owner.revenue_stars]
|
||||
one = "Stars: {{.Amount}} from {{.Count}} purchase, {{.Refunded}} refunded"
|
||||
other = "Stars: {{.Amount}} from {{.Count}} purchases, {{.Refunded}} refunded"
|
||||
|
||||
+43
-1
@@ -147,6 +147,9 @@ pick = "Elige un formato:"
|
||||
cancelled = "Cancelado."
|
||||
|
||||
[btn]
|
||||
pay_lightning = "⚡ Pagar con Lightning"
|
||||
pay_stars = "⭐ Pagar con Estrellas"
|
||||
with_stars = "{{.Label}} · ⭐ {{.Stars}}"
|
||||
qr = "Código QR"
|
||||
copy_link = "Copiar enlace"
|
||||
share = "Compartir"
|
||||
@@ -422,6 +425,10 @@ header = """
|
||||
Página {{.Page}} de {{.Pages}}. Toca una para verla y recibirla otra vez."""
|
||||
|
||||
[owner]
|
||||
revenue_title = "<b>Ingresos</b>"
|
||||
stars_refunded = "Devueltas {{.Amount}} al usuario {{.User}} por la compra <code>{{.ID}}</code>. Lo que otorgó se retiró."
|
||||
stars_refund_failed = "Telegram rechazó la devolución: {{.Reason}}"
|
||||
stars_not_refundable = "Esta compra con Estrellas no se puede devolver (estado: {{.Status}})."
|
||||
books_ok = "el libro mayor y los saldos coinciden"
|
||||
ln_ok = "disponible"
|
||||
ln_down = "NO disponible"
|
||||
@@ -462,7 +469,11 @@ Crear un código de regalo:
|
||||
gift_code = "Código de regalo: <code>{{.Code}}</code>\nUsos: {{.Uses}}"
|
||||
granted = "Listo. El pase de {{.ID}} dura hasta el {{.Until}}."
|
||||
credit_usage = "Ejemplo: <code>/credit 123456789 500</code>"
|
||||
refund_usage = "Ejemplos:\n<code>/refund 123456789 500</code>\n<code>/refund 123456789 pass 24h</code>"
|
||||
refund_usage = """
|
||||
Ejemplos:
|
||||
<code>/refund 123456789 500</code>
|
||||
<code>/refund 123456789 pass 24h</code>
|
||||
<code>/refund PURCHASE_ID</code> devuelve un pago con Estrellas"""
|
||||
no_pass = "Esa billetera no tiene un pase activo para extender."
|
||||
credited = "Listo. Se agregaron {{.Amount}} a {{.ID}}. Saldo: {{.Balance}}."
|
||||
blocklist_empty = "La lista de bloqueo está vacía."
|
||||
@@ -731,6 +742,8 @@ cancel_confirm = "Cancelar \"{{.Title}}\"?"
|
||||
cancelled = "Cancelado."
|
||||
|
||||
[app.buy]
|
||||
method_stars = "Estrellas ⭐"
|
||||
method_lightning = "Lightning ⚡"
|
||||
unavailable = "Los pagos no están configurados en este bot."
|
||||
step = "Paso {{.Step}} de {{.Total}}"
|
||||
target_title = "Para quién es?"
|
||||
@@ -755,6 +768,9 @@ at_once = "Al mismo tiempo"
|
||||
none = "Sin límite"
|
||||
|
||||
[app.invoice]
|
||||
refunded = "Devuelto"
|
||||
stars_pay = "Abrir el pago otra vez"
|
||||
stars_waiting = "Esperando a que Telegram confirme el pago…"
|
||||
qr_alt = "Factura Lightning como código QR"
|
||||
copy = "Copiar la factura"
|
||||
waiting = "Esperando el pago · {{.Time}}"
|
||||
@@ -890,3 +906,29 @@ Comparte tu enlace. Cuando alguien que invitaste pague una primera compra en sat
|
||||
|
||||
Invitados: {{.Invited}} · Compraron algo: {{.Converted}}
|
||||
Ganado: {{.Earned}} · En espera: {{.Pending}}"""
|
||||
|
||||
[unit.stars]
|
||||
one = "{{.N}} Estrella"
|
||||
other = "{{.N}} Estrellas"
|
||||
|
||||
[stars]
|
||||
refunded = "Se te devolvió el pago de {{.Title}}: {{.Amount}} volvieron a tu saldo de Telegram."
|
||||
payment_problem = "Tu pago llegó, pero no pude asociarlo a un pedido. El dueño del bot lo ve y lo va a resolver."
|
||||
precheck_closed = "Esta factura está cerrada. Empieza la compra otra vez, por favor."
|
||||
precheck_failed = "Esta factura no coincide con tu pedido. Empieza la compra otra vez, por favor."
|
||||
invoice_description = "{{.Title}} para The Noderunners Download Bot, tuyo en cuanto llega el pago."
|
||||
credits_title = "{{.Amount}} en créditos"
|
||||
offer = """
|
||||
<b>Pagar con Estrellas de Telegram</b>
|
||||
Un pase cubre esta descarga. Empieza en cuanto llega el pago."""
|
||||
intro = """
|
||||
<b>Pagar con Estrellas de Telegram</b>
|
||||
Los mismos pases y créditos, pagados con tu saldo de Estrellas en Telegram."""
|
||||
|
||||
[owner.revenue_lightning]
|
||||
one = "Lightning: {{.Amount}} de {{.Count}} compra"
|
||||
other = "Lightning: {{.Amount}} de {{.Count}} compras"
|
||||
|
||||
[owner.revenue_stars]
|
||||
one = "Estrellas: {{.Amount}} de {{.Count}} compra, {{.Refunded}} devueltas"
|
||||
other = "Estrellas: {{.Amount}} de {{.Count}} compras, {{.Refunded}} devueltas"
|
||||
|
||||
+43
-1
@@ -146,6 +146,9 @@ pick = "Kies een formaat:"
|
||||
cancelled = "Geannuleerd."
|
||||
|
||||
[btn]
|
||||
pay_lightning = "⚡ Betalen met Lightning"
|
||||
pay_stars = "⭐ Betalen met Stars"
|
||||
with_stars = "{{.Label}} · ⭐ {{.Stars}}"
|
||||
qr = "QR-code"
|
||||
copy_link = "Link kopiëren"
|
||||
share = "Delen"
|
||||
@@ -421,6 +424,10 @@ header = """
|
||||
Pagina {{.Page}} van {{.Pages}}. Tik op een download om hem te bekijken en opnieuw te krijgen."""
|
||||
|
||||
[owner]
|
||||
revenue_title = "<b>Omzet</b>"
|
||||
stars_refunded = "{{.Amount}} terugbetaald aan gebruiker {{.User}} voor aankoop <code>{{.ID}}</code>. Wat die opleverde is teruggenomen."
|
||||
stars_refund_failed = "Telegram weigerde de terugbetaling: {{.Reason}}"
|
||||
stars_not_refundable = "Deze Stars-aankoop kan niet worden terugbetaald (status: {{.Status}})."
|
||||
books_ok = "grootboek en saldi kloppen"
|
||||
ln_ok = "bereikbaar"
|
||||
ln_down = "NIET bereikbaar"
|
||||
@@ -461,7 +468,11 @@ Een cadeaucode maken:
|
||||
gift_code = "Cadeaucode: <code>{{.Code}}</code>\nKeer te gebruiken: {{.Uses}}"
|
||||
granted = "Klaar. De pas van {{.ID}} loopt tot {{.Until}}."
|
||||
credit_usage = "Voorbeeld: <code>/credit 123456789 500</code>"
|
||||
refund_usage = "Voorbeelden:\n<code>/refund 123456789 500</code>\n<code>/refund 123456789 pass 24h</code>"
|
||||
refund_usage = """
|
||||
Voorbeelden:
|
||||
<code>/refund 123456789 500</code>
|
||||
<code>/refund 123456789 pass 24h</code>
|
||||
<code>/refund PURCHASE_ID</code> betaalt een Stars-betaling terug"""
|
||||
no_pass = "Die wallet heeft geen actieve pas om te verlengen."
|
||||
credited = "Klaar. {{.Amount}} toegevoegd aan {{.ID}}. Saldo: {{.Balance}}."
|
||||
blocklist_empty = "De blokkeerlijst is leeg."
|
||||
@@ -730,6 +741,8 @@ cancel_confirm = "\"{{.Title}}\" annuleren?"
|
||||
cancelled = "Geannuleerd."
|
||||
|
||||
[app.buy]
|
||||
method_stars = "Telegram Stars ⭐"
|
||||
method_lightning = "Lightning ⚡"
|
||||
unavailable = "Betalingen zijn op deze bot niet ingesteld."
|
||||
step = "Stap {{.Step}} van {{.Total}}"
|
||||
target_title = "Voor wie is het?"
|
||||
@@ -754,6 +767,9 @@ at_once = "Tegelijk"
|
||||
none = "Geen limiet"
|
||||
|
||||
[app.invoice]
|
||||
refunded = "Terugbetaald"
|
||||
stars_pay = "De betaling opnieuw openen"
|
||||
stars_waiting = "Wachten tot Telegram de betaling bevestigt…"
|
||||
qr_alt = "Lightning-factuur als QR-code"
|
||||
copy = "Factuur kopiëren"
|
||||
waiting = "Wachten op betaling · {{.Time}}"
|
||||
@@ -889,3 +905,29 @@ Deel je link. Als iemand die je uitnodigde een eerste aankoop in sats (Lightning
|
||||
|
||||
Uitgenodigd: {{.Invited}} · Iets gekocht: {{.Converted}}
|
||||
Verdiend: {{.Earned}} · Wacht nog: {{.Pending}}"""
|
||||
|
||||
[unit.stars]
|
||||
one = "{{.N}} Star"
|
||||
other = "{{.N}} Stars"
|
||||
|
||||
[stars]
|
||||
refunded = "Je betaling voor {{.Title}} is terugbetaald: {{.Amount}} staat weer op je Telegram-saldo."
|
||||
payment_problem = "Je betaling is binnen, maar ik kon hem niet aan een bestelling koppelen. De eigenaar van de bot ziet het en lost het op."
|
||||
precheck_closed = "Deze factuur is gesloten. Begin de aankoop opnieuw."
|
||||
precheck_failed = "Deze factuur past niet bij je bestelling. Begin de aankoop opnieuw."
|
||||
invoice_description = "{{.Title}} voor The Noderunners Download Bot, van jou zodra de betaling binnen is."
|
||||
credits_title = "{{.Amount}} aan tegoed"
|
||||
offer = """
|
||||
<b>Betalen met Telegram Stars</b>
|
||||
Een pas dekt deze download. Hij begint zodra de betaling binnen is."""
|
||||
intro = """
|
||||
<b>Betalen met Telegram Stars</b>
|
||||
Dezelfde passen en hetzelfde tegoed, betaald met je Stars-saldo in Telegram."""
|
||||
|
||||
[owner.revenue_lightning]
|
||||
one = "Lightning: {{.Amount}} uit {{.Count}} aankoop"
|
||||
other = "Lightning: {{.Amount}} uit {{.Count}} aankopen"
|
||||
|
||||
[owner.revenue_stars]
|
||||
one = "Stars: {{.Amount}} uit {{.Count}} aankoop, {{.Refunded}} terugbetaald"
|
||||
other = "Stars: {{.Amount}} uit {{.Count}} aankopen, {{.Refunded}} terugbetaald"
|
||||
|
||||
Reference in New Issue
Block a user