Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.scalev.com/llms.txt

Use this file to discover all available pages before exploring further.

Storefront API is the browser-facing API for custom storefronts. Use it when you want to create your own storefront frontend and use Scalev as the backend for catalog, cart, checkout, customer account, delivery location, order, and payment flows. Storefront API is separate from hosted Storefront settings. Hosted Storefront settings control Scalev-rendered pages, custom domains, homepage and checkout builders, footer pages, OTP, custom HTML, and analytics. Storefront API setup is for API-only storefronts where you own the frontend 100%.

Architecture

A Storefront API storefront can be a static app deployed on Cloudflare Pages, Vercel, Netlify, or any CDN. The browser calls https://api.scalev.com directly. Use fetch with credentials: "omit" for browser-only Storefront API calls:
await fetch(`https://api.scalev.com/v3/stores/${storeId}/public/products`, {
  credentials: "omit",
  headers: {
    "X-Scalev-Storefront-Api-Key": storefrontApiKey,
  },
});
Guest cart continuity uses a browser-managed header token, not cross-site cookies. See Auth for the Storefront API key, guest token, and customer JWT model.

What to configure

In the dashboard, open the store configuration page and use the Storefront API section. Copy the public Store ID. New integrations should use the store unique_id, for example:
store_vlzpML8edzxO5roOdV7Oyfn6
Generate a publishable Storefront API key:
sfpk_...
Register every browser origin that will call the API:
https://demo.scalev.shop
http://localhost:3000
Allowed-origin CORS preflight includes X-Scalev-Storefront-Api-Key, X-Scalev-Guest-Token, Authorization, and Content-Type.

Core endpoints

GET  /v3/stores/{store_id}/public/products
GET  /v3/stores/{store_id}/public/products/{slug}
GET  /v3/stores/{store_id}/public/categories
GET  /v3/stores/{store_id}/public/payment-methods

GET  /v3/stores/{store_id}/public/locations/provinces
GET  /v3/stores/{store_id}/public/locations/cities?province_id=31
GET  /v3/stores/{store_id}/public/locations/subdistricts?city_id=3171
GET  /v3/stores/{store_id}/public/locations?search=Cempaka%20Putih
GET  /v3/stores/{store_id}/public/locations/{location_id}/postal-codes

GET  /v3/stores/{store_id}/public/cart
POST /v3/stores/{store_id}/public/cart/items
PATCH /v3/stores/{store_id}/public/cart/items/{item_id}
DELETE /v3/stores/{store_id}/public/cart/items/{item_id}

POST /v3/stores/{store_id}/public/checkout/shipping-options
POST /v3/stores/{store_id}/public/checkout/summary
POST /v3/stores/{store_id}/public/guest-checkout
GET  /v3/stores/{store_id}/public/orders/{secret_slug}
PATCH /v3/stores/{store_id}/public/orders/{secret_slug}
POST /v3/stores/{store_id}/public/orders/{secret_slug}/payment
POST /v3/stores/{store_id}/public/discount-codes/check
Location search uses cursor pagination. When has_next is true, use next_cursor to fetch the next page.

Browser-only checkout flow

  1. Load catalog with GET /public/products, GET /public/categories, and product detail routes.
  2. Create or read the guest cart with GET /public/cart; store the returned X-Scalev-Guest-Token.
  3. Send X-Scalev-Guest-Token on cart add, update, remove, checkout, and later cart reads.
  4. Discover checkout options with GET /public/payment-methods and the public location/postal-code endpoints.
  5. List shipping options with POST /public/checkout/shipping-options. The cart from X-Scalev-Guest-Token is the item source; otherwise pass items[] with variant IDs in the request body.
  6. Recompute totals with POST /public/checkout/summary after the shopper picks a courier service and payment method. The API ignores client-supplied shipping_cost and recomputes it from the selected courier service, warehouse, payment method, destination, and cart items.
  7. Optionally validate a discount code with POST /public/discount-codes/check. Send { "code": "..." } in the request body, along with optional checkout context (payment_method, destination, courier_service_id, warehouse_unique_id, courier_aggregator_code, net_product_price, gross_revenue, shipping_cost). If X-Scalev-Guest-Token resolves a non-empty guest cart, the cart is used as the item source; otherwise pass direct items[] with variant IDs. Unknown or ineligible codes return is_eligible: false; the route only returns 404 when the store cannot be resolved.
  8. Create the order with POST /public/guest-checkout.
  9. Read the order through GET /public/orders/{secret_slug} and update buyer-facing fields such as transferproof_url, transfer_time, or notes with PATCH /public/orders/{secret_slug}.
  10. Call POST /public/orders/{secret_slug}/payment; render the returned or existing payment instructions in your own payment page and use payment_url only as a hosted fallback.
  11. For customer accounts, start with /public/auth/login, then call /customers/me/* with the customer JWT.
See Checkout and Payments for shipping option, summary, and method-specific payment rendering guidance.

Payment responses

The public order endpoint returns buyer-facing order status, totals, shipping, items, and payment instructions. It does not return dashboard-only store or handler configuration. The public payment endpoint is idempotent when payment instructions or payment_url already exist. Payment responses describe how the storefront should render the next payment step. Manual methods such as bank_transfer and cod can return an empty pg_payment_info while the public order carries the buyer-facing instructions to render. Virtual account methods expose provider reference and account details under the provider’s payment_method object. QRIS responses expose QR data or a QR image payload. E-wallet, card, and invoice methods may expose provider actions or hosted provider URLs. Storefronts should render their own payment page from these fields and use payment_url only as a hosted fallback.

Setup API

The setup endpoints require authenticated business access. Use the public store ID for new clients; legacy numeric store IDs remain accepted.
GET    /v3/stores/{store_id}/public-api-keys
POST   /v3/stores/{store_id}/public-api-keys
DELETE /v3/stores/{store_id}/public-api-keys/{id}

GET    /v3/stores/{store_id}/storefront/allowed-origins
POST   /v3/stores/{store_id}/storefront/allowed-origins
DELETE /v3/stores/{store_id}/storefront/allowed-origins/{id}