Skip to main content

Initialization

To initialize the Recharge JavaScript SDK, you will need to do it within the root of your theme (wherever the <head> element is located). Generally this tag is located in a file called theme.liquid.

Pre-requisites

Before using the SDK, make sure you have configured Rewards for your store. (See Rewards)

Overview

Rewards can be used to incentivize subscription purchases and provide credits to customers for achieving certain milestones such as 3 consecutive subscription charges.

Example

Load the JavaScript SDK script, and then initialize it with your store domain:

<head>
<!-- Rest of your code -->
<script src="https://static.rechargecdn.com/assets/storefront/recharge-client-1.25.5.min.js"></script>
<script>
recharge.init({
// This should be your myshopify.com domain
storeIdentifier: '{{shop.permanent_domain}}',
appName: 'appName',
appVersion: '1.0.0',
});
</script>
</head>

Get the customer's session using one of the SDK Auth methods, then try some of the example use cases below: