Recover a Lightning invoice after checkout times out
If the checkout connection drops while creating a BOLT11 invoice, the node may already have committed it. A stable order label lets the shop recover the original invoice.
Look up the order before retrying
In a test setup, use the same label for a logical order across all retries. This query retrieves an existing invoice without creating another payment request.
lightning-cli listinvoices order-1042 | jq '.invoices[] | {label, amount_msat, status, expires_at, bolt11}'
Choose the response for each state
If an unpaid invoice exists, verify its amount and expiry before returning its original bolt11. A paid record means checkout should reconcile the order. If it expired, create a separate replacement attempt under a new label linked to the same order. A uniqueness error from simultaneous creators is a reason to read the winning record.
docs.corelightning.org listinvoices · docs.corelightning.org invoice