I know there are many DevForum articles on this but I would like to be able to know how ProccessRecipt works without a bunch of tests, I can add them on later. How could I implement this into my code?
-- CREATE VARS --
local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:FindFirstChildOfClass("RemoteEvent")
local marketplace = game:GetService("MarketplaceService")
local player = game:GetService("Players").LocalPlayer
local devItemID = 1655061162
local function promptPurchase()
marketplace:PromptProductPurchase(player, devItemID)
end
-- REMOTE EVENT --
button.MouseButton1Click:Connect(function()
print("Buying ".. button.Name)
promptPurchase()
end)
local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("NAME OF YOUR REMOTE EVENT")
local MarketPlaceService = game:GetService("MarketPlaceService")
local LocalPlayer = game.Players.LocalPlayer
local devItemID_N1 = 1655061162
button.MouseButton1Click:Connect(function()
print("Buying ".. button.Name)
MarketPlaceService :PromptProductPurchase(LocalPlayer, devItemID_N1 )
end)
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local REP = game:GetService("ReplicatedStorage")
local devItemID_N1 = 1655061162
local function processReceipt (receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
if receiptInfo.ProductId == devItemID_N1 then
--do cool things
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif receiptInfo.ProductId == OTHER PRODUCT ID IF YOU HAVE MORE then
--dont forget the line bellow
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
MarketPlaceService.ProcessReceipt = processReceipt
there is now an error that says that receipt info doesn’t exist, do I have to put the receipt info in when calling on the function like: processReceipt(put info here?)