Skip to main content
E-commerce methods for published sites. Requires the Online Store feature (online_store).

Catalog

getStore()

Store metadata (name, currency, settings).

getProducts(options?)

getProductById(id) / getProductBySlug(slug)

getProductCategories()

Cart

Cart state lives in the visitor’s browser session (sessionStorage). It is shared across store pages in the same tab until checkout. Nothing is sent to the server until createOrder. Each cart method returns a Promise resolving to:

getCart()

Read the current cart. Use on checkout pages or for a cart badge count.

addToCart(productId, quantity?)

Add a product or increase its quantity. Default quantity is 1. Merges with an existing line for the same product.

setCartItems(items)

Replace the entire cart. Duplicate productId values are merged; quantities are capped at 99 per line.
Use on checkout when the visitor edits quantities in a cart table.

setCartItemQuantity(productId, quantity)

Set quantity for one product. Pass 0 to remove that line.

removeFromCart(productId)

Remove one product from the cart.

clearCart()

Empty the cart. Call after a successful createOrder on checkout.

Typical flow

Orders

createOrder(payload)

trackOrder(token)

Guest-safe status read. Poll this on a status page after checkout.

retryPayment(token)

Create a new QRIS payment when the previous one expired or failed. Only works while the order is still pending.
Requires Payment Gateway (payment_gateway) with platform payments configured or a merchant Xendit key. See Payment Gateway.

Signed-in customer orders

Requires User Authentication (user_authentication) and an active site session.

User guide

Non-technical setup: Online store