Developer Products

A Developer Product is an item or ability that a user can purchase more than once, such as in-experience currency, ammo, or potions.

Creating Developer Products

When you're creating an image to use for your Developer Product, consider the following requirements:

  • Use a template of 512×512 pixels.
  • Save the image in either .jpg, .png, or .bmp format.
  • Don't include important details outside of the circular boundaries because the upload process trims and crops the final Developer Product into a circular image.

To create a new Developer Product:

  1. Navigate to the Creator Dashboard.

  2. Click on the experience you want to create a Developer Product for. The experience's Overview page displays.

  3. In the left-hand navigation, select Associated Items. The Associated Items page displays.

  4. In the horizontal navigation, select DEVELOPER PRODUCTS. All Developer Products for that experience display.

  5. Click the CREATE A DEVELOPER PRODUCT button. The Create a Developer Product page displays.

  6. Click the UPLOAD IMAGE button. A file browser displays.

  7. Select the image you want to display as the icon, then click the Open button.

  8. Fill in the following fields:

    • Name: A title for your Developer Product.
    • Description: A description what a user should expect when they purchase the Developer Product.
    • Price in Robux: The amount of Robux you want to charge users for the Developer Product.
  9. Click the CREATE DEVELOPER PRODUCT button. The Developer Product displays within the Developer Products section of the Associated Items page.

Locating Developer Product IDs

A Developer Product ID is the unique identifier of a Developer Product. You need this ID when you are scripting Badges.

To locate a Developer Product ID:

  1. Navigate to the Developer Product section of an experience's Associated Items page.

  2. Hover over a Developer Product thumbnail and click the button. A contextual menu displays.

  3. Select Copy Asset ID. The Developer Product ID copies to your clipboard.

Scripting Developer Products

You must use scripting to implement Developer Product effects in your experiences.

Common Developer Product scripting use cases include:

Prompting Purchases

You can prompt a user to purchase one of your developer products with the PromptProductPurchase() method of MarketplaceService. Depending on the needs of your experience, you can call the promptPurchase() function in situations such as when the user presses a button or when their character talks to a vendor NPC.


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local productId = 0000000 -- Change this to your developer product ID
-- Function to prompt purchase of the developer product
local function promptPurchase()
MarketplaceService:PromptProductPurchase(player, productId)
end

Handling Purchases

After a user purchases a developer product, it's your responsibility to handle and record the transaction. You can do this through a Script within ServerScriptService using the MarketplaceService.ProcessReceipt callback.


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local productFunctions = {}
-- ProductId 123123 brings the user back to full health
productFunctions[123123] = function(receipt, player)
if player.Character and player.Character:FindFirstChild("Humanoid") then
player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth
-- Indicate a successful purchase
return true
end
end
-- ProductId 456456 awards 100 gold to the user
productFunctions[456456] = function(receipt, player)
local stats = player:FindFirstChild("leaderstats")
local gold = stats and stats:FindFirstChild("Gold")
if gold then
gold.Value += 100
return true
end
end
local function processReceipt(receiptInfo)
local userId = receiptInfo.PlayerId
local productId = receiptInfo.ProductId
local player = Players:GetPlayerByUserId(userId)
if player then
-- Get the handler function associated with the developer product ID and attempt to run it
local handler = productFunctions[productId]
local success, result = pcall(handler, receiptInfo, player)
if success then
-- The user has received their benefits!
-- return PurchaseGranted to confirm the transaction.
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Failed to process receipt:", receiptInfo, result)
end
end
-- the user's benefits couldn't be awarded.
-- return NotProcessedYet to try again next time the user joins.
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- Set the callback; this can only be done once by one script on the server!
MarketplaceService.ProcessReceipt = processReceipt

Getting Information

To get information about a specific Developer Product, such as its price, name, or image, use the MarketplaceService:GetProductInfo() function with a second argument of InfoType.Product. For example:


local MarketplaceService = game:GetService("MarketplaceService")
local productId = 000000 -- Change this to your developer product ID
local productInfo = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
local success, productInfo = pcall(function()
return MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
end)
if success then
-- Use productInfo here!
end

You can also get the data for all of the developer products in an experience by using the GetDeveloperProductsAsync() method. This returns a Pages object that you can inspect and filter to build things like an in-experience store or product list GUI.

For example, the following script prints the name, price, ID, description, and AssetID for all Developer Products in an experience:


local MarketplaceService = game:GetService("MarketplaceService")
local success, developerProducts = pcall(function()
return MarketplaceService:GetDeveloperProductsAsync():GetCurrentPage()
end)
if developerProducts then
for _, developerProduct in pairs(developerProducts) do
for field, value in pairs(developerProduct) do
print(field .. ": " .. value)
end
print(" ")
end
end