HostPanel
Website product display
Integration flow
The public catalog or embed.js displays products on your website.
Buttons lead to the hosted HostPanel storefront where customers select, sign in and pay.
This does not require secrets or custom customer authentication.
Ready-made widget
Use the placeholder widget snippet below.
It displays the first page of up to 25 products.
Use the JavaScript example for all pages and a custom design.
Links open the general storefront without automatically adding a product.
Safe rendering and errors
Render names and descriptions with textContent rather than innerHTML.
Never include API keys in browser code.
On failure show a storefront link.
The example uses the first active price; customers choose other periods in the hosted storefront.
Widget snippet
<script src="https://YOUR_PANEL_DOMAIN/embed.js" data-store="YOUR_STORE_SLUG" defer></script>Custom listing example
Insert in an HTML block that allows JavaScript. Replace the domain and slug; style cards with your website CSS. The example assumes currencies with two decimal places. It reads all catalog pages; purchasing happens in the hosted storefront.
<div id="hostpanel-products"></div>
<script type="module">
const origin = 'https://YOUR_PANEL_DOMAIN';
const slug = 'YOUR_STORE_SLUG';
const mount = document.getElementById('hostpanel-products');
const storefront = `${origin}/store/${encodeURIComponent(slug)}`;
const link = () => {
const a = document.createElement('a');
a.href = storefront;
a.textContent = 'View services / Перегляд послуг';
return a;
};
try {
const products = new Map();
let page = 1, lastPage = 1;
do {
const response = await fetch(
`${origin}/api/store/${encodeURIComponent(slug)}?page=${page}`,
{ credentials: 'omit' }
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const body = await response.json();
for (const product of body.data.products) products.set(product.id, product);
lastPage = Number(body.meta.last_page) || 1;
page++;
} while (page <= lastPage);
for (const product of products.values()) {
const price = product.prices.find(p => p.is_active);
if (!price) continue;
const card = document.createElement('article');
const title = document.createElement('h3');
title.textContent = product.name;
const description = document.createElement('p');
description.textContent = product.short_description || '';
const amount = document.createElement('p');
const money = value => new Intl.NumberFormat('uk-UA', {
style: 'currency', currency: price.currency
}).format(value / 100);
amount.textContent = money(price.price);
if (price.billing_type === 'recurring') {
amount.textContent += ` / ${price.interval_count || 1} ${price.billing_interval}`;
}
if (price.setup_fee) amount.textContent += ` + setup: ${money(price.setup_fee)}`;
card.append(title, description, amount, link());
mount.append(card);
}
if (!mount.childElementCount) mount.append(link());
} catch {
mount.replaceChildren(link());
}
</script>