# Step 1: Load the SDK

> STEP 2-1

Add the following script tag to the page's `<head>`.

```html
<script src="https://script.rcmr.io/checkout-plus/sdk/shopify-headless/v1/checkout-plus.js" defer></script>
```

In Next.js, you can also load it with `next/script`. If you set a CSP, add `https://script.rcmr.io` to `script-src` ([Requirements](./shopify-headless.html#requirements)).

The SDK script may finish loading after your page has initialized. Before you call `init()`, check whether `window.rcmr?.checkoutPlus` exists, and if it doesn't, wait for the `recustomer-checkout-plus:ready` event that the SDK dispatches when it finishes loading ([Delivery URLs and versions](./shopify-headless-delivery.html#delivery-urls-and-versions)). Before the SDK loads, `window.rcmr` may not exist, so read it with `?.` instead of `window.rcmr.checkoutPlus`. Set a limit on how long to wait, and if the SDK still hasn't loaded after that, continue without showing Checkout+. If the SDK is blocked by the network or a browser extension, the event never arrives. `loadCheckoutPlus()` in `lib/checkout-plus.ts` from [4-1. Examples that connect to the SDK](./shopify-headless-sample-code-sdk.html#lib-checkout-plus-ts) is an example of this wait, and returns `null` if the SDK hasn't loaded after 10 seconds.

For TypeScript, copy the type definitions in [4-3. Type definitions (TypeScript)](./shopify-headless-sample-code-types.html) and place them as `checkout-plus.d.ts` in a folder included by your tsconfig (for example, `types/`).
