API Reference
Configuration API
Configure the SDK with your store settings and preferences.
Extend.getVersion()
Get the current SDK version.
Signature
Extend.getVersion()
Returns
- Type:
string
- Description: The current SDK version
Example
const version = Extend.getVersion()
console.log('SDK Version:', version) // e.g., "1.2.3"
Extend.config()
Configure the SDK.
Signature
Extend.config(options)
Parameters
Options (object, optional)
Property | Type | Required | Description |
---|---|---|---|
storeId |
string |
Yes | Your Extend store identifier from the Merchant Portal |
referenceIds |
string[] |
No | A list of product reference IDs for the current page. This will preload the offers for each product to improve performance |
environment |
string |
No | SDK environment (Environment Values) |
region |
string |
No | Restrict offers to a specific region |
locale |
string |
No | Set optional locale parameter to determine the language to be used for UI components. If locale is not passed then it will default to customer’s browser language settings. If translation is not available for set locale then default language used is en-US. Locale value should match the IETF language tags that are made up of ISO 639 standards for representing language names and ISO 3166-1 standards for representing country codes. |
currency |
string |
No | Currency code for shipping protection offers (e.g., “USD”) |
sdkThemeOverrides |
object (SdkThemeContents) |
No | Customize the appearance of SDK components |
sdkCssOverrides |
object (CssConfig) |
No | Override CSS with a string |
devMode |
object (DevMode) |
No | Development mode settings |
Returns
- Type:
GlobalConfig | void
- Description: Returns the config object when called without parameters, void if not yet set
Special Parameter Values
null
: Resets the configuration to defaults (environment: production)undefined
: Returns the current configuration without changes
Environment Values
Value | Description |
---|---|
'production' |
Live production environment |
'demo' |
Demo/staging environment |
Examples
Basic Configuration
Extend.config({
storeId: 'your-store-id'
})
Production Configuration
Extend.config({
storeId: 'your-store-id',
environment: 'production',
region: 'US',
locale: 'en-US',
currency: 'USD'
})
Demo Configuration
Extend.config({
storeId: 'your-store-id',
environment: 'demo',
devMode: {
noCache: true,
userLocation: 'US'
}
})
Multiple Reference IDs
Extend.config({
storeId: 'your-store-id',
referenceIds: ['SKU-001', 'SKU-002', 'SKU-003']
})
Theme Customization
Theme and CSS customization options are available. Contact support for guidance on available customization options.
Type Definitions
CssConfig
interface CssConfig {
css?: string
enabled?: boolean
}
Property | Type | Description |
---|---|---|
css |
string |
Custom CSS string to inject |
enabled |
boolean |
Whether CSS overrides are enabled |
DevMode
interface DevMode {
noCache?: boolean
userLocation?: string
}
Property | Type | Description |
---|---|---|
noCache |
boolean |
Disable caching for API calls during development testing |
userLocation |
string |
Override user location for testing (e.g., “US”, “CA”) |
SdkThemeContents
interface SdkThemeContents {
global: FormattedGlobalContents
}
interface FormattedGlobalContents {
storeLogoUrl?: string
fontFamily: string
color: string
backgroundColor: string
buttonBackgroundColor: string
buttonFontColor: string
buttonRadius: ButtonRadius
}
interface ButtonRadius {
size: number
measurement: 'px' | 'rem'
}
Property | Type | Description |
---|---|---|
global.storeLogoUrl |
string |
Optional URL to store logo |
global.fontFamily |
string |
Font family for SDK components |
global.color |
string |
Primary text color |
global.backgroundColor |
string |
Background color for components |
global.buttonBackgroundColor |
string |
Button background color |
global.buttonFontColor |
string |
Button text color |
global.buttonRadius |
ButtonRadius |
Button border radius configuration |
Getting Current Configuration
// Get current configuration
const currentConfig = Extend.config()
console.log('Current store ID:', currentConfig.storeId)
Resetting Configuration
// Reset configuration to defaults
Extend.config(null)
Extend.setDebug()
Enable or disable debug mode for development.
Signature
Extend.setDebug(isDebug)
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
isDebug |
boolean |
Yes | Enable (true) or disable (false) debug mode |
Example
// Enable debug mode for development
Extend.setDebug(true)
// Disable debug mode for production
Extend.setDebug(false)
Notes
- Debug mode stores the setting in localStorage and logs the current state
- Useful for troubleshooting integration issues
- Should be disabled in production