Developer Products – In‑Game Purchases
Developer Products – In‑Game Purchases
Developer products are items which players can buy more than once, making them perfect for in-game currency, ammo, or similar purchases.
Articles/Game Passes One Time Purchases|Game Passes.
Creating a Developer Product
To create a new developer product:
- In Roblox Studio, click on the Game Settings button from the Home tab.
- Select the Monetization tab.
- Next to Developer Products, click the Create button.
- For the new placeholder product, click the
button and select Edit.
- Specify the product’s name and the price.
- Click the Save button.
After creating a developer product, Roblox assigns it a unique ID and all products are neatly listed in the Monetization tab.
Scripting for Developer Products
To take full advantage of developer products, you’ll need to use scripting. Here are some common examples:
Getting a Game’s Developer Products
To gather data for all of the developer products in a game, use the MarketplaceService/GetDeveloperProductsAsync|GetDeveloperProductsAsync() method. This returns a Pages object that you can inspect and filter to build an in-game store, product list GUI, etc.
Getting Product Info
To get information (price, name, image, etc.) for a specific product, use the MarketplaceService/GetProductInfo|GetProductInfo() function with a second argument:
Prompting a Purchase
You can prompt a player to purchase one of your developer products with the MarketplaceService/PromptProductPurchase|PromptProductPurchase() method of MarketplaceService. In the following code, the promptPurchase() function can be called when the player presses a Articles/Creating GUI Buttons|button, talks to a vendor NPC, or whatever fits your game design.
After a purchase is made, it’s your responsibility to handle and record the transaction. This can be done through a Script within ServerScriptService using the MarketplaceService/ProcessReceipt|ProcessReceipt callback. The function you define will be called repetitively until it returns Enum.ProductPurchaseDecision.PurchaseGranted.
articles/Developer Stats|here. If you want to track player-specific purchase history, it's your responsibility to store the data, typically with Articles/Data store|data stores. See the MarketplaceService/ProcessReceipt|ProcessReceipt reference for a code example which includes data store usage.
receiptInfo table passed to the processReceipt() callback function contains detailed info on the purchase. See the MarketplaceService/ProcessReceipt|ProcessReceipt reference for a list of keys and descriptions.