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
+104
-19
@@ -145,14 +145,6 @@ Downloading…
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Sending it to Telegram…
|
||||
[Cancel]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Sending it to Telegram…
|
||||
@@ -362,7 +354,7 @@ editMessageText
|
||||
|
||||
Share your link. When somebody you invited pays for a first purchase in sats (Lightning), you get 200 sats in credits.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_CW5AYJM3
|
||||
https://t.me/nr_dl_test_bot?start=rf_YY6OJU6T
|
||||
|
||||
Invited: 0 · Bought something: 0
|
||||
Earned: 0 sats · Waiting: 0 sats
|
||||
@@ -553,6 +545,7 @@ Downloads: 4 of 5
|
||||
Volume: 4 KB of 250 MB
|
||||
[Day pass · 700 sats] [Week pass · 3,000 sats]
|
||||
[Month pass · 9,000 sats]
|
||||
[⭐ Pay with Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -574,7 +567,7 @@ sendMessage
|
||||
|
||||
Share your link. When somebody you invited pays for a first purchase in sats (Lightning), you get 200 sats in credits.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_CW5AYJM3
|
||||
https://t.me/nr_dl_test_bot?start=rf_YY6OJU6T
|
||||
|
||||
Invited: 0 · Bought something: 0
|
||||
Earned: 0 sats · Waiting: 0 sats
|
||||
@@ -597,6 +590,7 @@ You pay in sats over Lightning.
|
||||
[Day pass · 700 sats] [Week pass · 3,000 sats]
|
||||
[Month pass · 9,000 sats]
|
||||
[1,000 sats] [5,000 sats] [20,000 sats]
|
||||
[⭐ Pay with Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -606,6 +600,7 @@ sendMessage
|
||||
|
||||
One download costs 50 sats. Top up:
|
||||
[1,000 sats] [5,000 sats] [20,000 sats]
|
||||
[⭐ Pay with Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -862,6 +857,7 @@ You pay in sats over Lightning.
|
||||
[Day pass · 700 sats] [Week pass · 3,000 sats]
|
||||
[Month pass · 9,000 sats]
|
||||
[1,000 sats] [5,000 sats] [20,000 sats]
|
||||
[⭐ Pay with Stars]
|
||||
```
|
||||
|
||||
sendPhoto
|
||||
@@ -869,13 +865,40 @@ sendPhoto
|
||||
```
|
||||
<b>Day pass</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fake932bb5fc424d32f8967f5a103ec1aa9b323d60cf969ac292033fe465b6058e60</code>
|
||||
<code>lnbc7000n1fakee38a3d34236055a47c726ecb0a1c30d15a717a59fccef6acb0cff8dcb7dc200f</code>
|
||||
|
||||
Scan the code or tap the invoice to copy it. Valid for 10 minutes.
|
||||
[Open in wallet]
|
||||
[Check payment] [Cancel]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Pay with Telegram Stars</b>
|
||||
The same passes and credits, paid from your Stars balance in Telegram.
|
||||
[Day pass · ⭐ 50] [Week pass · ⭐ 200]
|
||||
[Month pass · ⭐ 600]
|
||||
[1,000 sats · ⭐ 70] [5,000 sats · ⭐ 330] [20,000 sats · ⭐ 1,300]
|
||||
[⚡ Pay with Lightning]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Passes and credits</b>
|
||||
|
||||
A <b>pass</b> lifts your limits to 1.95 GB and 3 hours per download and puts you in the priority queue for as long as it runs.
|
||||
|
||||
<b>Credits</b> pay per download, 50 sats each, with the same limits and priority. They never expire.
|
||||
|
||||
You pay in sats over Lightning.
|
||||
[Day pass · 700 sats] [Week pass · 3,000 sats]
|
||||
[Month pass · 9,000 sats]
|
||||
[1,000 sats] [5,000 sats] [20,000 sats]
|
||||
[⭐ Pay with Stars]
|
||||
```
|
||||
|
||||
## es
|
||||
|
||||
sendMessage
|
||||
@@ -1234,7 +1257,7 @@ editMessageText
|
||||
|
||||
Comparte tu enlace. Cuando alguien que invitaste pague una primera compra en sats (Lightning), recibes 200 sats en créditos.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_MXZGYTEK
|
||||
https://t.me/nr_dl_test_bot?start=rf_Q3U2NIQH
|
||||
|
||||
Invitados: 0 · Compraron algo: 0
|
||||
Ganado: 0 sats · En espera: 0 sats
|
||||
@@ -1425,6 +1448,7 @@ Descargas: 4 de 5
|
||||
Volumen: 4 KB de 250 MB
|
||||
[Pase de un día · 700 sats] [Pase semanal · 3.000 sats]
|
||||
[Pase mensual · 9.000 sats]
|
||||
[⭐ Pagar con Estrellas]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -1446,7 +1470,7 @@ sendMessage
|
||||
|
||||
Comparte tu enlace. Cuando alguien que invitaste pague una primera compra en sats (Lightning), recibes 200 sats en créditos.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_MXZGYTEK
|
||||
https://t.me/nr_dl_test_bot?start=rf_Q3U2NIQH
|
||||
|
||||
Invitados: 0 · Compraron algo: 0
|
||||
Ganado: 0 sats · En espera: 0 sats
|
||||
@@ -1469,6 +1493,7 @@ Pagas en sats por Lightning.
|
||||
[Pase de un día · 700 sats] [Pase semanal · 3.000 sats]
|
||||
[Pase mensual · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Pagar con Estrellas]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -1478,6 +1503,7 @@ sendMessage
|
||||
|
||||
Una descarga cuesta 50 sats. Carga saldo:
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Pagar con Estrellas]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -1734,6 +1760,7 @@ Pagas en sats por Lightning.
|
||||
[Pase de un día · 700 sats] [Pase semanal · 3.000 sats]
|
||||
[Pase mensual · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Pagar con Estrellas]
|
||||
```
|
||||
|
||||
sendPhoto
|
||||
@@ -1741,13 +1768,40 @@ sendPhoto
|
||||
```
|
||||
<b>Pase de un día</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fake5bb91054d0d2b0cbcc9f5394928a595cf2ccba08d4a09432f7db5063c88ffd85</code>
|
||||
<code>lnbc7000n1fake7bf3f553278730f9f02e2e8e66bb1524a1efc083ab3bfe31c83c00e15d64e033</code>
|
||||
|
||||
Escanea el código o toca la factura para copiarla. Vale por 10 minutos.
|
||||
[Abrir en la billetera]
|
||||
[Verificar el pago] [Cancelar]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Pagar con Estrellas de Telegram</b>
|
||||
Los mismos pases y créditos, pagados con tu saldo de Estrellas en Telegram.
|
||||
[Pase de un día · ⭐ 50] [Pase semanal · ⭐ 200]
|
||||
[Pase mensual · ⭐ 600]
|
||||
[1.000 sats · ⭐ 70] [5.000 sats · ⭐ 330] [20.000 sats · ⭐ 1.300]
|
||||
[⚡ Pagar con Lightning]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Pases y créditos</b>
|
||||
|
||||
Un <b>pase</b> sube tus límites a 1,95 GB y 3 horas por descarga y te pone en la fila prioritaria mientras dure.
|
||||
|
||||
Los <b>créditos</b> pagan por descarga, 50 sats cada una, con los mismos límites y la misma prioridad. No vencen nunca.
|
||||
|
||||
Pagas en sats por Lightning.
|
||||
[Pase de un día · 700 sats] [Pase semanal · 3.000 sats]
|
||||
[Pase mensual · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Pagar con Estrellas]
|
||||
```
|
||||
|
||||
## nl
|
||||
|
||||
sendMessage
|
||||
@@ -1827,7 +1881,7 @@ editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Downloaden…
|
||||
Naar Telegram sturen…
|
||||
[Annuleren]
|
||||
```
|
||||
|
||||
@@ -1835,7 +1889,7 @@ editMessageText
|
||||
|
||||
```
|
||||
<b>Test Video</b>
|
||||
Naar Telegram sturen…
|
||||
Downloaden…
|
||||
[Annuleren]
|
||||
```
|
||||
|
||||
@@ -2106,7 +2160,7 @@ editMessageText
|
||||
|
||||
Deel je link. Als iemand die je uitnodigde een eerste aankoop in sats (Lightning) betaalt, krijg jij 200 sats aan tegoed.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_4VIFLSDC
|
||||
https://t.me/nr_dl_test_bot?start=rf_TXUCNI2E
|
||||
|
||||
Uitgenodigd: 0 · Iets gekocht: 0
|
||||
Verdiend: 0 sats · Wacht nog: 0 sats
|
||||
@@ -2297,6 +2351,7 @@ Downloads: 4 van 5
|
||||
Volume: 4 KB van 250 MB
|
||||
[Dagpas · 700 sats] [Weekpas · 3.000 sats]
|
||||
[Maandpas · 9.000 sats]
|
||||
[⭐ Betalen met Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -2318,7 +2373,7 @@ sendMessage
|
||||
|
||||
Deel je link. Als iemand die je uitnodigde een eerste aankoop in sats (Lightning) betaalt, krijg jij 200 sats aan tegoed.
|
||||
|
||||
https://t.me/nr_dl_test_bot?start=rf_4VIFLSDC
|
||||
https://t.me/nr_dl_test_bot?start=rf_TXUCNI2E
|
||||
|
||||
Uitgenodigd: 0 · Iets gekocht: 0
|
||||
Verdiend: 0 sats · Wacht nog: 0 sats
|
||||
@@ -2341,6 +2396,7 @@ Je betaalt in sats via Lightning.
|
||||
[Dagpas · 700 sats] [Weekpas · 3.000 sats]
|
||||
[Maandpas · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Betalen met Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -2350,6 +2406,7 @@ sendMessage
|
||||
|
||||
Eén download kost 50 sats. Opwaarderen:
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Betalen met Stars]
|
||||
```
|
||||
|
||||
sendMessage
|
||||
@@ -2606,6 +2663,7 @@ Je betaalt in sats via Lightning.
|
||||
[Dagpas · 700 sats] [Weekpas · 3.000 sats]
|
||||
[Maandpas · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Betalen met Stars]
|
||||
```
|
||||
|
||||
sendPhoto
|
||||
@@ -2613,9 +2671,36 @@ sendPhoto
|
||||
```
|
||||
<b>Dagpas</b> · 700 sats
|
||||
|
||||
<code>lnbc7000n1fake2279497394e085369465914011a009430187243aabd22a7b3642440c8ec67831</code>
|
||||
<code>lnbc7000n1fake5443af8ff471a30e71eaa1ee0db07d5d314f447f88f895369ea8892d717b5879</code>
|
||||
|
||||
Scan de code of tik op de factuur om hem te kopiëren. Geldig voor 10 minuten.
|
||||
[Openen in wallet]
|
||||
[Betaling controleren] [Annuleren]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Betalen met Telegram Stars</b>
|
||||
Dezelfde passen en hetzelfde tegoed, betaald met je Stars-saldo in Telegram.
|
||||
[Dagpas · ⭐ 50] [Weekpas · ⭐ 200]
|
||||
[Maandpas · ⭐ 600]
|
||||
[1.000 sats · ⭐ 70] [5.000 sats · ⭐ 330] [20.000 sats · ⭐ 1.300]
|
||||
[⚡ Betalen met Lightning]
|
||||
```
|
||||
|
||||
editMessageText
|
||||
|
||||
```
|
||||
<b>Passen en tegoed</b>
|
||||
|
||||
Een <b>pas</b> verhoogt je limieten naar 1,95 GB en 3 uur per download en zet je in de voorrangswachtrij zolang hij loopt.
|
||||
|
||||
<b>Tegoed</b> betaalt per download, 50 sats per stuk, met dezelfde limieten en voorrang. Het verloopt nooit.
|
||||
|
||||
Je betaalt in sats via Lightning.
|
||||
[Dagpas · 700 sats] [Weekpas · 3.000 sats]
|
||||
[Maandpas · 9.000 sats]
|
||||
[1.000 sats] [5.000 sats] [20.000 sats]
|
||||
[⭐ Betalen met Stars]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user