Using processReceipt twice

I am having an issue where this code does not check if the dev product is purchased twice, it just does it again after the first purchase, regardless if the user purchased it or not.
EDIT: I am aware that you are not able to use it twice, but could someone how me how I could?

local ProductId = 1505612025
local number = game.ReplicatedStorage.Number
local val = game.ReplicatedStorage.Val


local function processReceipt(receiptInfo)
	local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet

	elseif player then
		if receiptInfo.ProductId == ProductId then
			local function fire(player, num)
				val:Fire(player, num)
				print("fired")
			end
			number.OnServerEvent:Connect(fire)
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end


mkps.ProcessReceipt = processReceipt