# Host the fibre customer portal

> Embed accessible account components, let customers check a sealed invoice and provide a public cancellation form with a durable receipt.


A customer can open their expected bill, inspect the dates behind a charge, check the sealed invoice and raise an objection against a single line. The portal also shows appointments, disruptions and switching progress for each connection. Its five web components can run together or inside an operator's existing customer website. For your own application, use the same headless API. [Customer portal API](../docs/portal-api/)

Under **Störung und Entschädigung**, open the incident to see its current status. Select an intake or look up the UUID on a saved **Eingangsbeleg**. The downloadable text identifies the selected receipt, its channel and the original Berlin time. [Outage claims and receipts](../docs/service-status/#resolve-a-total-fibre-outage)

## Try a seeded fibre account

Start the local estate with `just demo`. In the Desk, open a fibre customer under **Konto** and copy the billing-account UUID. Use a test account that has a sealed invoice.

```sh
export TELCO_SELFCARE_ACCOUNT="replace-with-the-billing-account-uuid"
export TELCO_SELFCARE_TOKEN="$(openssl rand -hex 24)"
export TELCO_SELFCARE_PASSWORD="$(openssl rand -hex 12)"
just selfcare
```

Open `http://127.0.0.1:9407`, choose **Anmelden**, and enter the value of `TELCO_SELFCARE_PASSWORD`. The service credential stays between the sign-in adapter and the services. Use the same three variables to restart the local example. Only the selected account is available through this sign-in. [See the signed-in portal at 320 pixels](../screenshots/selfcare-phone.png).

1. Open a sealed invoice in **Meine Rechnungen**. Open the accessible HTML invoice or save the original PDF. Compare it with the English and Leichte Sprache readings. Each reading uses the same amounts, due date and line identities.
2. The QR on the HTML invoice or printed PDF opens that invoice after sign-in. Select **Rechnung nachrechnen** to obtain a time-limited verification link. Anyone with that link can see its masked evidence. Open it to compare the sealed lines with the recalculation. The server provides the result without JavaScript. For price books the operator publishes in full, the recipient can also run the calculation locally. Revoke the link from the invoice when sharing ends.
3. Select **Position beanstanden** on the relevant line. Save the receipt. **Mein Postfach** keeps the objection with the invoice reference and the operator's answer. The plan comparison is a preview and leaves the subscription unchanged.
4. Under **Anschluss & Termine**, distinguish an estimated entitlement from an approved or posted credit. A selective block shows as requested until the network confirms the change. The dates and next step come from the service that received the operator's facts.

On a sealed invoice choose **Einzelverbindungsnachweis anzeigen** to see eligible calls or save the separate PDF. [Itemised calls](../docs/voice-itemisation/)

## Public cancellation and confirmation

Publish **Verträge hier kündigen** anywhere customers can conclude an eligible contract online. Link directly to `/kuendigen` on the customer origin. The visitor identifies the contract, reviews the declaration and submits it with **Jetzt kündigen**. The signed-out flow works without JavaScript and returns a dated, savable receipt. The operator can review unmatched declarations without exposing its contract directory. [BGB § 312k](https://www.gesetze-im-internet.de/bgb/__312k.html)

Set contractd's `TELCO_CONFIRMATION_URL` and `TELCO_CONFIRMATION_TOKEN` to your transactional mail adapter. For each delivery, accept the declaration UUID as its idempotency key and return a stable dispatch reference after durable acceptance. Failed deliveries remain queued. Monitor pending confirmations during operation.

In the local example the mail sink saves the exact recipient, subject and text to a private Docker volume. To inspect the test message, run the following with the declaration UUID from the receipt. Production deployments must connect a sender that actually delivers electronic confirmations to consumers.

```sh
docker compose -f compose.yaml -f deploy/selfcare/compose.yaml exec mailbox \
  cat "/home/node/outbox/$DECLARATION_ID.json"
```

## Connect an existing customer website

Serve the files in `web/selfcare/public` from the customer origin. Load the stylesheet and module once. Include the components that belong on the page. Keep the public cancellation link outside regions that require sign-in.

```html
<link rel="stylesheet" href="/selfcare.css">
<script type="module" src="/selfcare.js"></script>
<telco-session></telco-session>
<h2>Meine Rechnungen</h2>
<telco-bills></telco-bills>
<h2>Mein Anschluss</h2>
<telco-service></telco-service>
<h2>Tarifvergleich</h2>
<telco-plan-preview></telco-plan-preview>
<h2>Mein Postfach</h2>
<telco-mailbox></telco-mailbox>
<a href="/kuendigen">Verträge hier kündigen</a>
```

Use the supplied customer Caddyfile on its own origin. At the TLS ingress retain the external host and set `SELFCARE_HOST` and `SELFCARE_ORIGIN` to the public hostname and HTTPS origin. Configure these upstreams on a trusted network:

| Setting | Owner and responsibility |
|---|---|
| `SELFCARE_AUTH` | The operator's sign-in adapter serves `GET /session` with `{"account":"<UUID>"}` or 401, handles `/login` and `POST /logout`, and exposes an internal `GET /authenticate` to the edge. On an authenticated check it returns `X-Telco-Customer-Authorization: Bearer <scoped key>`. |
| `PORTALD_URL` | Private customer gateway. The edge supplies the credential from the current session on each private request. |
| `BILLD_URL`, `CONTRACTD_URL` | Public verification and cancellation upstreams for the customer edge. The gateway uses `TELCO_BILLD_URL` and `TELCO_CONTRACTD_URL` to reach the private APIs. Configure the same customer identity at both owners. |
| `TELCO_SELFCARE_ORIGIN` | billd uses this configured customer origin for absolute verification links and QR codes. |
| `TELCO_PUBLIC_REPLAY_BOOKS` | Explicit list of complete price books billd may disclose for browser-local verification. The local example publishes `example-fibre@2026-11`. |

The development password adapter is for the loopback example. Use the operator's session service in deployment and keep the internal authentication response out of browser responses and proxy logs. When the host application switches accounts, invoke the module's exported `refreshSession()`. Serve the matched release's WASM at `/nachrechnen/telco.wasm`.

## Accessibility and rollout

Run `just selfcare-check` for the browser and edge checks. Before rollout, test keyboard and screen-reader use in the actual host page, including signing in, reading an invoice, submitting an objection, saving the attachment and cancelling without JavaScript. Review the Leichte Sprache reading with intended readers. Record the browser, assistive technology, task and observed outcome, including any help required. The host's sign-in, navigation and support channels are part of the customer journey. [BFSGV § 12](https://www.gesetze-im-internet.de/bfsgv/__12.html)
