> For the complete index of the 402pay docs, see [llms.txt](https://developer.402pay.co/llms.txt).

# Payment links

Reusable hosted checkouts with a fixed price that you can share anywhere.

Payment link

No code

- **Code needed**: None
- **Time**: Minutes
- **Customization**: The link's name, price and currency, plus your checkout settings
- **Best for**: One price for many customers, such as a product, a donation or a fixed invoice

A link is a reusable hosted checkout with a fixed price. Create one in the dashboard or with [`POST /links`](https://developer.402pay.co/api/links/create.md), then share its `url` anywhere: your site, an invoice, a chat or a QR code.

Create a link, cURL:

```bash
curl -X POST "https://dash.402pay.co/api/v1/links" \
  -H "Authorization: Bearer $PAY402_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Team plan, monthly",
    "amount": 19900,
    "currency": "USD"
  }'
```

Create a link, Node.js:

```js
const response = await fetch("https://dash.402pay.co/api/v1/links", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAY402_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Team plan, monthly",
    amount: 19900,
    currency: "USD"
  }),
});
const { data } = await response.json();
```

Create a link, Python:

```python
import os

import requests

response = requests.post(
    "https://dash.402pay.co/api/v1/links",
    headers={
        "Authorization": f"Bearer {os.environ['PAY402_SECRET_KEY']}",
    },
    json={
        "name": "Team plan, monthly",
        "amount": 19900,
        "currency": "USD"
    },
)
data = response.json()["data"]
```

## How links work

Every visit to a link makes its own payment, so one link can be paid any number of times.

- Payment link (one url, reused) → Payment (with the link_id)
- Payment (with the link_id) → succeeded (paid in full)
- Payment (with the link_id) → failed (canceled, final)
- Payment (with the link_id) → expired (the quote ran out)
- expired (the quote ran out) → Payment link (one url, reused): the next visit starts a new payment

- Price it in USD, EUR, GBP, CAD and AUD. Customers pay the equivalent in the coin they choose.
- Every payment made through a link carries its `link_id`, so `GET /payments?link_id=…` lists them.
- Archive a link to stop taking payments without losing its history. A checkout a customer already opened keeps working, so they can still finish paying or send the rest.
- A link's payment lasts as long as its quote. If the quote expires before anything arrives, the payment is `expired`, and the customer's next visit starts a new one.
- If the customer cancels at checkout, the link's payment is `failed` and you receive `payment.failed`. Unlike a payment you create through the API, it can't be paid again.
- A link's payments can have their remainder requested when a customer sends too little.

## Links or payments

| Use | When |
| --- | --- |
| A payment link | One price for many customers, shared without code, such as a product or a donation. |
| An API payment | One order for one customer, with your own reference and metadata, created by your server. |
