diff --git a/views_api.py b/views_api.py index c288c20..e7c118f 100644 --- a/views_api.py +++ b/views_api.py @@ -612,15 +612,15 @@ async def api_ticket_create( extra=extra, ), ) - # Multi-ticket purchases land as N rows sharing the LNbits invoice - # payment_hash but with distinct `id`s — one independently - # scannable QR per attendee. The first row reuses payment_hash as - # its id so the legacy single-purchase invariant - # (`id == payment_hash`) still holds for quantity == 1 callers. + # Each row gets a fresh urlsafe_short_hash id so single- and + # multi-ticket purchases stay shape-consistent — every scannable + # ticket id is a short hash, never the long bolt11 payment_hash. + # The shared `payment_hash` column is the join key for invoice + # lookup (poll endpoint, ws notifier, set_ticket_paid loop). ticket_ids: list[str] = [] sats_per_ticket = payment.sat // quantity if quantity else payment.sat - for index in range(quantity): - row_id = payment.payment_hash if index == 0 else urlsafe_short_hash() + for _ in range(quantity): + row_id = urlsafe_short_hash() await create_ticket( payment_hash=payment.payment_hash, wallet=event.wallet,