> Index of every page: https://docs.merchantservicedepot.com/llms.txt

# Payment links

> A hosted page you can send to anyone, no front end required.

A payment link collects a fixed amount, once, from anyone who has its URL. There's no customer record, invoice number, line items, or due date. You create the link, send the URL, and Myela hosts the page where the payer enters a card.

## Create a link

Send an amount, a currency, and an optional description. The response includes a `url`. Email it, text it, or render it as a QR code.

**Node**

```ts title="server.ts"
const link = await myela.gateway.paymentLinks.create({
  amount: 2500,
  currency: 'USD',
  description: 'Deposit',
  expiresAt: '2026-12-01T00:00:00.000Z', // optional; defaults to 30 days
});
sendEmail(link.url);
```

**cURL**

```bash title="terminal"
curl -X POST https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links \
  -H "Authorization: Bearer myela_sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 2500, "currency": "USD", "description": "Deposit" }'
```

| Field | Required | Means |
| --- | --- | --- |
| `amount` | Yes | Integer in minor units, greater than 0. |
| `currency` | Yes | Three-letter code. Only two-decimal currencies. |
| `description` | No | Shown to the payer. |
| `expiresAt` | No | ISO 8601 timestamp. Defaults to 30 days from now. Must be in the future. |

An `expiresAt` that isn't in the future is a `422` with `details.code` `INVALID_EXPIRY`. If you hardcode a date, it will eventually start failing; compute it from the current time or leave it out. Links are hosted by Myela, so they work the same whatever the account's provider supports.

## What the payer sees

The URL opens a page on a Myela domain. It shows your business name, the amount, the description, and when the link expires. There's no tip, invoice number, or line items. The payer types the card into hosted fields, so the card goes from their browser to the provider and never passes through your server.

Anyone holding the URL can pay it. Treat it like a password: send it only to the person who owes the money.

When the link can't take a payment, the page says why:

| State | Page title |
| --- | --- |
| Expired | This payment link has expired |
| Cancelled | This payment link was cancelled |
| Charge being confirmed | This payment is being confirmed. The payer is told not to pay again. |

## Statuses

A link has three statuses. There is no `expired`.

| status | Means |
| --- | --- |
| `active` | Not paid and not cancelled. Not a promise that it can be paid. |
| `paid` | Paid once. paidAt and paymentId are set. |
| `cancelled` | You cancelled it. It can't be paid or reopened. |

`active` doesn't mean the link can be paid. An expired link still reads `active`, because expiry is checked when the page opens. After 10 failed attempts, the link stops accepting payment and still reads `active`. While a charge on the link is unresolved, it reads `active` and carries `pendingConfirmation` with the `paymentId` and `since`. Check `expiresAt` and `pendingConfirmation` before you tell anyone a link is open.

## Know when it's paid

There's no webhook event for payment links. Read the link and look for `status` `paid`. A paid link also carries `paidAt` and the `paymentId` of the payment that paid it.

```bash title="terminal"
# Read the link
curl https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links/{id} \
  -H "Authorization: Bearer myela_sk_test_…"

# Cancel it (no body)
curl -X POST https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links/{id}/cancel \
  -H "Authorization: Bearer myela_sk_test_…"
```

`GET /v1/payment_links` lists your links. Filter by `status` (`active`, `paid` or `cancelled`), and page through it with `limit` and `startingAfter`. More in [Pagination](https://docs.merchantservicedepot.com/docs/platform/pagination/).

## Cancel or change a link

A link can't be edited. The amount is fixed when you create it. To change anything, cancel the link and create a new one. Cancel is final: a cancelled link can't be paid or reopened, and the payer sees that it was cancelled.

Cancelling a link that's already cancelled returns the link with no error, so a retry is safe. The other conflicts come back as `409` with a `details.code`:

| details.code | When |
| --- | --- |
| `PAYMENT_LINK_ALREADY_PAID` | You tried to cancel a link that was already paid. |
| `CONCURRENT_MODIFICATION` | A payment landed while the cancel was in flight. |

After a `CONCURRENT_MODIFICATION`, read the link to see where it ended up before you do anything else.

Source: https://docs.merchantservicedepot.com/docs/payments/payment-links/
