Stakk Docs
Embed

JavaScript API

Open checkout from your own code and listen for payment events.

The embed script exposes window.Stakk. window.Stakk is the same object, so older snippets still run.

Load

<script src="https://your-vinext-host/embed.js"></script>

Methods

<script>
  Stakk.init({ shopId: "your-shop" });

  Stakk.open({
    shopId: "your-shop",
    productId: "PRODUCT_ID",
    quantity: 1,
    coupon: "SAVE10",
    email: "buyer@example.com",
    gateway: "BITCOIN",
    fields: { username: "florian" },
  });
</script>
MethodDescription
Stakk.init({ shopId, checkoutBaseUrl })Set defaults. Called automatically on load
Stakk.open(options)Open checkout for one product
Stakk.addItem(item)Push a product onto the embed cart
Stakk.checkout(options)Open checkout from the cart
Stakk.close()Close the modal
Stakk.getItems()Current cart lines
Stakk.getItemCount()Cart line count

open / checkout options: shopId, productId, quantity, variantId, coupon, email, gateway, theme, locale, affiliate, returnUrl, fields.

Events

<script>
  document.addEventListener("vinext:ready", () => {
    console.log("Checkout opened");
  });

  document.addEventListener("vinext:success", (event) => {
    console.log("Paid", event.detail);
  });

  document.addEventListener("vinext:close", () => {
    console.log("Closed");
  });
</script>

vinext:success is still dispatched for compatibility.

On this page