# Pay by link

> Create a payment link for an invoice so the buyer can pay online; Alya Books records the payment when the gateway confirms it.

Source: /help/en/invoices/pay-by-link

A payment link is a public page for one invoice where the buyer pays the outstanding amount by card or bank transfer through your payment gateway. When the gateway confirms the payment, Alya Books records it on the invoice, marks the invoice paid, and sends the `payment_link.paid` webhook.

You need at least one active gateway under **Settings → Payments** (see [Online payments](/help/en/settings/online-payments)).

## Create a link

1. Open an issued invoice (validated or later; drafts and credit notes cannot have links).
2. In the **Pay by link** card click **Create link**. If you have several gateways, pick one first.
3. Copy the link, or open it to see what the buyer sees.

The link covers the outstanding amount at the moment you create it and expires after 30 days. While a pending link exists, **Send by email** adds a **Pay now** button to the invoice email automatically.

## What the buyer sees

The pay page shows your company, the invoice number, amount due and a **Pay** button that opens the gateway's checkout. After paying, the buyer returns to the page and sees *Payment received*. Test-mode gateways show a *TEST* badge; the simulated gateway shows **Simulate payment** and **Simulate failure** buttons instead of a checkout.

## Statuses

| Status | Meaning |
|---|---|
| pending | Created, not paid yet |
| paid | The gateway confirmed the payment; a payment with method *online* and source *gateway* is on the invoice |
| failed | The buyer's attempt failed; create a new link |
| expired | 30 days passed; create a new link |
| cancelled | You cancelled it from the card |

A link is settled once: a second notification from the gateway is ignored. Test invoices can only use test-mode or simulated gateways.

## Related

- [Online payments (gateways)](/help/en/settings/online-payments)
- [Payments and payment status](/help/en/invoices/payments-and-payment-status)
