> For the complete documentation index, see [llms.txt](https://docs.sms4sats.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sms4sats.com/getting-started/hold-invoices.md).

# Hold Invoices & Payment Safety

Understand when sms4sats Lightning hold invoices settle or release.

A Lightning hold invoice lets the receiver accept a payment without immediately settling it. The funds remain locked until sms4sats either settles the invoice with its preimage or releases it.

{% hint style="info" %}
The hold-invoice model applies to bearer-token receive-SMS orders, bearer-token rental orders, and email activations. L402 uses standard Lightning invoices. Receive-SMS and reactivation orders use a separate refund-invoice flow; paid L402 rentals have no refund flow.
{% endhint %}

## Receive SMS

```
invoice paid
  → number allocated
  → SMS received
  → hold settled
```

If allocation fails, the order expires, or an eligible cancellation completes, the held payment is released after the order outcome is confirmed. Keep polling while the order remains pending.

## Email activation

```
invoice paid
  → email assigned
  → provider returns a code or message
  → hold settled; order completed
```

Allocation failure, cancellation, and timeout can release the hold. A successful manual cancellation confirms the payment release. Poll the order and check your wallet rather than assuming release from elapsed time alone.

## Number rentals

The rental hold invoice settles when the number is allocated—not when a later SMS arrives. Manual cancellation is available only before payment; any paid browser rental is not manually cancellable.

## What “released” means

A released hold was never finally transferred to sms4sats. Most wallets restore the amount to the spendable balance automatically. Wallet interfaces may briefly show the payment as pending while the release propagates.

## Integration rules

1. Display `priceSats` from the creation response, not a locally calculated price.
2. Treat payment as pending until the order API reports progress.
3. Follow server-provided state and cancellation fields.
4. Keep polling through transitional states such as `settlement_pending`, `release_pending`, and `cancelling`.
5. Stop only on a terminal state.
6. For bearer-token SMS/rental creation only, retry an ambiguous response with the same idempotency key. Email and L402 creation do not support idempotency keys and must not be retried blindly.
