Skip to main content

I’m trying to use the web sdk in my javascript code but I can’t even pass the initial stage. I’m loading the sdk from unpkg. Here’s my code:

<script src="https://unpkg.com/@revenuecat/purchases-js@0.11.1/dist/Purchases.umd.js"></script>

<script>
const api_key = “PUBLIC_API_KEY”

const appUserId = “MY_APP_USER_ID” // Replacing with my own userid

const purchases = Purchases.configure(api_key, appUserId);
</script>

And just this gives me the error:

Purchases.configure is not a function

What am I doing wrong here?

Hi @aiappbuilder! I just replied to your support ticket and have copied my response below:

When importing purchases-js in this manner, please try the following syntax:

const purchases = Purchases.Purchases.configure(api_key, appUserId);

Please let me know if you continue to run into any issues.