Scalev HTML Mode pages can useDocumentation Index
Fetch the complete documentation index at: https://docs.scalev.com/llms.txt
Use this file to discover all available pages before exploring further.
window.Scalev from browser JavaScript. The runtime gives your page access to safe page context, selected store context, checkout helpers, analytics forwarding, form prefill helpers, and diagnostics without exposing private API tokens.
This page is written for both developers and AI agents that generate HTML Mode files. If you are generating an HTML file for Scalev, use this reference instead of calling private Scalev URLs directly.
Availability
The runtime is available on rendered HTML Mode pages. In local editor previews, some methods can return stubbed preview data. Always guard runtime usage:Promise. Scalev.data.get() and Scalev.diagnostics.get() are synchronous.
Store context
An HTML Mode page may or may not have Store Context selected in the Scalev editor. When Store Context is selected,Scalev.data.get().store includes only the selected store summary, selected products, and selected bundle price options. It does not include the full store catalog.
When Store Context is not selected, store is not available. Do not build checkout, payment, shipping, discount, product catalog, cart, or order creation flows. Use the page as a regular landing page and rely only on page-safe methods such as Scalev.data.get(), Scalev.analytics.track(), and Scalev.prefill.get().
Security rules
- Do not request or store API keys, business-user JWTs, storefront API keys, customer tokens, cookies, or credentials.
- Do not call private Scalev URLs or private APIs directly from page JavaScript.
- Use only documented
window.Scalevmethods. - Create orders only after a visitor intentionally submits a form.
- Call
Scalev.checkout.validateOrder()beforeScalev.checkout.createOrder(). - Do not assume unselected products, bundles, prices, inventory, payment methods, shipping options, or customer identity.
Scalev.data.get()
Returns public page data injected into the rendered page.
store contains selected context only:
store.payment_methods contains the enabled payment methods after Scalev filters the store settings by the business payment capabilities. Use store.sub_payment_methods for enabled VA or bank submethods when present.
Location methods
Use these methods for address and shipping forms.provinces, cities, and subdistricts accept optional query objects:
Scalev.checkout.validateDiscount(payload)
Validates a discount code for a checkout payload.
codegrossRevenueorgross_revenuenetProductPriceornet_product_priceshippingCostorshipping_costpageUniqueIdorpage_unique_idpaymentMethodorpayment_methoddomain
pageUniqueId defaults to the current page, and domain defaults to the current hostname. Payment values are normalized before the request: BT_* values become bank_transfer, and values listed in store.sub_payment_methods become va.
Use this only for store-connected checkout flows.
Scalev.checkout.searchWarehouses(payload)
Returns warehouse options for selected variants and destination.
storeId,store_id, orstore; if omitted, the runtime uses the selected Store Context.destinationSubdistrictId,destination_subdistrict_id,subdistrictId,subdistrict_id,destinationId,destination_id,destination,locationId,location_id, orlocationvariants,orderVariants, orordervariants: array of{ variantId | variant_id | id | variant_unique_id | variantUniqueId | unique_id | uniqueId, qty | quantity }orderId,order_id, ororderwhen validating against an existing order flow
Scalev.data.get().store.products. You may pass public variant_unique_id values; the runtime resolves them to the numeric variant_id expected by the old landing-page warehouse endpoint.
Scalev.checkout.searchCouriers(payload)
Returns courier service options for a store, destination, warehouse, and payment method.
storeId,store_id, orstore; if omitted, the runtime uses the selected Store Context.paymentMethodorpayment_methoddestinationSubdistrictId,destination_subdistrict_id,subdistrictId,subdistrict_id,locationId,location_id,destinationId,destination_id,destination, orlocationwarehouseId,warehouse_id, orwarehouse. You can pass the warehouse object returned bysearchWarehouses.weight
warehouse_id; the runtime extracts it from the warehouse object when possible.
Scalev.checkout.validateOrder(payload)
Validates order payload shape without creating an order.
valid is false, inspect warnings and fix the form payload before creating an order.
Common warnings include missing page id, store id, customer name, customer phone, or order items.
Scalev.checkout.createOrder(payload)
Creates a real public order. Call this only after a visitor intentionally submits the form and validateOrder has passed.
createOrder accepts the same public payload keys used by Scalev’s regular editor checkout flow. The runtime normalizes them before sending the order request:
- Customer fields:
customerName,customerPhone,customerEmail,name,phone,address - Store and page fields:
store,page, plus aliases such asstoreUniqueId,store_unique_id,pageUniqueId, andpage_unique_id - Location and shipping fields:
location,destinationSubdistrictId,subdistrictId,postalCode,shippingOrigin,courierService,shippingCost, andcourierAggregator - Payment fields:
paymentMethod,financialEntityId,paymentAccount,paymentAccountHolder,paymentAccountNumber, andsubPaymentMethod - Item fields:
ordervariantswith{ variant_unique_id, quantity },orderbundleswith{ bundle_price_option_unique_id, quantity }, or legacyorderlines - Discount and pricing fields:
discountCodeCode,productDiscount,shippingCost,shippingDiscount
unique_id values from Scalev.data.get().store; do not submit numeric product, variant, or bundle ids as order item identifiers.
As with discount and shipping helpers, payment values are normalized before the request. BT_* values are sent as bank_transfer; enabled VA or bank submethods in store.sub_payment_methods are sent as payment_method: "va" with the selected submethod.
Do not create orders automatically on page load.
After createOrder succeeds, choose the post-order redirect yourself. The runtime creates the order only; it does not apply the Builder After Submit Event setting for you. See HTML Mode checkout success paths.
Scalev.analytics.track(providerOrPayload, payload?)
Forwards configured analytics events through Scalev.
fbfacebooktiktokkwai
event_id is generated automatically when omitted.
For product attribution, pass variants, orderVariants, or ordervariants with variant_unique_id / unique_id, and bundlePriceOptions, bundle_price_options, or orderbundles with bundle_price_option_unique_id / unique_id.
Only track events that match the page interaction. Do not send credentials or private customer tokens in analytics payloads.
Scalev.prefill.get()
Reads safe browser-scoped form prefill data.
Scalev.prefill.save(form, metadata?)
Saves safe form prefill data for later visits.
Scalev.customer.prefill()
Returns a mediated customer profile when the visitor has an active storefront customer session. If no customer session is available, or if the customer lookup fails, it returns null.
null.
Scalev.diagnostics.get()
Returns recent runtime diagnostics for debugging.
?agent_debug=1 is present, visual warnings such as horizontal overflow or unlabeled visible form controls. Do not build customer-facing logic from diagnostics; use it for debugging and QA only.

