ProcessReceipt doesn't work

Hello, everyone, so recently I was working on my event queue developer product.
In test it works perfectly, but in the game it doesn’t even detect that I am buying something.
.ProcessReceipt is used in server script and PromptProductPurchase was used in server script, also tried local, but same thing.
What can I do about it?

Can we see the full script so we know more?

Check if you don’t have two callbacks registered to.ProcessReceipt.
It can only have one per game.

You’re expected to handle it all using some library.

Btw, .ProcessReceipt only fires after the purchase was made.

local ProductID = 1191208196
local EventRate = 5*60

local MarketplaceService = game:GetService("MarketplaceService")

local Bought = {}
local EventsQueue = {}

local BuyRemote = game.ReplicatedStorage:WaitForChild("EventBuy")
local Remote = game.ReplicatedStorage:WaitForChild("EventMessage")

local Events = {}

local EventsTable = script:WaitForChild("Events"):GetChildren()

for i,v in pairs(EventsTable) do
	Events[i] = require(v)
end

BuyRemote.OnServerInvoke = function(plr,data0,data1)
	if data0 == 0 then
		return Events
	else
		if not Events[data1] then return end
		local i = table.find(Bought,plr)
		if not i then 
			MarketplaceService:PromptProductPurchase(plr)
			return "Purchase product before buying the event!" 
		end
		table.remove(Bought,i)
		table.insert(EventsQueue,data1)
		return "Your event was added to queue!", true
	end
end

MarketplaceService.ProcessReceipt = function(info)
	print("brought")
	if info.ProductId == ProductID then
		local player = game.Players:GetPlayerByUserId(info.PlayerId)
		if not player or table.find(Bought,player) then
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
		table.insert(Bought,player)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

while true do
	for i=1,EventRate do
		if EventsQueue[1] then break end
		wait(1)
	end
	local event
	if EventsQueue[1] then
		event = Events[EventsQueue[1]]
		table.remove(EventsQueue,1)
	else
		event = Events[math.random(1,#EventsTable)]
	end
	Remote:FireAllClients(true,event.Settings.Name,event.Settings.Color,event.Settings.Description,event.Settings.Duration)
	local Players = event.Start()
	for i,v in pairs(Players) do
		if not v:IsA("Player") then
			local plr = game.Players:GetPlayerFromCharacter(v)
			if plr then
				plr.HiddenStats.Buxs.Value += event.Settings.Reward
				Remote:FireClient(plr,false,event.Settings.Reward)
			end
		else
			v.HiddenStats.Buxs.Value += event.Settings.Reward
			Remote:FireClient(v,false,event.Settings.Reward)
		end
	end
end

I checked all scripts, and only mine is using it.

One thing to note, if you do a test purchase in Studio, that test purchase will not retry in-game. Other than that, I can’t tell why this would be the case.

I recommend always returning NotProcessedYet when testing these so you don’t lose robux.

Here is test:


Here is in the game:

Anyway, that’s strange that it works in studio, but not in the game.
We also tried team test, and it doesn’t work.

That’s weird, are you completely sure you don’t have other scripts defining ProcessReceipt? I see you have a lot of other products. You can use FindAll to see that.

I honestly don’t know what else to say to you, this is really weird.

See if the script reaches the line of defining ProcessReceipt at all with a print just to be sure.

(Dude there’s literally a warning in your console saying “Donation Board: ProcessReceipt Activated”)

1 Like

Sorry for not replying


Donation Board is a different thing.
And everything works, including loop under the .ProcessReceipt

Wait, I just found out that this warning doesn’t appear when it comes to studio, I guess you are right

I think you forgot to publish your game lol.

No, it’s published, I guess Donation Board is the thing that kills my script. Let me check it.


Here comes the imposter!
This module loads .ProcessReceipt only if it’s game, not studio.
I gotta change it a little, but still thanks.

1 Like

You’re only allowed one ProcessReceipt callback per experience. Make sure it handles all developer product purchases & gamepass purchases of that game.