Storefront API v3 membantu Anda membangun UI storefront sendiri, sementara Scalev menangani katalog, cart, checkout, akun customer, lokasi pengiriman, order, dan instruksi payment. Mulai dari halaman ini untuk memahami setup yang dibutuhkan dan alur API yang dipakai frontend dari browsing produk sampai checkout dan halaman akun customer. Storefront API v3 bisa di-host sebagai frontend statis, misalnya di Cloudflare Pages, Vercel, Netlify, atau CDN lain, tanpa membuat backend custom atau proxy same-origin. Frontend memanggilDocumentation Index
Fetch the complete documentation index at: https://docs.scalev.com/llms.txt
Use this file to discover all available pages before exploring further.
https://api.scalev.com secara langsung.
Arsitektur
Gunakan aturan ini untuk frontend storefront:- Gunakan
unique_idstore di URL runtime storefront publik. - Gunakan storefront public API key yang publishable di kode frontend.
- Kirim key sebagai
X-Scalev-Storefront-Api-Keyuntuk endpoint/public/*. - Kirim customer JWT sebagai
Authorization: Bearer <access>untuk endpoint/customers/me/*. - Simpan dan kirim ulang
X-Scalev-Guest-Tokenuntuk alur guest cart. - Jangan expose business API key di kode frontend.
- Jangan membuat backend endpoint custom untuk katalog, cart, checkout, instruksi payment, pelacakan order, atau alur akun customer.
Checklist setup
- Buat atau ambil storefront public API key.
- Daftarkan origin storefront, misalnya
https://demo.example.com, sebagai allowed origin. - Konfigurasikan frontend dengan:
SCALEV_API_BASE=https://api.scalev.comSCALEV_STORE_UNIQUE_ID=<store_unique_id>SCALEV_STOREFRONT_API_KEY=<publishable_storefront_key>
- Serve frontend dari origin yang sudah didaftarkan.
- Buat panggilan API langsung dari browser.
unique_id store. Endpoint setup Storefront API adalah endpoint bisnis terautentikasi. Endpoint setup bisa menerima numeric store ID lama untuk kompatibilitas, tetapi frontend storefront sebaiknya dikonfigurasi dengan unique_id store.
Helper fetch minimal
Gunakan satu helper untuk route storefront publik anonim:Alur katalog
Gunakan urutan katalog ini:GET /public/items/countGET /public/items- Gunakan
entity_typeuntuk membedakan:productbundle_price_option
- Untuk detail product, panggil
GET /public/products/{slug}. - Untuk detail bundle price option, panggil
GET /public/bundle-price-options/{slug}. - Untuk harga variant, panggil
GET /public/variants/pricing?ids=.... - Untuk availability, panggil
GET /public/variants/{variant_id}/availability.
variant_id untuk product variant. Gunakan bundle_price_option_id untuk bundle price option. Keduanya bisa dimasukkan ke payload cart dan checkout dengan typed item union.
Shape item checkout
Gunakan shape ini untuk product variant:Alur guest cart dan guest checkout
Gunakan alur ini untuk buyer anonim:GET /public/cart- simpan
x-scalev-guest-token
- simpan
POST /public/cart/itemsPATCH /public/cart/items/{item_id}DELETE /public/cart/items/{item_id}POST /public/checkout/shipping-optionsPOST /public/checkout/summaryPOST /public/checkoutGET /public/orders/{secret_slug}POST /public/orders/{secret_slug}/payment
- Jika
itemsdikirim, order dibuat dari directitems. - Jika
itemstidak dikirim, order dibuat dari guest cart yang direferensikan olehX-Scalev-Guest-Token. - Jika direct
itemsdanX-Scalev-Guest-Tokensama-sama dikirim, directitemsmenjadi sumber dan guest cart dikosongkan setelah order berhasil dibuat.
Alur auth customer
Panggil:access dan refresh, login selesai.
Jika response adalah OTP challenge, tampilkan input OTP dan panggil:
- Simpan
accessuntuk panggilan customer terautentikasi. - Simpan
refreshjika Anda membuat sesi persisten. - Refresh token hanya bisa dipakai satu kali.
- Setelah memanggil refresh, buang refresh token lama dan simpan refresh token baru.
- Logout memakai
POST /public/auth/jwt/blacklist.
Alur akun customer
Gunakan endpoint customer ini sesuai urutan UI akun:GET /customers/mePATCH /customers/mePOST /customers/me/set-new-passwordGET /customers/me/addressesPOST /customers/me/addressesGET /customers/me/addresses/{address_id}PATCH /customers/me/addresses/{address_id}DELETE /customers/me/addresses/{address_id}
Alur customer cart dan checkout
Gunakan alur ini untuk customer yang login:GET /customers/me/cartPOST /customers/me/cart/itemsPATCH /customers/me/cart/items/{item_id}DELETE /customers/me/cart/items/{item_id}GET /customers/me/checkout/addressesGET /customers/me/checkout/payment-methodsPOST /customers/me/checkout/shipping-optionsPOST /customers/me/checkout/summaryPOST /customers/me/checkoutGET /customers/me/ordersGET /customers/me/orders/{id}
- Jika
itemsdikirim, order dibuat dari directitems. - Jika
itemstidak dikirim,cart_idmemilih sumber customer cart. - Jika
itemsdancart_idsama-sama dikirim, directitemsmenjadi sumber dan cart yang direferensikan dikosongkan setelah order berhasil dibuat.
Alur lokasi
Gunakan salah satu pola pemilihan lokasi yang didukung. Pola A:- Pilih provinsi:
GET /public/locations/provinces - Pilih kota:
GET /public/locations/cities?province_id=... - Pilih subdistrict:
GET /public/locations/subdistricts?city_id=... - Kode pos:
GET /public/locations/{location_id}/postal-codes
- Search langsung:
GET /public/locations?search=... - Gunakan location atau subdistrict yang dikembalikan.
- Kode pos:
GET /public/locations/{location_id}/postal-codes
Alur reset password
Implementasikan reset password sebagai alur link di browser:- User memasukkan email.
- Frontend memanggil
POST /public/auth/forget-password. - Scalev mengirim link email ke
/reset-password?token=<reset-token>. - Frontend membaca
tokendari URL. - User memasukkan password baru dan konfirmasi.
- Frontend memanggil
POST /public/auth/save-password.
Origin.
Rendering payment
Gunakan field order ini untuk merender halaman payment:product_priceproduct_discountshipping_costshipping_discountother_incomegross_revenuepayment_methodsub_payment_methodpayment_account_holderpayment_account_numberpayment_urlpg_payment_infostore.payment_accountshandler_phonechat_message
store.payment_accounts saat tidak ada akun spesifik pada order. Metode hosted atau provider-backed bisa memakai payment_url atau pg_payment_info. gross_revenue adalah jumlah yang dibayar buyer.
Lihat Checkout dan Payment untuk aturan rendering per metode.
Subscription customer dan course
Untuk halaman akun customer, gunakan:GET /customers/me/subscriptionsGET /customers/me/subscriptions/{id}POST /customers/me/subscriptions/{id}/cancelPOST /customers/me/subscriptions/{id}/resumeGET /customers/me/subscription-items/{id}/upgradePOST /customers/me/subscription-items/{id}/upgradeGET /customers/me/subscription-items/{id}/downgradePOST /customers/me/subscription-items/{id}/downgradeGET /customers/me/variants/{uuid}/courseGET /customers/me/course-sections/{uuid}GET /customers/me/course-contents/{uuid}PATCH /customers/me/course-contents/{uuid}
403 atau 404 bisa berarti customer tidak memiliki variant course tersebut, bukan berarti integrasi storefront rusak.
Payload checkout lengkap minimal
Gunakan payload checkout variant lengkap seperti:Checklist agent
Implementasi lengkap saat bisa:- menampilkan daftar item katalog
- menampilkan detail product
- menampilkan detail bundle price option
- mengecek pricing dan availability
- menyimpan guest cart dengan
X-Scalev-Guest-Token - menambah, mengubah, dan menghapus item cart
- memilih lokasi pengiriman
- menghitung shipping options dan checkout summary
- membuat public checkout order
- menampilkan status public order dan instruksi payment
- membuat atau mengambil instruksi payment
- login customer dengan branch direct-token atau OTP
- refresh dan blacklist JWT
- mengelola profil dan alamat customer
- memakai customer cart
- membuat authenticated checkout order
- menampilkan daftar dan detail authenticated order
- menampilkan subscription dan course entitlement-gated saat ada
- melakukan semua hal di atas dari frontend tanpa backend custom

