# Payment on the phone

> The patient gets a payment link by SMS and pays whenever it suits them.

The patient has already left, the visit was online, or there is no device. The journal creates the order exactly as usual, and Rivr texts a payment link to the patient's phone. Most pay within minutes. Those who don't get a reminder, and eventually an invoice.

- Market: Sweden (`se`). Norway differs in currency, payment methods and what happens when nobody pays: https://developers.rivr.io/guides/pay-by-link.md?market=no
- Language: English (`en`). Svenska: https://developers.rivr.io/guides/pay-by-link.md?lang=sv
- 5 min read · 5 steps
- Page in the portal: https://developers.rivr.io/guides/pay-by-link

Every example targets the sandbox (`https://api.test.rivr.io`) and needs test credentials. A platform client's tokens come from `https://auth.test.rivr.io`, an organisation key's from `https://auth.test.rivr.tech`.

## 1. Create the order

*Journal system → Rivr*

The same `PUT /api/public/orders/{id}` as at the clinic, without the `device` hint. Include the patient's `phone` — that is where the link goes.

**Why:** How an order reaches the patient is **the clinic's setting** at Rivr, not a parameter in the call. So the journal doesn't need to know whether the clinic runs a device, SMS or both — it just creates the order.

> **Warning.** Which of `personalNumber`, `phone` and `email` are required depends on the clinic's setting. If one is missing Rivr answers `422`, for example `errorCode: "phone_required"`. Send a currency other than the clinic's and Rivr answers `422 currency_not_supported`.

**Order status:** `Created` · **The journal shows:** Unpaid

**Request:** `PUT /api/public/orders/7b1e7c3a-2f4d-4a51-9c7e-5d0a6b8e2c14` · Merchant token · [Reference](https://developers.rivr.io/reference/api-public/createOrder.md)

```bash
curl -X PUT https://api.test.rivr.io/api/public/orders/7b1e7c3a-2f4d-4a51-9c7e-5d0a6b8e2c14 \
  -H "Authorization: Bearer $MERCHANT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "id": "7b1e7c3a-2f4d-4a51-9c7e-5d0a6b8e2c14",
  "merchantId": "MERCHANT_ID",
  "reference": "visit-48213",
  "personalNumber": "195001182046",
  "phone": "+46701740605",
  "email": "patient@example.com",
  "currencyCode": "SEK",
  "orderLines": [
    {
      "description": "Samtal 45 min",
      "quantity": 1,
      "unitPriceExclVat": 950,
      "vatPercentage": 0,
      "discountExclVat": 0
    }
  ],
  "callbackUrl": "https://journal.example.com/webhooks/rivr",
  "metadata": { "bookingId": "48213" }
}'
```

**Webhook to you** (`Created`)

```http
POST /webhooks/rivr
Content-Type: application/json
Rivr-Signature: t=1789640080,v1=5f2b0c…

{
  "id": "7b1e7c3a-2f4d-4a51-9c7e-5d0a6b8e2c14",
  "type": "Order",
  "merchantId": "MERCHANT_ID",
  "status": "Created",
  "data": {
    "CreatedDate": "2026-09-17T09:12:03Z",
    "Reference": "visit-48213",
    "Metadata": { "bookingId": "48213" }
  }
}
```

## 2. Rivr texts the payment link

*Rivr → Patient · at once*

The patient gets a text with a link to the payment. There they pick a payment method, just like on the device.

**What your system does:** Nothing. The journal still shows unpaid.

> **Note.** If the clinic runs the credit check when the order is created and the patient is approved, they instead get a text saying the invoice is on its way — without a link.

## 3. The patient pays

*Patient → Rivr · +5 min*

When the patient pays, `Completed` arrives within seconds — exactly as at the clinic.

**What your system does:** Mark the visit as paid and move the receivable to Rivr.

**Order status:** `Completed` · **The journal shows:** Paid

**Webhook to you** (`Completed`)

```http
POST /webhooks/rivr
Content-Type: application/json
Rivr-Signature: t=1789640080,v1=5f2b0c…

{
  "id": "7b1e7c3a-2f4d-4a51-9c7e-5d0a6b8e2c14",
  "type": "Order",
  "merchantId": "MERCHANT_ID",
  "status": "Completed",
  "data": {
    "CreatedDate": "2026-09-17T09:12:03Z",
    "Reference": "visit-48213",
    "CompletedDate": "2026-09-17T09:14:40Z",
    "PaymentMethod": "Swish",
    "Metadata": { "bookingId": "48213" }
  }
}
```

## 4. No payment? A reminder

*Rivr → Patient · +24 h*

If the patient hasn't paid, they get a reminder by SMS: pay now, or it becomes an invoice (a credit check may be made). In the standard Swedish flow the reminder comes after **24 hours**.

**Why:** Most people who don't pay straight away have simply forgotten. A reminder is cheaper for everyone than an invoice.

**What your system does:** Nothing. The reminder doesn't change the order's status and sends no webhook.

**Order status:** `Created` · **The journal shows:** Unpaid

## 5. Still unpaid? An invoice

*Rivr → Patient · +30 h*

A few hours later — **30 hours** in the standard flow — Rivr turns the order into an invoice. What the journal sees then depends on the credit check. That has its own guide.

> **Note.** The timings are the clinic's setting at Rivr, and the reminder and invoice require the patient's identity to be verified — otherwise the order stays unpaid. Never build logic on an order changing status after a fixed time. React to the webhook.

## Common pitfalls

- Sending your own reminder from the journal. The patient then gets two — and Rivr's reminder is the one that leads to the invoice.
- Giving up on the order in the journal after a while without calling Rivr. Rivr then keeps pursuing a payment you think is done.
- Updating an unpaid order with a new `PUT` to change the amount. Cancel it and create a new order instead, so the reminder and invoice follow the new one.

## Next guide

- [When the patient doesn't pay right away](https://developers.rivr.io/guides/unpaid.md): Invoice, credit check and recourse — and why Completed can take a month.
- [Cancel and refund](https://developers.rivr.io/guides/cancel-refund.md): Cancel an unpaid order, pay back a paid one — and wait for the webhook.
