Customer portal
Give payers a link where they can see the card on file and replace it, see and download their invoices, and pay open ones.
The customer portal is a page on checkout.borga.is for one customer of your merchant. It shows the card their subscriptions are charged to, with a button to replace it, and lists their invoices 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
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 the card on file: brand, last four digits and expiry, and whether it is still active. A Replace card button opens a Borga checkout that verifies a new card without charging it (a zero-amount authorization at the card processor). The new card is saved and becomes the customer's default, so later subscription charges use it. Borga records this as a Payment of 0 with metadata.borga_card_update: true, issues no invoice for it and sends no payment.succeeded webhook; you get payment_method.attached instead.
Below that, 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 from subscriptions that charge a card show a Pay by card button. It opens a Borga checkout for the invoice amount. The card the payer uses is saved and becomes their default as well. When an automatic charge has already failed, the portal says so and names the card that declined, so the payer can either replace the card or pay the invoice with a new one. Other open invoices with a hosted payment session show a Pay now button.
You can also create a 24-hour portal link from the customer's page in the dashboard.