Free events (price_per_ticket=0) fail at checkout — LNbits rejects amountless invoices #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When an organizer creates an event with
price_per_ticket = 0, the buyflow still routes through
create_payment_requestto generate abolt11 invoice. LNbits doesn't support amountless invoices, so the
request fails and the buyer never gets a ticket.
This affects both single-ticket and multi-ticket purchases (multi
just multiplies 0 × N = 0, so same failure).
Proposed fix
When
unit_price * quantity == 0after promo application, skip theinvoice flow entirely:
create_payment_request.payment_hash(e.g.urlsafe_short_hash()—stays consistent with the multi-ticket id scheme).
paid = Trueimmediately, sharedpayment_hash, distinct short-hash ids.set_ticket_paidcounter update + Nostr republishfor each row (or batch them through the same per-event lock).
send_ticket_notification_in_background) thesame way the invoice-paid path does.
TicketPaymentRequestwithpayment_request = None,is_fiat = False, and the populatedticket_idsso the webappknows it's a paid-no-payment ticket and jumps straight to the
success screen.
Companion webapp work (
aiolabs/webapp,app:activities)The buy dialog should detect
price_per_ticket * quantity == 0and:payment_request,skip the invoice-display screen and go directly to the success
modal.
Out of scope
same skip-invoice path applies. No special handling needed.
discount is applied before the
unit_price * quantity == 0checkso this works automatically.
Test plan
price_per_ticket = 0. Buy 1 → ticket landspaid in My Tickets, no invoice, no wallet charge.
event.sold += 5,amount_tickets -= 5. Nostr event republishedwith new counters.
free.