Urgent purchase bug!

Hi,
I’v gotten a few reports on malfunction in purchasing dev products. The issue seem to stretch across all my dev products and is not specific to any new dev products of mine.

HERES THE ISSUE:
People press Ok to purchase 1 set of MP5. Instead they get charged MULTIPLE TIMES (sometimes even 6!) although they’ve only agreed to buy it once!

I attached an image of one documented report. He clicked ‘OK’ ONCE and got charged for 3.
I dont see how this can have anything to do with my game since it’s not my purchase GUI that pops up when you want to buy dev products.

How are you handling the receipt on the server?

[code]MarketplaceService.ProcessReceipt = function(receipt)

local player = nil;

local c = game.Players:getPlayers()
for i = 1,#c do
	if (c[i].userId == receipt.PlayerId) then
		player = c[i]
		break;
	end
end

print("----Processing Order----")	
print(receipt.PlayerId)
print(player)
print(receipt.PlaceIdWherePurchased)
print(receipt.PurchaseId)
print(receipt.CurrencyType)
print(receipt.CurrencySpent)


if (player) then
	local type = receipt.ProductId;		
	if (type == cash1k) then
		print("Buying 1,000$")
		local result = buyCash(player,1000);
		if (result) then
			print("Success")
			return Enum.ProductPurchaseDecision.PurchaseGranted		
		end
	elseif (type == cash5k) then
		print("Buying 5,000$")
		local result = buyCash(player,5000);
		if (result) then
			print("Success")
			return Enum.ProductPurchaseDecision.PurchaseGranted		
		end
	elseif (type == cash14k) then
		print("Buying 14,000$")
		local result = buyCash(player,14000);
		if (result) then
			print("Success")
			return Enum.ProductPurchaseDecision.PurchaseGranted		
		end
	elseif (type == doubleexp) then
		print("Buying Double Exp")
		local result = buyDoubleExp(player)
		if (result) then
			print("Success")
			return Enum.ProductPurchaseDecision.PurchaseGranted		
		end
	elseif (type == placework) then
		local realitem = game.SStorage.Shop.Hidden["PlaceWork"]:clone()
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,realitem)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				--giveTicket(player,"PRE-RELEASE Rambo Knife")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleaseknife) then
		local item = game.SStorage.Shop.Secondary["Rambo Knife"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				giveTicket(player,"PRE-RELEASE Rambo Knife")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleaseak) then
		local item = game.SStorage.Shop.Primary["AK47"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				giveTicket(player,"PRE-RELEASE AK47")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleaseflamethrower) then
		local item = game.SStorage.Shop.Primary["Flamethrower"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				giveTicket(player,"PRE-RELEASE Flamethrower")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleasechainsaw) then
		local item = game.SStorage.Shop.Secondary["Chainsaw"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				giveTicket(player,"PRE-RELEASE Chainsaw")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == icesledge) then
		local item = game.SStorage.Shop.Secondary["IceSledge"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				--giveTicket(player,"Purchased Icesledge")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleaserpg) then
		local item = game.SStorage.Shop.Secondary["RPG-7"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				--giveTicket(player,"Purchased Icesledge")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
	elseif (type == prereleasemp5) then
		local item = game.SStorage.Shop.Secondary["MP5"]:clone()
		local realitem = item:FindFirstChild(item.Name)
		local model = game.SStorage.Players:FindFirstChild(player.Name)
		if (realitem and model and model:FindFirstChild("Inventory")) then
			local result = _G.BuyItem(player,item)
			if (result) then
				print("Success")
				realitem:clone().Parent = model.Inventory
				--giveTicket(player,"Purchased Icesledge")
				return Enum.ProductPurchaseDecision.PurchaseGranted	
			end
		end
		
	elseif (type == SUPPORTERSPASSID) then
		local duck = Instance.new("BoolValue")
		duck.Name = "Duck"
		duck.Value = true
		duck.Parent = player;
		return Enum.ProductPurchaseDecision.PurchaseGranted	
	end
end
print("FAILED")
print("------------------------")
wait(2)
return Enum.ProductPurchaseDecision.NotProcessedYet

end [/code]

Thats part I can post the whole if u need that instead.
Luckily, this problem seem only to have affected 10 people. I will go through the rest of the purchases but it seems to have been a glitch that occurred in the last hour or so and I’v managed to deactivate the game for now.
Think it must have been a laggy server or something that caused it.

Try just having one Enum.ProductPurchaseDecision.PurchaseGranted at the end of the function instead of doing it for each individual condition.

Then failed purchases will be forgotten. If I do like this then if a purchase fails, it will try again later.
Also, what should be noted, is that I’v been doing this purchasing for over half a year. It has never double or triple charged the users.

Can confirm. This exact issue is happening in Apocalypse Rising as well.

Cannot confirm such behaviour in Minigame Madness at this moment in time.

I got one report of this happening as well earlier today.

He told me the Purchase Gui told him “Roblox is under maintenance” but it charged him anyway.

I got a report similar to this today.

Can’t confirm, is this for purchasing or just receiving the items?

Also can’t confirm. I had the issue with ‘Roblox is under maintenance’ before, but I didn’t hear anything about multiple products that were bought by a user. (Or multiple charging.)

We found the source of the issue and made it stop happening last night. We’re currently discussing how to proceed for the users and devs affected.