> Source: https://developers.terrawallet.us/docs/pay/payment-links . Terra Wallet developer docs (early access).

# Payment links

A payment link is a reusable URL, `https://pay.terrawallet.us/l/plink_...`, that anyone can open to pay you. No
code is needed on your side: share it in a message, an email, a bio or a QR code.

> **Preview.** The API is in early access and may change before launch.

## Create one

`POST /v1/payment_links`:

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | string | yes | What the customer is paying for |
| `amount` | decimal string | one of | A fixed amount, for example `"25.00"` |
| `customer_chooses` | boolean | one of | `true` lets the customer choose the amount (tips, donations) |
| `currency` | string | yes | A fiat ISO code |
| `accepted_assets` | array of assets | yes | See [Payment intents](https://developers.terrawallet.us/docs/pay/payment-intents.md#assets) |
| `max_uses` | integer | no | Stop accepting payments after this many |
| `expires_at` | timestamp | no | Stop accepting payments after this time |

Send either `amount` or `customer_chooses: true`.

```bash
curl https://terrawallet.us/api/v1/payment_links \
  -H "Authorization: Bearer $TERRA_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: link-workshop-ticket" \
  -d '{
    "name": "Workshop ticket",
    "amount": "25.00",
    "currency": "USD",
    "accepted_assets": [
      { "chain": "polygon", "symbol": "USDC", "contract": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", "decimals": 6 }
    ],
    "max_uses": 50
  }'
```

Response:

```json
{ "id": "plink_...", "url": "https://pay.terrawallet.us/l/plink_..." }
```

## What happens when someone pays

Each visit creates its own payment intent from the link (the page calls `POST /v1/checkout/plink_.../intents`
with the chosen asset, and the quantity or amount where the link allows it). From there it is a normal payment
intent: an exact quote, on-chain verification and a `payment_intent.succeeded` webhook.

## Open standards

Payment requests use the standard URI formats wallets already understand where they fit: EIP-681 on EVM chains,
BIP-21 for Bitcoin, Solana Pay and TRON URIs.
