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

# Create payment link


`POST /v1/payment_links`

Send the `url` from the response to whoever is paying. `expiresAt` is optional and defaults to 30 days out; a link always expires, and the expiry is checked when the page is opened rather than by a job, so there is no window where a dead link still pays. Amounts are integers in the minor unit — 4999 is $49.99. A decimal is rejected rather than silently charged as a different figure.

Auth: a secret key with the `paymentLinks.create` permission. Returns `201` with Payment link.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `amount` | body | integer · integer · minor units | Yes | A non-negative integer in the currency’s minor unit. 4999 represents $49.99. |
| `currency` | body | string · ISO 4217 | Yes | A three-letter ISO 4217 currency code. |
| `description` | body | string | No | A merchant-visible description of the resource. |

## Request

**curl**

```curl
curl -X POST "https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links" \
  -H "Authorization: Bearer $MYELA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "amount": 2500,
  "currency": "USD",
  "description": "Deposit"
}'
```

**Node**

```node
const res = await fetch("https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYELA_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    "amount": 2500,
    "currency": "USD",
    "description": "Deposit"
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  // Branch on error.code — never on error.message.
  throw new Error(error.code);
}
const data = await res.json();
```

**Python**

```python
import os
import uuid
import requests

res = requests.post(
    "https://payments-api-sandbox.merchantservicedepot.com/v1/payment_links",
    headers={
        "Authorization": f"Bearer {os.environ['MYELA_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "amount": 2500,
        "currency": "USD",
        "description": "Deposit"
    },
)

if not res.ok:
    # Branch on error["code"] — never on error["message"].
    raise RuntimeError(res.json()["error"]["code"])
data = res.json()
```

## Response

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique payment link identifier. |
| `object` | "payment_link" | Stable resource discriminator. |
| `status` | string | One of active, paid or cancelled. There is no expired status — expiry is decided by comparing expiresAt when the page is opened. |
| `amount` | integer | Amount to collect, in minor units. |
| `currency` | string | Three-letter ISO currency code. |
| `url` | string | The page to send the payer to. Hosted on a Myela domain — never a provider's. |
| `description` | string | What the payer is paying for. Shown on the page. |
| `expiresAt` | string | When the link stops accepting payment. Always present. |
| `paidAt` | string | When the link was paid. Present once it has been. |
| `paymentId` | string | The payment that settled this link. |
| `pendingConfirmation` | object | Present only while a charge on this link is unresolved. The link still reports active; every further attempt is refused, and so is cancelling it (409, `details.code` `PAYMENT_PENDING_CONFIRMATION`), until the named payment is reconciled, and still afterwards if it resolved as authorized but never captured. |
| `createdAt` | string | When the link was created. |

```json
{
  "id": "plink_01JEXAMPLE",
  "object": "payment_link",
  "status": "active",
  "amount": 2500,
  "currency": "USD",
  "url": "https://example.com/pay/9Yb3xK1t0QWEs7vLzR2mNc4h",
  "description": "Deposit",
  "expiresAt": "2026-12-01T00:00:00.000Z",
  "paidAt": "2026-09-14T18:04:11.000Z",
  "paymentId": "pay_01JEXAMPLE",
  "pendingConfirmation": {
    "paymentId": "pay_01JEXAMPLE",
    "since": "2026-09-14T18:04:11.000Z"
  },
  "createdAt": "2026-09-01T12:00:00.000Z"
}
```

Source: https://docs.merchantservicedepot.com/api-reference/create-payment-link/
