Recharge

Sell subscription products on your site with Nyla and Recharge

This article takes you through how to use Recharge on your Nyla site:

Activation Instructions

In order to activate the Recharge app you should: 

  • Create 1-2 API Tokens in the Recharge app for Nyla
    • In the left menu in the Recharge app, click on Apps > API Tokens > than on the main frame click on Create an Admin API Token on top right hand
    • For the options Order, Discounts, Subscriptions, Payments, Customers, Products, Async Batches, Checkouts, select Read and Write access. For the other ones just leave as No access. Save. You should see your token created and its API Key. 
    • [Recommended] Please repeat the process to have at least 2 tokens dedicated to Nyla to avoid errors in peaks of orders.
  • Activate Recharge in the Nyla app
    • In the left menu in the Nyla app, click on Apps > search for Recharge and add in the API Keys on the fields Token 0 and Token 1.
    • Ensure that Use v2 is enabled if you are not using the legacy recharge checkout
    • Ensure that use legacy properties is switched off if you are not using the legacy recharge checkout
    • Save, Queue and Publish

Adding Recharge to your Site: 

1. Add a subscription selector to your PDPs

  • See PDP Blocks for how to add subscription options to your PDP. Customers should be able to pick between one time and subscription plans as well as choosing their subscription frequency.
  • Properties from the product.sellingPlanGroups can be used to create custom experiences, to calculate discounts and so on. In the cart, sellingPlanAllocation properties can be used to do the same. 
  • If applicable, you should ensure that discounts are taken into account on your pricing for the PDP. 
  • You should hide the subscription selector for any PDPs that don’t have subscriptions

2. Add subscription upsells in cart: 

This feature enables shoppers to choose between a one time purchase and subscription in the cart, as well as change their subscription plan. 


See Cart Blocks for how to add subscription options to your site. 


3. Link to your Accounts portal: 

Nyla supports the external recharge accounts portal, however you need to reach out to Recharge support in order to have this activated for you. You need to ask for access to be granted to GET /customers/<id>/portal_url for API key "Nyla". 


Once this is done, adding the OPEN_RECHARGE_PORTAL link action will open the portal for logged in customers with subscriptions. 

Setting subscription defaults

Default options: Nyla enables you to set your PDPs to have subscription on by default, and to set which subscription option you want to set as your default for that product. 

  • Adding the metafield nyla_subscription.defaultValue will set the subscription value according to the index set in the metafield. For example, setting the metafield to 2, will set the 2nd subscription option as default (e.g this is in base 1 format). Leaving this empty will take the first subscription value. 
    • By default, subscription options defaults to the 1st option in the list and populating this metafield value overrides that. 
  • Adding the metafield nyla_subscription.defaultSelected with the value of “true” will make that product default to having subscription selected globally across the site. 
    • If no subscription options are visible to the user, then subscription will be ignored, and the product will be treated as a one time purchase.

Building with Recharge


Nyla includes the following blocks out of the box for you to add subscriptions UI to your site:  

PDP Blocks

  • Subscription: Options
    • Adds a layout for the subscription options
    • Requirements:
      • Skio or Recharge App is enabled
      • Product has subscription plan
  • Subscription: Price
    • Adds a layout for the subscription price
    • Requirements:
      • Recharge App is enabled
      • Product has subscription plan
  • Subscription: Add To Cart
    • Adds a layout for the ATC with dynamic pricing
    • Requirements:
      • Recharge App is enabled
      • Product has subscription plan

Cart Blocks

  • Subscription: Cart Upsell
    • Adds a subscription option upsell layout
    • Requirements:
      • Recharge App is enabled
      • Product has subscription plan

Account Blocks

  • Subscription: Recharge Portal Link
    • Adds a link to the Recharge subscriptions portal in the account pages
    • Requirements:
      • Recharge App is enabled
      • “Account - Header” template is on the page

Link Actions and Properties