# Payment Link Flow

> Complete sequence diagram for the no-code Payment Link flow. Merchant creates a product, shares a link, and customers pay via Lightning — no coding required.

Source: https://www.satsrail.com/developers/guides/flows/payment-link/

No code. Create a product, share a link, get paid in Bitcoin.

## Flow Overview

The Payment Link is the simplest SatsRail integration — zero code. A merchant creates a product in the dashboard, gets a shareable URL ( `satsrail.com/pay/your-product` ), and distributes it anywhere. When a customer opens the link, a checkout session is auto-created and they pay via Lightning. Funds settle directly to the merchant's wallet.

Every active product has one. Merchants make and share them on the dashboard's Payment Links page; in the API, every product carries its link as `payment_link_url` (null while the product is inactive), and `POST /api/v1/m/products` needs only a name and a price. AI agents use the MCP tool `create_payment_link`.

## Step-by-Step Detail

#### Merchant Setup

##### 1. Log In & Create Product

The merchant logs into the SatsRail Dashboard and navigates to Products → Create Product. They fill in:

- **Product name:** displayed on the checkout page (e.g., "Monthly Subscription")
- **Description:** shown below the product name
- **Price (USD):** the fiat amount to charge (converted to sats at payment time)
- **Image:** optional product image displayed on checkout

##### 2. Connect Lightning Wallet

The merchant connects their Lightning wallet to receive payments directly. Supported connection methods:

- **LNDHub:** Compatible with BlueWallet, Zeus, and others
- **LNURL:** Universal Lightning address (e.g., user@wallet.com)
- **Connection string:** Direct LND/CLN node connection

> **Non-custodial:** SatsRail connects to the merchant's wallet but never has access to funds. Payments go directly from customer → merchant.

##### 3. Get Payment Link

SatsRail generates a unique product slug and payment link:

```
https://satsrail.com/pay/prod_abc123def456
```

The dashboard also provides:

- **QR code:** downloadable QR code encoding the payment link URL
- **Embed snippet:** `<script>` tag for embedding a pay button on any website

##### 4. Distribute the Link

The merchant shares the payment link through any channel:

- **Email / SMS:** Paste the URL directly
- **Social media:** Post on Twitter, Instagram, etc.
- **WhatsApp / Telegram:** Share in chat
- **Printed QR:** Print the QR code for in-store or event use
- **Website:** Add as a simple hyperlink

---

#### Customer Payment

##### 5. Customer Opens Link

Customer clicks the link or scans the QR code. The browser navigates to `satsrail.com/pay/prod_abc123`. SatsRail looks up the product by slug, validates it's active, and auto-creates a CheckoutSession. The customer is redirected to the checkout page.

##### 6. Customer Info

If the merchant configured customer info collection:

- Customer fills in email, name, phone, and/or shipping address (as configured)

If no customer fields are configured, this step is skipped entirely — straight to QR code.

##### 7. Invoice Generated & QR Displayed

SatsRail converts USD → sats at the real-time exchange rate, requests a Lightning invoice from the merchant's wallet, and displays:

- Product name, description, and image
- Price in USD and sats
- QR code encoding BOLT-11 invoice
- Copy button for desktop wallets
- 15-minute countdown timer

##### 8. Customer Pays via Lightning

Customer scans the QR with their wallet app, copies the invoice to a desktop wallet, or pays via WebLN browser extension. Payment routes through Lightning channels and settles instantly to the merchant's wallet.

##### Confirmation

The checkout page updates to show "Paid ✓". Based on configuration:

- Redirect to merchant's custom success URL
- Show a receipt with transaction details
- Trigger digital delivery (download link, license key, etc.)

Webhooks fire asynchronously if configured. Transaction is logged in the merchant's dashboard with amount, timestamp, exchange rate, and payment hash.

## Error Paths

| Error | Trigger | User Experience | Recovery |
| --- | --- | --- | --- |
| 404 Not Found | Product slug doesn't exist or product is deactivated | Customer sees a "Product not found" error page | Merchant reactivates product or shares correct link |
| Wallet Disconnected | Merchant's Lightning wallet connection is broken or expired | Customer sees "Merchant cannot receive payments at this time" | Merchant reconnects wallet in Dashboard settings |
| Invoice Expired | 15-minute countdown reaches zero | Checkout shows "Expired" with option to regenerate | Customer clicks "Generate New Invoice" — new rate applied |
| Routing Failure | No Lightning route to merchant's node | Error shown on checkout page | Customer retries payment |

## Start selling with a link

Create a product, share the URL, and accept Bitcoin — zero code required.

[Embed Button Docs →](https://www.satsrail.com/developers/guides/embed/) [Embed Widget Flow →](https://www.satsrail.com/developers/guides/flows/embed-widget/)
