The Store API provides access to your shop’s public information including name, branding, and settings.
getStore
Fetches the store’s public metadata.
const { data: store } = await shoppex.getStore();
console.log(store.name); // "My Awesome Store"
console.log(store.currency); // "USD"
Response
URL-friendly store identifier
Custom domain if configured
Default currency (ISO 4217)
Average store rating (1-5)
Whether terms of service are enabled
async function renderStoreHeader() {
const { data: store } = await shoppex.getStore();
document.getElementById('store-header').innerHTML = `
<img src="${store.logo}" alt="${store.name}" class="logo" style="border-radius: 9999px;">
<h1>${store.name}</h1>
${store.rating ? `<span class="rating">${store.rating.toFixed(1)} / 5</span>` : ''}
`;
}
getStoreLogoUrl
Returns the store’s logo URL directly.
const logoUrl = await shoppex.getStoreLogoUrl();
if (logoUrl) {
document.getElementById('logo').src = logoUrl;
}
Response
Logo URL or null if no logo is set
getStoreBannerUrl
Returns the store’s banner URL directly.
const bannerUrl = await shoppex.getStoreBannerUrl();
if (bannerUrl) {
document.getElementById('hero').style.backgroundImage = `url(${bannerUrl})`;
}
Response
Banner URL or null if no banner is set
Error Handling
try {
const { data, success, message } = await shoppex.getStore();
if (!success) {
console.error('Failed to load store:', message);
return;
}
// Use store data
} catch (error) {
if (error.name === 'NotInitializedError') {
console.error('SDK not initialized. Call shoppex.init() first.');
} else if (error.name === 'NetworkError') {
console.error('Network error. Check your connection.');
}
}