# Customer portal

> Give payers a link where they can see and download their invoices, and pay open ones.

Source: https://docs.borga.is/billing/customer-portal

The customer portal is a page on `checkout.borga.is` that lists one customer's invoices for your merchant, with PDF downloads from your accounting provider and a **Pay** button on open ones. Payers do not need an account: you mint a short-lived link and send it to them.

## Create a portal link

```ts Node.js
const portal = await borga.customerPortals.create({
  customer: "cus_8Jk2Lm4Np6Qr8St0Uv2Wx4Yz",
  expires_in: 3600, // seconds; up to 24 hours
  reusable: true,
});

// Link or email portal.url to the customer.
console.log(portal.url); // https://checkout.borga.is/portal/cprt_…
```

| Field | Purpose |
| --- | --- |
| `customer` | The customer whose invoices to show. |
| `expires_in` | Seconds until the link stops working. Default 3600 (one hour), minimum 60, maximum 86400 (24 hours). |
| `reusable` | Default `true`. Set `false` for a link that is consumed on first open. |
| `metadata` | Anything you want to remember, for example which email it was sent in. |

The response's `url` is the link to share, and its `status` is `active`, `expired`, `revoked` or `consumed`. Revoke a link early with `DELETE /v1/customer_portals/:id`.

Portal links can only be created with a secret key. Mint them on your server when a customer asks for their invoices, when you send a billing email, or behind a "My invoices" button in your own app.

## What the payer sees

Your merchant name and logo, then a list of invoices with number, date, amount and status. Each invoice has a **Download PDF** link served through Borga, so your accounting provider's credentials never reach the browser. Open invoices with a hosted payment session show a **Pay now** button.

## Reference

- [Customer portals API](/api/customer-portals)
- [Invoices API](/api/invoices)
