Derive a BOLT11 invoice deadline before offering payment
A Lightning invoice encodes its creation timestamp and a lifetime in seconds. A payment form can calculate the absolute deadline locally before requesting a route.
Read the signed request fields
Set BOLT11 to the encoded invoice. Decode it on your intended network and inspect its type and validity before using the BOLT11-specific fields.
lightning-cli decode "$BOLT11" | jq '{type, valid, currency, created_at, expiry, deadline: (.created_at + .expiry)}'
Calculate the remaining window
For an invoice created at Unix time 1,700,000,000 with expiry 900, the deadline is 1,700,000,900. Compare it with a reliable current Unix timestamp and leave time for routing. A still-valid signature and a future deadline provide no evidence that the receiver is online or will accept a payment.