Stakk Docs
Embed

Embed

Add an HTML button for products on your site and accept payments in seconds.

The embed is the fastest way to sell a Stakk product on any website. Load the script once, then put a button wherever you want checkout to open.

The embed checkout

Add the script to your page, then declare a product on a button. Clicking it opens Stakk checkout in a modal.

<script src="https://stakk.cc/embed.js"></script>

<button type="button" data-stakk-product="PRODUCT_ID">
  Buy now
</button>

Replace PRODUCT_ID with the product ID from Dashboard → Products.

Prefill fields from HTML

Anything you can type in checkout can be declared on the button. Stakk reads the attributes and applies them when the modal opens.

<button
  type="button"
  data-stakk-product="PRODUCT_ID"
  data-stakk-coupon="SAVE10"
  data-stakk-email="buyer@example.com"
  data-stakk-quantity="2"
  data-stakk-gateway="BITCOIN"
  data-stakk-field-username="alex"
>
  Buy with coupon
</button>
  • data-stakk-coupon auto-applies a coupon
  • data-stakk-email fills the delivery email
  • data-stakk-quantity sets quantity
  • data-stakk-gateway pre-selects a payment method
  • data-stakk-field-{key} fills a product custom field by name

See the full attribute list.

Styling

The overlay, modal, and checkout chrome come from Stakk. Style your own button however you want — it is just HTML.

<button
  class="your-buy-button"
  data-stakk-product="PRODUCT_ID"
>
  Get access
</button>

JavaScript

Need a cart, a success callback, or a custom trigger? Use window.Stakk.

<script>
  document.addEventListener("stakk:success", (event) => {
    console.log("Paid", event.detail);
  });
</script>