How to sell game passes in Roblox, and where ProcessReceipt fits
Short answer
Game passes do not go through ProcessReceipt. A pass is bought once and Roblox remembers the owner: check UserOwnsGamePassAsync when the player joins and listen to PromptGamePassPurchaseFinished for passes bought during play. ProcessReceipt is for developer products, which can be bought repeatedly: grant the item and record the PurchaseId in one DataStore write, then return PurchaseGranted.
- In Creator Hub, open your experience > Monetization. Create your Passes and Developer Products and copy each id.
- In ServerScriptService, add a Script, paste the first block and replace the example ids in PASSES and PRODUCTS.
- In StarterGui, build a Frame of TextButtons. Give each button the attributes Kind ("Pass" or "Product") and Id.
- Put a LocalScript inside the Frame and paste the second block.
- Press Play and buy something: purchases made in Studio are test purchases and cost nothing.
Copy-paste code
ServerScriptService/Store (Script)
local DataStoreService = game:GetService("DataStoreService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local wallet = DataStoreService:GetDataStore("Wallet_v1") -- { coins = number, receipts = { [purchaseId] = time } }
-- GAME PASSES: bought once, owned for good. Roblox remembers the owner, so you only check and apply the perk.
local PASSES = {
[1111111] = function(player) -- replace with your pass ids
player:SetAttribute("VIP", true)
end,
[2222222] = function(player)
player:SetAttribute("DoubleCoins", true)
end,
}
-- DEVELOPER PRODUCTS: can be bought again and again. Roblox does not remember them; ProcessReceipt must.
local PRODUCTS = {
[3333333] = { coins = 500 }, -- replace with your product ids
[4444444] = { coins = 3000 },
}
local function showCoins(player, coins)
local stats = player:FindFirstChild("leaderstats")
if stats then
stats.Coins.Value = coins
end
end
local function onJoin(player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = stats
stats.Parent = player
local ok, data = pcall(wallet.GetAsync, wallet, "u_" .. player.UserId)
if ok and data then
showCoins(player, data.coins)
end
for passId, applyPerk in PASSES do
local owned, result = pcall(MarketplaceService.UserOwnsGamePassAsync, MarketplaceService, player.UserId, passId)
if owned and result then
applyPerk(player)
end
end
end
Players.PlayerAdded:Connect(onJoin)
for _, player in Players:GetPlayers() do
task.spawn(onJoin, player)
end
-- A pass bought during play: apply it now, so the player does not have to rejoin.
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and PASSES[passId] then
PASSES[passId](player)
end
end)
-- Developer products end here, and only here.
MarketplaceService.ProcessReceipt = function(receipt)
local reward = PRODUCTS[receipt.ProductId]
if not reward then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- The coins and the purchase id are written together, so there is never one without the other.
local ok, saved = pcall(function()
return wallet:UpdateAsync("u_" .. receipt.PlayerId, function(data)
data = data or { coins = 0, receipts = {} }
if data.receipts[receipt.PurchaseId] then
return nil -- this purchase was granted on an earlier call: change nothing
end
data.coins += reward.coins
data.receipts[receipt.PurchaseId] = os.time()
return data
end)
end)
if not ok then
warn("Purchase not saved, Roblox will send it again:", saved)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local player = Players:GetPlayerByUserId(receipt.PlayerId)
if player and saved then
showCoins(player, saved.coins)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
endStarterGui/ScreenGui/Frame/LocalScript
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local frame = script.Parent -- a Frame of TextButtons; each has the attributes Kind ("Pass" or "Product") and Id (number)
for _, button in frame:GetChildren() do
if button:IsA("TextButton") then
local id = button:GetAttribute("Id")
local kind = button:GetAttribute("Kind")
local infoType = if kind == "Pass" then Enum.InfoType.GamePass else Enum.InfoType.Product
-- show the live name and price, so the button is never out of date
task.spawn(function()
local ok, info = pcall(MarketplaceService.GetProductInfo, MarketplaceService, id, infoType)
if ok and info.PriceInRobux then
button.Text = info.Name .. " - " .. info.PriceInRobux .. " Robux"
end
end)
button.Activated:Connect(function()
if kind == "Pass" then
MarketplaceService:PromptGamePassPurchase(player, id)
else
MarketplaceService:PromptProductPurchase(player, id)
end
end)
end
end| Game pass | Developer product | |
|---|---|---|
| Bought | Once per player | As often as the player likes |
| Good for | VIP, double coins, a permanent tool | Coins, gems, boosts, revives |
| Who remembers it | Roblox | Your game, through ProcessReceipt |
| Server code | UserOwnsGamePassAsync + PromptGamePassPurchaseFinished | MarketplaceService.ProcessReceipt |
| Prompt from the client | PromptGamePassPurchase | PromptProductPurchase |
Source: Roblox Creator Hub documentation: Passes, Developer Products and MarketplaceService (read 15 Nov 2026)
Why passes need two checks
UserOwnsGamePassAsync answers "does this player own the pass?" when they join. Its answer is cached, so right after a purchase it can still say no. That is why the script also listens to PromptGamePassPurchaseFinished and applies the perk at once when wasPurchased is true.
The perk itself is just an attribute on the player here. Wherever your game awards coins or opens a VIP door, read that attribute on the server.
What ProcessReceipt has to guarantee
Roblox calls ProcessReceipt after a developer product is paid for, and keeps calling it, including the next time the player joins, until you return PurchaseGranted. So the same purchase can arrive more than once, and your code has to grant it exactly once.
The script does that by writing the coins and the PurchaseId in a single UpdateAsync. If the id is already stored, the write is cancelled and nothing is added. If the DataStore call fails, the function returns NotProcessedYet and Roblox sends the receipt again later. There is no moment where the coins are saved without the receipt, or the receipt without the coins.
One writer per key
In this tutorial the Wallet store is the only place coins are saved. In a real game your coins are probably part of a larger saved profile that is held in memory during play. Then the purchase must go into that same profile, and PurchaseGranted should be returned only after the profile has been saved; otherwise an autosave from memory can overwrite the coins the receipt just added.
Only ProcessReceipt grants products
There is a client event that fires when the product prompt closes, and it is tempting to grant coins there. Do not: it also fires for purchases that have not completed, and Roblox's own documentation says to use ProcessReceipt. Use the prompt events only to close your shop window.
Good to know
A game can have only one ProcessReceipt function. If two scripts set it, the second replaces the first and some products silently stop being granted. Keep every product in one table, as here.
Returning NotProcessedYet for a product id you do not recognise is correct: a newer server version of your game may know it.
The receipts table grows with each purchase. In a long-running game, keep the most recent few dozen ids per player and drop older ones.
Roblox is a trademark of Roblox Corporation. CyberMax is not affiliated with or endorsed by Roblox.
Start with the free sampler
Before you buy anything, take the free Stallwren sampler: two real modules from the kit (Format, for short numbers and countdowns on shop labels, and Signal) with the .rbxmx to drag into Studio. If it fits how you work, the full kit is below.
Stallwren Shop & Currency System: A shop and currencies that never lose a purchase
from $8Stallwren is a tested shop and currency system: a multi-currency wallet, a validated catalogue with sales and limited-time items, purchases charged once, developer product receipts granted exactly once, game passes and a shop UI.
Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)Works well with
Questions
Can I sell a game pass with ProcessReceipt?
No. ProcessReceipt only receives developer product purchases. A game pass is handled with UserOwnsGamePassAsync and PromptGamePassPurchaseFinished, as in this script.
How much of the price do I keep?
Roblox keeps a marketplace fee on passes and developer products and you receive the rest in Robux. Check the current rate in the Creator Hub documentation before you set prices.
How do I test without spending Robux?
Buy inside Studio. Test purchases complete normally, ProcessReceipt runs, and no Robux is charged.
Should a pass or a product give more coins?
Use a product for anything that is used up, such as coins. Use a pass for a permanent effect, such as doubling the coins a player earns.
Free: the Roblox Starter Kit
7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.