Auto Developer Product Creation for Donation purposes

Recently I began making an escrow service for roblox, I won’t talk about that here though, you can join that discussion here. While making this I knew I would need a way to automatically make a developer product and then prompt that product purchase to the user. However, I could not find any working solutions for this problem, so I decided to make my own. This, however was inspired by: Custom Developer Products, and some of their code is reused here.

This resource uses an http server made in node.js, along with using the developer product api.

The github repo for the web server can be found here. Currently it uses a json file for storing existing price/product combinations, which I do not recommend, but it is the easiest to do without any extra dependencies and no database knowledge. In my actual solutions I use a custom SQL database. Here’s what you need to do after cloning this repository (this resource does not handle hosting, I have my own dedicated server for that, I suggest a VPS if you want to use this in production, but you can also maybe find a free service such as glitch):

  • Ensure node is installed and run npm i, this will install the necessary dependencies (including my custom build of noblox.js)
  • Check the .env file and change it to your liking. You must have your cookie correctly set (you can find out how to do this here, scroll to authentication, I recommend using a bot account that has access to edit games in a group)
  • Ensure the SERVERAUTH environment variable matches the value on the actual server (more on that later)
  • Run it with node index.js (note: make sure your firewall allows incoming requests from the port you set!)

Alongside this github repository I made an uncopylocked place which you can find here. Here’s what you need to know/change:

  • This only handles creating new developer products that are of a set price. The product id is saved with the price and that creates a lookup table that allows us to retrieve products based on the price. This is used specifically for donating. You could modify it to save a name/product id combination instead if you want to save multiple products of the same price.
  • SeverStorage>baseRequestUrl is important. Change this to the base url with no trailing slash. Make sure to include http:// or https:// at the start (ex value: http://example.com. If you have a port along side this without dns, you add that here as well, for example: http://example.com:8592)
  • ReplicatedStorage>GetProduct is the function the ServerScriptService>GetProductHandler is bound to. Invoke this remote function where ever you need to get a new donation product. The only parameter is the price.
  • Inside of ServerScriptService>GetProductHandler there are a few things you will need to customize:
    • auth This should be the same value as the enviornment variable SERVERAUTH in the web server.
    • minPrice and maxPrice. Self explanatory. However, if maxPrice is less than or equal to minPrice, no maximum price will be applied.
    • requestInterval this defines how many seconds must pass before sending another request. It’s rate limiting.

However, that’s basically all you need to know. Here’s a video of it working (sorry about the messy compression):

10 Likes

Very cool system! Having something like this can definitely make it easier for players to contribute to their favorite game. Does this track players who made the developer product/purchase?

This system does not handle the actual processing of the developer product, no. That system should be built separately. This only makes developer products on the fly.

1 Like

This is so a user can donate any amount and there doesn’t have to be preset amounts. Making it all by hand is possible, but then they can only donate those specific amounts which isn’t the best for user experience. In general, users want to do as much as possible with as little as possible clicks. Wasting as little money as possible.

Furthermore, you can use a system like this to make a digital currency that is pegged to robux that a user can trade in any number of robux for a specific amount of the currency in return, you could have preset amounts but then users are forced to over buy or under buy, which is fine for the dev but not all users appreciate that kind of system. All without lifting your finger.

This is just one of the many possibilities auto generated dev products could have.

1 Like

Doesn’t work for Glitch. It said “Check /app/package.json: command not found. Is a start script missing?”

I actually didn’t get the notification for this message, you can add the start script to the package.json: "start": "node index.js". If you add this it should work, though I can’t be certain as I’ve never used glitch before, I just mentioned it in the post as an alternative to paid services.