# Install Kustom Elements

Install Kustom Elements with the Portal script, register your domains and add payment, delivery or express button tags to your pages.

For available elements and their requirements, see [Kustom Elements overview](/checkout/surfaces/elements-overview/).

## Before you start

You need a Kustom merchant account and access to the [Kustom Portal](https://portal.kustom.co/)
for your environment. **Each script belongs to one Merchant ID and environment**, identified
by its `data-public-api-key`. Copy the script for the MID and environment you're integrating.

## Step by step

**1. Register your domains.** In the Portal, go to **Elements** and add every domain the
elements will run on, such as `www.my-shop.com` and `checkout.my-shop.com`. Elements
won't render on a domain that isn't on the list.

In Playground only, you may use a wildcard such as `*.my-shop.com`. Production requires
each domain in full.

**2. Copy the installation script** from the same Portal screen, and place it as high in
your page `<head>` as you can, before any element tag. Add it to the shared layout or
template for pages that use elements.

```html
<head>
  <!-- Kustom Elements Snippet start -->
  <script
    async
    id="kustom-elements-script"
    type="text/javascript"
    src="https://js.live.kustom.co/kustom-elements/v1/pre-load.js"
    data-public-api-key="{{Your public API key}}"
  ></script>
  <script>
    (function (w) {
      ((window.kustomElements =
        window.kustomElements ||
        function (w, ...n) {
          return new Promise((o, i) => {
            window.kustomElements._internal.q.push({ method: w, args: n, resolve: o, reject: i });
          });
        }),
        (window.kustomElements._internal = window.kustomElements._internal || {
          q: [],
          snippetVersion: '1.0.0',
        }),
        window.kustomElements.load ||
          (window.kustomElements.load = new Promise((w, n) => {
            ((window.kustomElements._internal.loadResolve = w),
              (window.kustomElements._internal.loadReject = n));
          })));
    })(window);
  </script>
  <!-- Kustom Elements Snippet end -->
</head>
```

Copy your script from the Portal. The example above contains a placeholder API key.

**Load it from the Kustom CDN URL the Portal gives you.** Don't download and re-host it,
and don't proxy it through your own domain. Both break the integration.

**3. Add an element tag** where you want it to appear. The installation script detects the
tag and renders it:

```html
<kustom-payment-method-display locale="en-SE"></kustom-payment-method-display>
```

Express buttons also need a JavaScript call to supply the order. See
[Add express buttons](/checkout/surfaces/express-buttons/).

Load the page on a registered domain and check that the element renders. If it stays
empty, check the domain registration, the script's CDN URL and its position before the
element tag, in that order.

## Related

- [Add express buttons](/checkout/surfaces/express-buttons/) — wallet buttons on a product or cart page
- [Element catalogue](/checkout/surfaces/elements-catalogue/) — every element, its attributes and its locales
- [Integration models](/checkout/#integration-models) — where Elements fits beside the integration models
- [Browse platform plugins](/partners/) — a plugin may already place these for you
