Skip to content
On this page

Quick Start

Installation

Basic installation of Subscription-now.js is a very straightforward procedure. It involves two steps:

  1. Obtain your token
  2. Add the snippet with the token to your application
  3. Add the style link to your head tags

Obtaining token

The token is a base64 encoded JSON array that has three items that can be obtained from Subscription-now Dashboard or generated if you know the following information and have basic programming knowledge.

  1. The ID of the app that you created Subscription-now Dashboard
  2. The target Subscription-now server URL
  3. Environment type (either sandbox or production)

An example object looks like this:

["9dfbab59-da71-48b0-92fa-aa8a74a0c623", "https://api.subscription-now.com", "sandbox"]
1

When this object is stringified and base64 encoded, it will look something like this:

WyI5ZGZiYWI1OS1kYTcxLTQ4YjAtOTJmYS1hYThhNzRhMGM2MjMiLCJodHRwczovL2FwaS5zdWJzY3JpcHRpb24tbm93LmNvbSIsInNhbmRib3giXQ==
1

Adding the Snippets to Your Application

And the most basic example of the SN.js snippet can be seen below:

<script src="https://cdn.sn-nw.net/subscription-now.latest.js" id="snJS" data-sn-credentials="WyI5ZGZiYWI1OS1kYTcxLTQ4YjAtOTJmYS1hYThhNzRhMGM2MjMiLCJodHRwczovL2FwaS5zdWJzY3JpcHRpb24tbm93LmNvbSIsInNhbmRib3giXQ==" defer></script>
1

When you add this snippet at the end of your <body></body> tag, Subscription-now elements will be generated.

Finally just add the following snippet between the <head></head> tags of your application:

<link href="https://cdn.sn-nw.net/subscription-now.latest.css" rel="stylesheet">
1

Great, you are ready to sell subscriptions!