I'm trying to make a developer product to sell things in game, and I found out that you have to use ProcessReciept to find out if the purchase went through. I look at the ROBLOX Wiki page, and the example is too complicated for a guy just trying to learn how to use it to figure out. Is there a simpler example?
This is the script I use for processing receipts for the player. It uses a DataSore
to store the amount they've bought. It will continue to give them that item unless you script a lock so they don't continue to repurchase something they have forever.
local MarketplaceService = Game:GetService("MarketplaceService") local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory") --Data Stored into "PurchaseHistory" MarketplaceService.ProcessReceipt = function(receiptInfo) print("Test Receipt Loaded") local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_product_" .. receiptInfo.ProductId --example "player_3774904_product_19918045" local numberBought = ds:IncrementAsync(playerProductKey, 1) --Increases their current amount. for i,v in pairs (game.Players:GetChildren()) do if v.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == 19918045 then --Dev Product ID would go here and verifies if they bought it. print("User Bought a Dev Product.") --Your code would replace this. end end end return Enum.ProductPurchaseDecision.PurchaseGranted end