See all Blogs
July 1, 2024
by
Vipul Babbar

Recharge APIs and Loop APIs - Understanding the APIs of Subscriptions Apps on Shopify

The subscription management space is growing - brands have come to realise the importance of recurring revenue and want to understand ways in which they can grow subscriptions revenue - after all, acquisition is expensive and the cost of acquisition will only rise in the years to come 

To grow a successful recurring revenue business, it is of utmost importance that you use a system that helps you scale up / offer a wide range of experiences to your customers.

Here are some of the levers that are offered by subscriptions apps to grow a healthy recurring revenue stream / provide a good experience to customers

  • Flows
  • Widgets
  • Building an intuitive customer portal
  • Bundles
  • Customizations 
  • Cancellation Flows
  • Attractive offers 

APIs help automate the process of passing data between 2 systems / managing data - customized to fit your specific needs/business. The goal is to simplify subscription management and give advanced experiences to both merchants and their customers.

When you go about choosing the right API a few factors should take precedence in the decision-making process

  1. How intensive are the APIs - be it Recharge APIs / Loop APIs or any other top subscription-providing companies? In other words, how many customizations can the APIs support in order to make it a success?

With the help of intensive APIs - one can create more number of customizations and hence build a more robust customer experience

  1. How many services/categories are provided by the top subscriptions apps?

Categories are also a proxy for understanding how strong the APIs are - the stronger the APIs, the more the use cases it can solve.

Ex: Hello Bello makes use of Loop’s API base to create a strong Customer Portal + Admin Portal.

Hello Bello’s Customer Portal - Built by Loop APIs - Gamified the Subscription process by offering an incentive (ex: 10% waiver offered after x orders)

Find out more about Loop flows here

Loop APIs - how does Loop serve as a great alternative to recharge APIs

Loop and Recharge APIs are two prominent players in the subscriptons space, offering developers powerful tools to integrate subscription management, streamline operations, and enhance customer experiences. While both AP share common features and goals, they also exhibit distinct characteristics and functionalities that cater to different needs within the e-commerce landscape.

Let’s talk about a few use cases for Loop - brands that are leveraging Loop APIs to make unforgettable customer experiences.

Hello Bello 

Hello Bello is a leading premium baby diaper company - that offers various kinds of  subscriptions

When Hello Bello joined Loop (from Recharge), they wanted to create their own Customer Portal. Goal : They wanted to include multiple pieces of information in one place - They also wanted one Customer portal for both one-time orders and subscriptions orders

Here are the things that they were able to achieve:

  • Creation of a Flow summary and a rewarding journey
  • Creation of cancellation flows to reduce churn to get more info on cancellation 
  • Management of their subscriptions from the custom custom portal 

Quick pointers for Hello Bello

  • Hello Bello use Loop flows to increase LTV
  • Via loop APIs they can fetch flow reward banners to inform customers about upcoming orders
  • Via Loop APIs they were able to build a single CP for both one-time orders and subscription order

Using Loop, Hello Bello were able to build Storefront APIs: https://loop-storefront.readme.io/reference/flow-reward-banner

Cancellation flow has been personalized - segment benefits basis conditions set on customer portal

Every

With Every, consumers can enjoy healthy eating without the hassle. Every offers delicious, sustainable solutions for a better you and a better planet. How does Every make use of Loop APIs

  • Made use of Loop’s Customer Portal APIs to create a headless customer portal (that is, not dependent on Loop - completely API based made for Every)
  • Create their own Customer Portal which consists of more data to educate their customers
  • Upselling cross selling via different categories

Every’s Headless Customer Portal

Rise Garden

Rise Gardens offers indoor hydroponic garden options, enabling year-round growth of veggies, fruits, and leafy greens - their innovative features include seedless pods, pH balance solutions, and customizable garden setups for optimal nutrition and fresh flavors.

How did Rise Garden make use of Loop APIs?

Loop helped Rise create: 

  • A custom bundle experience - Loop APIs were used to create bundles
  • A framework to customise boxes using bundle APIs

Dunatura 

Dunatura is a health vitamins company whose goal is to create customized/tailored offerings for their users

Dunatura makes use of Loop’s Bundle APIs to achieve the following:

  • Build customized bundles: Dunatura wanted to have their own custom bundles and offer a wide range of options to their customers.
  • Build custom experiences: With the help of Loop APIs, Dunatura was able to build a custom experience via questionnaires - based on questionnaire responses, a custom bundle was offered to customers that fits perfectly with their needs.

Technical Framework : Recharge + Loop AP

How do the top subscriptions providers build an API framework? Different subscription companies have approached APIs in different ways

Let’s start with Recharge AP

Recharge APIs

The Recharge API primarily functions as a REST API*, supplemented by some RPC** endpoints to facilitate common operations.

It features predictable, resource-oriented URLs, accepts request bodies encoded in JSON***, returns responses in JSON format, and utilizes standard HTTP response codes, authentication methods, and HTTP methods.

REST API - is REpresentational State Transfer - it is basically a design for creating an API with the goal of efficient communication in between systems

An RPC** (Remote Procedure Call)l could be classified as a type of API (application programming interface) that allows for developers to run code that can be executed on servers remotely.

JSON*** stands for JavaScript Object Notation. JSON is a text format for storing and transporting data.

Recharge APIs - Scope

Recharge integrates with various e-commerce players - for a seamless process of data and recurring payments. Unique tags have been mapped to each player for differentiation.

To ensure compatibility across various platforms, some of Recharge's API resources and endpoints may be limited to certain platforms. In these instances, tags will be used to indicate the specific checkout/platform associations that are supported. 

Authentication

Recharge utilizes API keys for authenticating requests. Each API request should include an API token in the following header:

X-Recharge-Access-Token: store_api_token

Replace store_api_token with the actual API key. Additionally, all requests must be made over HTTPS.

FYI: Loop Subscriptions offers 2 APIs - admin and storefront APIs - here is the reference URL for each:

Admin API authentication
Storefront Api authentication 

The goal is to provide a safe route for customers to log in to the subscriber portal. More on this later in this blog.

API Token Scopes

In Recharge, token scopes can be configured from the API token edit page to control the access level of an API token.

Loop API data can be fetched from the settings page and unique configurations can be created.

Versioning

All requests will follow an account's API settings unless you specify a version using the X-Recharge-Version header. The same token can be used to make calls across all versions. If no version is specified, the request will default to the version set as the default for your store.

Page-Based Pagination

By default, Recharge's API calls return 50 results. This can be increased to 250 results using the limit parameter.

When there are more results than can fit on a single page, you can navigate through the results using the page parameter. To request a specific page, include “page” as a parameter in the URL.

For example:

https://api.rechargeapps.com/subscriptions?limit=250&page=1

Sorting

Recharge's API supports sorting of results when using a GET request to retrieve a list. Sorting is accomplished using the sort_by query parameter in the request URL. The sort_by value specifies the parameter and sort direction (ascending or descending) for the results. Available sort_by values vary between resources

Source of information: https://developer.rechargepayments.com/2021-01/sortingthe F

Loop APIs - A Technical framework

Loop APIs are organized around REST and offer a powerful way to build subscription experiences.

Loop has 2 kinds of APIs

  • Admin
  • Storefront

Let’s briefly talk about each.

Admin APIs

Admin APIs are designed for managing various subscription tasks within a Shopify-based platform, with operations performed at the individual store level. Typical applications include:

  • Integration with third-party services
  • Utilization of webhooks for event-driven actions
  • Customization of backend systems
  • Generation of tokens for secure API access

These APIs are crucial for automating subscription processes and enhancing the functionality of Shopify stores through custom integrations.

Authentication

To authenticate with the admin API, you'll need an apiToken from the Loop admin portal. Here's how to generate one:

  1. Go to the Loop Admin Portal.
  2. Navigate to Settings, then Manage API tokens.
  3. Click "Generate new token."
  4. Enter a descriptive name for the token.
  5. Choose necessary permissions by selecting relevant scopes.
  6. Click "Generate" to create the token.

You can create multiple API tokens for merchants, each with different permissions based on assigned scopes. These tokens can be viewed and managed in the "Manage API tokens" section.

Remember to treat these tokens like passwords - keep them confidential and securely stored on the server side, not exposed to the public. Unauthorized access to your token could allow someone to perform actions on your subscriptions allowed by the token's assigned scopes.

Errors

Loop employs conventional HTTP response codes to indicate the success or failure of an API request. Here's a breakdown:

  • Success: Codes in the 2xx range indicate success.
  • Client Errors: Codes in the 4xx range indicate an error due to information provided (e.g., a required parameter was omitted, a charge failed, etc.).
  • Server Errors: Codes in the 5xx range indicate an error with Loop's servers (these are rare).

Request IDs

Every API request is assigned a unique identifier. You can locate this value in the response headers, labeled as Request-Id. If you ever need to reach out to us regarding a particular request, providing the request identifier will help us expedite the resolution process.

Versioning

Whenever there are backwards-incompatible changes to the API, we release a new version with a specific date. The current version is 2023-10. Check out our API upgrades guide to understand more about maintaining backwards compatibility. For all updates to the API, you can find details in our API changelog.

Storefront APIs

Storefront APIs are tailored to execute actions on subscriptions, such as resuming, reactivating, pausing, or cancelling, for a particular customer and subscription.

Authentication

The storefront API within Loop utilizes JWT tokens (access tokens) for authentication purposes. Access tokens can be obtained using either the API key or a session token.

Generate refresh token and access token

refreshToken and accessToken are used to handle authentication on the customer portal. For details please refer to Authentication.

Rotate access token

The access token, with a validity period of 4 days, necessitates rotation every 4 days. Further information can be found in the Authentication section.

API keys within Loop confer extensive privileges, so it's imperative to safeguard them. It's advised not to share secret API keys in publicly accessible platforms such as GitHub or client-side code.

Customers are directed to the portal using a session token, which they can acquire through various channels such as email notifications, magic link generation, or reactivation campaigns.

The diagram below illustrates how Loop utilizes the session token to grant portal access.

  • Session token: Functions as an entry token, with an expiry of 1 day
  • Access token: Serves as an authentication token for storefront APIs, expiring in 4 days
  • Refresh token: Used for rotating access tokens, with an expiry of 30 days

A session token enables obtaining a refresh token and access token in a single API call, thus saving one API call per new login. Subsequently, the refresh token facilitates access token rotation, generating a fresh access token.

The access token can be used as a bearer token in the headers for authentication.

--header 'Authorization: Bearer accessToken'

Request IDs

Every API request within Loop is assigned a unique identifier. This identifier can be found in the response headers under Request-Id. If there's a need to reach out about a particular request, providing the request identifier will ensure the quickest possible resolution.

Find more details about Loop APIs here - https://help.loopwork.co/article/123-api-documentation

Summing up

While Loop and Recharge APIs share common goals of empowering brands to provide unforgettable experiences - the strength of the APIs can be seen by the functionalities that cater to different use cases and preferences (defined by the merchant). True success lies in being able to cater to the various needs of the merchants.

The choice between Loop and Recharge APIs depends on factors such as specific custom requirements, how many and what quality of experiences you want to give to customers, integration preferences, and compatibility with existing systems, ensuring that developers have the flexibility and resources to create tailored solutions that meet their unique business needs.

400+ BRANDS SEAMLESSLY MIGRATED
Switch to Loop for advanced subscription management.
Experience Seamless Migration (Zero Data Loss) with Dedicated 1-to-1 Support via Slack.
Book a Demo Now