> ## Documentation Index
> Fetch the complete documentation index at: https://docs.krti.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Add the line to a product page in five minutes.

**1. Get your public key**

In the [partners console](https://partners.krti.com), open **Website messaging** and create
a key. Test keys (`pk_test_`) work against the sandbox, live keys (`pk_live_`) against
production.

**2. Add a container where the line should appear**

Near the price, or under the "Add to cart" button:

```html theme={null}
<div id="krti-promo"></div>
```

> [!WARNING]
>
> Do not give the container an id equal to a component name (`KrtiPromo`, `KrtiCard`).
> Browsers expose element ids on `window`, and the div would shadow the constructor.

**3. Load the script and create the component**

```html theme={null}
<script src="https://js.krti.com/krti.js" async></script>
<script>
  window.krtiAsyncInit = function () {
    new KrtiPromo({
      selector: '#krti-promo',   // required
      publicKey: 'pk_live_...',  // required
      amount: '45.000',          // required: a string with the currency's decimals
      currency: 'KWD',           // required
      lang: 'en',                // optional: en or ar, else the page's <html lang>
      source: 'product',         // optional: product or cart
      theme: 'light',            // optional: light, dark or auto
      badge: 'brand'             // optional: the Krti badge, brand (default) or dark
    });
  };
</script>
```

`krtiAsyncInit` runs once, whether it is defined before or after the script tag. With a
blocking `<script>` (no `async`) call `new KrtiPromo(...)` right after it instead.

**4. Update the amount when it changes**

Variant and quantity selectors change the price. Keep the instance and call `update`:

```js theme={null}
const promo = new KrtiPromo({ ... });
promo.update({ amount: '52.500' });
```

**5. Add the checkout card**

Under your MyFatoorah payment option, shown when it is selected:

```html theme={null}
<div id="krti-card"></div>
<script>
  window.krtiAsyncInit = function () {
    new KrtiCard({ selector: '#krti-card', publicKey: 'pk_live_...', amount: '45.000', currency: 'KWD' });
  };
</script>
```

## Try it without a store

The demo page renders both components with your key:
`https://sandbox-js.krti.com/demo/index.html?key=pk_test_...` (sandbox) or
`https://js.krti.com/demo/index.html?key=pk_live_...` (production). Add `&lang=ar` for Arabic,
`&theme=dark` for the dark theme and `&badge=dark` for the dark badge.


## Related topics

- [Platform notes](https://docs.krti.com/on-site-messaging/platforms.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.