npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

subsurge

v1.1.0

Published

subsurge integration kit for recurring payments and user management

Readme

The JavascriptSDK for Subsurge.Net

Introduction:

the sdk contains many classes the most important one that's explained here in details is The APIClient class, since it contains the core functions that you need to manage user login and payments.

First step is to initialize the client with the required data:

Make sure that you completed the setup properly subsurge.net, and used the same client Id for that app

Minimal Setup Example


const clientSDK = new SubsurgeSDK.APIClient({
    appId: '{{YOUR_APP_ID}}', // App Id on subsurge.com e.g 21a79421a7964ddcbf41222829041194
    // Google Client Id If you want to use Google Auth
    googleClientId: "{{YOUR Google ClientId}}", // e."920059261823-zh90m3p3hhtvrk8sk1kinuak1thjdwve.apps.googleusercontent.com",
}); 

Example on a background.js page for a browser extension:


const clientSDK = new SubsurgeSDK.APIClient({
    appId: '{{YOUR_APP_ID}}', // App Id on subsurge.com e.g 21a79421a7964ddcbf41222829041194
    // On background.js, we need to use the platformName 'browser-extension' 
    platformName: 'browser-extension',
    // Auth0 Client Id & Domain If you want to use Auth0 Auth
    auth0ClientId: "{{YOUR Auth0 ClientId}}", // for example "z2Nw7xeikj0s9wJSIOdaPuXdG8Q94125"
    auth0Domain: "{{YOUR Auth0 Domain}}" // e.g  "dev-wf241mdmk.us.auth0.com"
}, chrome); 

API Client Documentation

Methods


loadUserInfo()

Description:
Load the current user's profile information.

Returns:
Promise<CurrentUserDto>

Example:

const user = await apiClient.loadUserInfo();
console.log(user.email);

loadAppDetails()

Description:
Load the app's public details such as name, description, subscription plans, and digital products.

Returns:
Promise<FullAppDto>

Example:

const appDetails = await apiClient.loadAppDetails();
console.log(appDetails.name);

loginWithGoogleFlow()

Description:
Initiates the Google login flow. Only supported in browser extensions.

Returns:
any

Example:

await apiClient.loginWithGoogleFlow();

loginWithAuth0Flow()

Description:
Initiates the Auth0 login flow. Only supported in browser extensions.

Returns:
any

Example:

await apiClient.loginWithAuth0Flow();

loginWithGoogleToken(googleIdToken: string)

Description:
Login using a Google id_token.

Parameters:

  • googleIdToken (string): The Google ID token.

Returns:
Promise<oauthToken>

Example:

const token = await apiClient.loginWithGoogleToken("your-google-id-token");

loginWithAuth0Token(auth0IdToken: string)

Description:
Login using an Auth0 access_token.

Parameters:

  • auth0IdToken (string): The Auth0 access token.

Returns:
Promise<oauthToken>

Example:

const token = await apiClient.loginWithAuth0Token("your-auth0-id-token");

logoutAsync()

Description:
Logs out the current user.

Returns:
Promise<void>

Example:

await apiClient.logoutAsync();

isAuthenticated()

Description:
Check if the user is authenticated.

Returns:
Promise<boolean>

Example:

const loggedIn = await apiClient.isAuthenticated();

createPaymentLink(productId: string, packageId: string, provider: 'paypal' | 'stripe')

Description:
Create a payment link for a specific product and package.

Parameters:

  • productId (string): The product ID on Subsurge.
  • packageId (string): The package ID on Subsurge.
  • provider ('paypal' | 'stripe'): The payment provider.

Returns:
Promise<unknown>

Example:

const link = await apiClient.createPaymentLink("prod123", "pkg456", "stripe");

createSubscriptionLink(planId: string, provider: 'paypal' | 'stripe')

Description:
Create a subscription link for a specific plan.

Parameters:

  • planId (string): The subscription plan ID.
  • provider ('paypal' | 'stripe'): The payment provider.

Returns:
Promise<unknown>

Example:

const link = await apiClient.createSubscriptionLink("plan789", "paypal");

cancelCurrentSubscription()

Description:
Cancel the current user's subscription if it exists on Subsurge.

Returns:
Promise<unknown>

Example:

await apiClient.cancelCurrentSubscription();