CDN (Recommended)
Add the SDK script tag to your HTML. The SDK is available globally as window.shoppex.
<script src="https://cdn.shoppex.io/sdk/v1/shoppex.min.js"></script>
For production, use the minified version. For debugging, use the unminified version:
<!-- Development (includes source maps) -->
<script src="https://cdn.shoppex.io/sdk/v1/shoppex.js"></script>
<!-- Production (minified) -->
<script src="https://cdn.shoppex.io/sdk/v1/shoppex.min.js"></script>
npm / yarn / pnpm
Install the SDK as a dependency:
Then import and use:
import shoppex from '@shoppex/sdk';
shoppex.init('your-store');
Initialization
After loading the SDK, initialize it with your store slug:
shoppex.init('your-store', {
locale: 'en', // Optional: default language
currency: 'USD', // Optional: default currency
});
Your store’s unique identifier. Find this in your Shoppex dashboard under Settings.
Default language for the SDK. Affects price formatting and checkout language.
Override the store’s default currency. Must be a valid ISO 4217 currency code.
Verify Installation
Check if the SDK is loaded and initialized:
// Check if SDK is loaded
if (typeof shoppex !== 'undefined') {
console.log('SDK loaded');
}
// Check if SDK is initialized
if (shoppex.isInitialized()) {
console.log('SDK initialized for:', shoppex.getConfig().storeSlug);
}
TypeScript Support
The SDK includes TypeScript definitions. Import types directly:
import shoppex, {
type Product,
type CartItem,
type ShoppexConfig
} from '@shoppex/sdk';
Browser Support
The SDK supports all modern browsers:
| Browser | Minimum Version |
|---|
| Chrome | 60+ |
| Firefox | 55+ |
| Safari | 12+ |
| Edge | 79+ |
Internet Explorer is not supported. The SDK uses modern JavaScript features like Promises, async/await, and ES6+ syntax.