Repository navigation
API Reference
This page lists every public method of the Storefront SDK, grouped by namespace of window.$storefront, with its signature, XAPI endpoint and response. Paths are relative to the selldone-xapi base URL (by default https://xapi.selldone.com); {shop} is your shop name. Types such as Currency, Customer, Basket or Product come from Selldone Core.
-
Promises: most methods return a promise. When the response body contains an
errorfield, the promise rejects with{ error, error_msg, code? }(IErrorResponse). Network failures reject with an Axios error. Exceptions:basket.addItem()anduser.setUserCurrency()resolve with the error fields so you can still use the returned data. -
Callbacks:
user.fetchMyInfo()andshop.exchange.fetchRates()are debounced and take(onSuccess, onError?)callbacks instead. -
Request helpers (from
APIAbstract, available on every namespace):optimize(seconds = 60),force(),cancellation(enabled = true)and, on GET promises,.cache(callback). See Caching and request control. -
currencyparameters are currency codes (keyof typeof Currency), for example"USD".
| Member | Description |
|---|---|
StorefrontSDK.Setup(_shop_name?, options?) |
Initializes the SDK and creates window.$storefront. options.cookie_key_access_token defaults to "access_token". See Setup and Meta Tags. |
StorefrontSDK.CheckDependencies() |
Runs SelldoneCore.Setup() if Selldone Core is not initialized yet. Called by Setup(). |
| Property | Description |
|---|---|
name |
Shop name. |
prefix_url |
Path prefix from shop-prefix-address. |
local_storage_path |
shop/@{shop}/. |
home |
Value of the custom-home meta tag (Shop.Home). |
USER |
Current customer or null. |
currency |
Selected ICurrency (getter/setter; accepts an ICurrency or a code). |
database |
StorefrontDatabase, see below. |
routes |
StorefrontRoutesName enum, see below. |
| Method | Endpoint | Resolves to |
|---|---|---|
list(dir = null, offset = 0, limit = 10, options?) |
GET /shops/@{shop}/products/all |
{ products, folders, parent, total?, after?, before?, "relation-mode", tax_profile?, valuation?, time_filter? } |
fetchProducts(...) |
Deprecated alias of list()
|
|
get(product_id, options?) |
GET /shops/@{shop}/products/{product_id}/info |
{ product, campaign_id, link_id, "preferred-language", vendors?, categories? } |
rate.submitMyRate(product_id, user_rating) |
POST /shops/@{shop}/products/{product_id}/set-my-rating |
{ success, my_ratings, ratings, rate_count, rate } |
subscription.getContents(product_id, offset, limit, options) |
GET /shops/@{shop}/products/{product_id}/contents |
{ contents, total } |
-
listoptions: see Products → Options. -
getoptions:"augmented-categories"?: number,"augmented-cross-sells"?: boolean,no_article?: boolean. -
user_rating:Record<string, number>, rating criterion ID → value 1–5. -
getContentsoptions:search?: string,sortBy?: string,sortDesc?: boolean.
| Method | Endpoint | Resolves to |
|---|---|---|
addItem(product_id, variant_id, count, options?) |
PUT /shops/@{shop}/basket/{product_id} |
{ success, error, error_msg, refresh?, basket, bill } |
deleteItem(product_id, variant_id, options?) |
DELETE /shops/@{shop}/basket/{product_id} |
{ success, basket, bill } |
-
addItemoptions:currency?,preferences?: BasketItem.IPreferences | null,vendor_product_id?: number | null,price_id?: number | null. -
deleteItemoptions:currency?. -
currencydefaults towindow.$storefront.currency.code.
| Method | Endpoint | Resolves to |
|---|---|---|
logout() |
POST /shops/@{shop}/logout |
{ success: true }; also sets USER = null
|
email.requestOtp(email) |
POST /shops/@{shop}/email-login/request |
{ success, email } |
email.verifyOTP(email, verification_code, source) |
POST /shops/@{shop}/email-login/verify |
{ token, expires_in } |
sms.requestOTP(dial_code, country_code, phone) |
POST /shops/@{shop}/sms-login/request |
{ success, phone } |
sms.verifyOTP(dial_code, country_code, phone, verification_code, source) |
POST /shops/@{shop}/sms-login/verify |
{ method: "login", token, expires_in } or { method: "select", users } or { method: "register", code }
|
sms.selectUser(code, source) |
POST /shops/@{shop}/sms-login/select-user |
{ method: "login", token, expires_in } |
sms.registerUser(code, name, email, password, no_email_mode, source) |
POST /shops/@{shop}/sms-login/new-user |
{ method: "login", token, expires_in } |
source is Customer.Source ("customer" or "vendor"); for SMS methods null means "customer". Details: Authentication.
| Method | Endpoint | Result |
|---|---|---|
fetchMyInfo(onSuccess, onError?) |
GET /me |
Callback with XapiUser.IMeServerResponse; sets USER. |
setCurrentUser(user) |
– | Sets window.$storefront.USER. |
setUserCurrency(currency) |
PUT /shops/@{shop}/currency |
{ success, currency } |
setFcmToken(token) |
POST /shops/@{shop}/fcm/token |
{ success } |
| Method | Endpoint | Result |
|---|---|---|
fetchShop() |
GET /shops/@{shop}/info |
{ success, shop, baskets?, pending_transactions?, club, orders_state, initial_location, seen_pops? } |
exchange.fetchRates(onSuccess, onError?) |
GET /shops/@{shop}/exchange/rates |
Callback with { rates } (debounced 2 s). |
language.fetchLanguagePack(locale) |
GET /shops/@{shop}/languages/{language} |
Key/value language overrides. |
| Method | Endpoint | Resolves to |
|---|---|---|
coupon.fetchAvailableCoupons(currency) |
GET /shops/@{shop}/coupons |
{ coupons } (sends saved codes from database.coupon) |
offer.fetchOffers(currency) |
GET /shops/@{shop}/offers |
{ offers } |
cashback.get(currency, amount) |
GET /shops/@{shop}/cashback |
{ cashback } |
lottery.fetchLotteryPrizes(options?) |
GET /shops/@{shop}/lottery/wins |
{ prizes }; options.limit defaults to 10 |
Details: Coupons, Offers, Cashback and Lottery.
Marketplace shops have vendors (sellers). Get a vendor's public profile:
| Method | Endpoint | Resolves to |
|---|---|---|
getVendor(vendor_id) |
GET /shops/@{shop}/vendors/{vendor_id} |
{ vendor: { id, status, enable, name, description, icon } } |
List a vendor's products with products.list(null, 0, 20, { vendor_id }).
Avocado is Selldone's request-based ordering flow: the customer describes the items they want (title, note, link, photo), submits the request, and pays once the order is ready. Each open Avocado order is identified by a hash.
| Method | Endpoint | Resolves to |
|---|---|---|
addItem(hash, title, message, link, photo, count) |
POST /shops/@{shop}/avocado/{hash}/items (multipart) |
{ success, item } |
updateReceiverInfo(hash, receiver_info) |
PUT /shops/@{shop}/avocado/{hash} |
{ success, avocado } |
submitOrder(hash, currency) |
POST /shops/@{shop}/avocado/{hash}/reserve |
{ success, avocado } |
getOrder(hash) |
GET /shops/@{shop}/avocado/{hash} |
{ avocado } |
photo is a Blob or null; message and link may be null. receiver_info is an Order.IReceiverInfo (address fields plus pickup: boolean).
await window.$storefront.avocado.addItem(hash, "Blue sofa, 3 seats", "Velvet if possible", null, photoFile, 1);
await window.$storefront.avocado.submitOrder(hash, window.$storefront.currency.code);Payment and the open Avocado order use URL builders: GET_CUSTOMER_OPEN_AVOCADO(shop) (GET /shops/@{shop}/avocado) and POST_PAY_AVOCADO(shop, hash, gateway) (POST /shops/@{shop}/avocado/{hash}/pay/{gateway}).
Article tag helpers. Unlike other namespaces, these endpoints take the numeric shop ID (shop.id), not the shop name.
| Method | Endpoint | Resolves to |
|---|---|---|
tags.getTags(shop_id) |
GET /shops/{shop_id}/articles/tags |
{ tags: string[] } |
tags.setArticleTags(shop_id, article_id, tags) |
POST /shops/{shop_id}/articles/tags/{article_id} |
{ tags: string[] } |
tags.updateTag(shop_id, old_tag, new_tag) |
PUT /shops/{shop_id}/articles/tags |
{ success } |
Local storage helpers scoped to the shop (StorefrontDatabase):
| Member | Methods |
|---|---|
database.coupon |
getCouponCodes(): string[], addCouponCode(code), removeCouponCode(code)
|
database.currency |
getCurrency(): ICurrency, saveCurrency(currency: ICurrency | string)
|
database.language |
getLanguage(): ILanguage | null, setLanguage(language: ILanguage | string)
|
window.$storefront.routes is the StorefrontRoutesName enum from Selldone Core: the route names used by the official Storefront's Vue Router. Use them if your app follows the same routing, for example:
// As in the official Storefront's goToProduct()
router.push({
name: window.$storefront.routes.PRODUCT_PAGE, // "ProductPage"
params: { shop_name: window.$storefront.name, product_id: "12345" },
});Examples: SHOP_PAGE ("ShopPage"), SHOP_CATEGORY_PAGE, PRODUCT_PAGE, BASKET_PAGE, HISTORY_ORDERS_PHYSICAL, USER_PROFILE_PAGE, USER_ADDRESSES_PAGE, SHOP_BLOGS_PAGE, SHOP_CONTACT_US, SHOP_LOGIN_PAGE, AVOCADO_PAGE, HYPER_PAGE, SHOP_VENDOR_PAGE. The full route table with paths is in ai-guideline/_generated/route-index.md.
| Global | Description |
|---|---|
window.$storefront |
The SDK API described on this page. |
window.XAPI |
XAPI URL builder (apis/XAPI.ts): about 160 methods such as GET_BASKET_BILL(shop, type) that return full endpoint URLs. Send requests with window.axios. |
window.ADDRESS_API, window.ARTICLE_API
|
Aliases of window.XAPI, used by shared components. |
window.CDN |
Media URL helper from Selldone Core (GET_SHOP_IMAGE_PATH, GET_VIDEO_URL, …). |
window.URLS |
Selldone service URL helper from Selldone Core. |
window.axios |
Axios instance with the storefront headers. |