Introducing Subscriber - A Subscription Essentials Module For Roblox!

Hello guys! Ok, so how many of you had wanted to create subscriptions for your game, so that you can charge players a specific amount once and give them access to the Benefits of the Subscription for Specific time and then automatically make them expired when the time ends? Many people did, but many people found this hard. So we, built a module for everyone to create Subscriptions for their game!

Bringing to you Subscriber! A Module that does all the work for creating, retrieving and cancelling subscriptions, everything in the background!

About Subscriber

Subscriber is a Subscription essential module, that is built by @WaterJamesPlough and @TheBrainy06! It can be used to create, retrieve or cancel subscriptions, an example usage of it can be – A VIP subscription, in which you can call the Create Function on PurchaseFinished Event, you will probably know when you call the other 2 functions.

Subscriber has most of its code run in NodeJS & saves the subscriptions in MongoDB, we chose to do this because we felt like building this in NodeJS gave more flexiblity for functions.

Subscriber Usage

Our module has 3 main functions currently, but we will surely be updated it depending on the feedback/suggestions of everyone! One thing to remember, you need to place the subscriber module in Server Script Storage, as it makes HTTP requests, we don’t want to expose anything to our players.

Setup
First of all create two String values in ServerStorage (SubscriptionUsername & SubscriptionPassword) and enter in your Username & Password, it can be anything if its the first time you are running the module. Once you create the first subscription, your password can’t be changed.

1. Creating Subscriptions:

local subscriber = require(script.parent.Subscriber) --The location of the module script in Server Script Storage

subscriber.Create(857125712, 30, "VIP")

The Create method accepts three arguments - Player ID, Subscription Validity and Subscription Name

Player ID: Its the Player.UserId, just to recognize the player for which this subscription is.

Subscription Validity: A Number, which represents how long this Subscription is valid for in Days.

Subscription Name: A String, which represents the name of the Subscription, so you can retrieve it later on.

The Create method returns a response object, which looks like this:

 {"plrID":422797741,"validTill":"Wed Jun 24 2020","valid":true,"failResponse":"Faced No Errors"}

It returns 4 Values - Player ID, Valid Till Date (In a readable form), Valid and Fail Reason.

Player ID - The UserId of the player
Valid Till Date - A Date given in Human Readable form, until when the subscription is valid.
Valid - Specifies if the Subscription is still valid
Fail Reason - If there were any errors while creating the Subscription, it will be stated here.


2. Retrieving Subscriptions

local subscriber = require(script.parent.Subscriber) --The location of the module script in Server Script Storage

subscriber.Retrieve(857125712, "VIP")

The Retrieve method accepts two arguments - Player ID and Subscription Name

Player ID: Its the Player.UserId, just to recognize the player whose this subscription is.

Subscription Name: A String, which represents the name of the Subscription.

The Retrieve method returns a response object, which looks like this:

{"plrID":422797741,"subscriptionName":"VIP","valid":true,"validTill":"Wed Jun 24 2020"}

It returns 4 Values - Player ID, Subscription Name, Validity And Valid Till Date.

Player ID - The UserId of the player
Subscription Name - The Unique Identifier Name for the Subscription
Validity - Returns a boolean, which represents if the Subscription is valid or not. Will return false, if there is no subscription.
Valid Till Date - Returns a Human Readable String, representing the date till which the subscription is valid. Will be null if the Subscription does not have a valid till date, meaning probably there isn’t a subscription.


3. Cancelling Subscriptions:

local subscriber = require(script.parent.Subscriber) --The location of the module script in Server Script Storage

subscriber.Cancel(857125712,"VIP")

The Cancel method accepts two arguments - Player ID and Subscription Name

Player ID: Its the Player.UserId, just to recognize the player for which this subscription is of.

Subscription Name: A String, which represents the name of the Subscription, to recognize which subscription to cancel, as there might be multiple subscriptions (VIP, PREMIUM etc).

The Cancel method returns a response object, which looks like this:

 {"plrID":422797741,"subscriptionName":"VIP","Cancelled":false,"validTill":"Wed Jun 24 2020"}

It returns 4 Values - Player ID, Subscription Name, Cancelled, Valid Till Date

Player ID - The UserId of the player, whose Subscription was cancelled
Subscription Name - Specifies the name of the Subscription that was cancelled
Cancelled Property - Specifies if the Subscription was cancelled, boolean response.

Valid Till Date - A Date given in Human Readable form, until when the subscription is valid. Our module automatically expires the subscription when the Valid Till Date ends, suppose the Person bought it today and cancelled it after 3 days (For Some Reason), and 5 days are left for the Subscription. Our System will expire the subscription after 5 days, till then the subscription will still be Valid.


@TheBrainy06 will be making a tutorial on this explaining with an example soon, keep a look out for it! Till then if you would like to install and test our module

Source Code:

Roblox Module Code:
https://pastebin.com/B0ndZkau

Thank you.

39 Likes

I don’t think that this is needed, since Subscription will be official feature from Roblox.

But good job, but sadly I don’t think it will be used when Subscription feature releases.

4 Likes

Yes, I am truly aware of that feature, so this will probably be used until the official feature is released.

1 Like

Correct. Also you should put the Model up to sale. I cannot get it.

2 Likes

Oh, my bad. I will do it. (30 Characters omg.)

Updated The Model, you should be able to get it now.

Hi there~ @WaterJamesPlough

Thank you for sharing your creation with us, this is very interesting stuff.

Would you kindly create a link to Source code (preferably Github and/or Pastebin) for people who want to read the source but don’t have any access to a PC or maybe want to contribute to the source

2 Likes

Hi, sure I can share the Source Code, as this is open source. But one thing, our module is mostly built in NodeJS, so I will link our source Code in Github.

And maybe the one module script our model includes.

Sounds cool, might use it. Thanks for providing this!

2 Likes

Here is a link to The GitHuh Repo - https://github.com/NeilShankar/subscriber - including most of our Module’s working.

I will share the Code used in the Roblox Module Script, when I am able to access the Studio.

I added a link to the Roblox Module source code & Github Repository in the Post, also did some refactoring in the NodeJS source code, so its easier for others to read.

1 Like

Looks great! Thanks for making this, I might use it as a donation gui in my game lol.

1 Like

This seems like a cool concept, but why use NodeJS?
You could achieve the same functionality, without any outside dependencies, using tick() and Datastore.

EDIT:
Actually, this would be pretty useful for making Studio Plugins. Very cool.

1 Like

Is the tutorial released yet? 30char