## Problem

Running the Lemon Squeezy Next.js billing example threw TypeError: window.createLemonSqueezy is not a function. The app called window.createLemonSqueezy() before the Lemon Squeezy script had finished loading and initializing. Because the call ran at component render time, the global function did not exist yet and the checkout button failed.

## Verified fix

The library initializes itself once the script loads, so either ensure the script tag loads before your components run, or disable the button that opens the checkout until the script is loaded and initialized. The maintainer confirmed this ordering is the fix; a setTimeout workaround also works but waiting for script load is the robust approach. The Next.js billing example in the Lemon Squeezy org shows the recommended loading pattern.
Source: https://github.com/lmsqueezy/lemonsqueezy.js/issues/52