Skip to main content

SDK / Getting started

Getting started

Add a mySutra calculator to any page with a script tag. No build step required.

1. Add a mount point

<div id="calculator"></div>

2. Load the SDK

<script src="https://tools.1dollars.org/sdk/v1/mysutra.min.js"></script>

3. Render a tool

MySutra.render({
  target: "#calculator",
  tool: "emi-calculator",
  theme: "auto",
  locale: "en-IN",
  currency: "INR",
  onResult(result) {
    console.log(result);
  },
});

React / Next.js

Load the script once (in _document / layout) or import the ESM build, then call MySutra.render inside useEffect. Destroy the widget on unmount.

useEffect(() => {
  const widget = MySutra.render({ target: ref.current, tool: "bmi-calculator" });
  return () => widget.destroy();
}, []);

Next: API reference · Playground