Developer Product Handling Help

The promt is working, but the local productData = DeveloperProductsConfig[receiptInfo.ProductId] is nil

Developer Product Promt:

for _, template in pairs(DeveloperProductsFrame:GetChildren()) do
	local button = template:FindFirstChildOfClass("TextButton")
	if button then
		local productUniqueID = button:GetAttribute("UniqueID")
		local DeveloperProductID = shopConfig[productUniqueID].DeveloperProductID
		
		if DeveloperProductID then
			button.MouseButton1Click:Connect(function()
				MarketplaceService:PromptProductPurchase(player, DeveloperProductID)
			end)
		end
	end
end

Server Handling:

local DeveloperProductsConfig = require(game.ReplicatedStorage:WaitForChild("Configs"):WaitForChild("DeveloperProductsConfig"))

MartketplaceService.ProcessReceipt = function(receiptInfo)
	local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	print(player)
	if not player then
		print("Not player")
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	local productData = DeveloperProductsConfig[receiptInfo.ProductId]
	
	if productData and receiptInfo.ProductId == productData.DeveloperProductID then
		local toAdd = productData.ToAdd
		DataManager.AddCoins(player, toAdd)
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	return Enum.ProductPurchaseDecision.NotProcessedYet
end

DeveloperProductsConfig:

local DeveloperProductsConfig = {
	[8915778] = {
		DeveloperProductID = 3368292409,
		ToAdd = 100
	}
}

return DeveloperProductsConfig

I dont believe you can get the player on the server like that. The only ways i know of are getplayerfromcharacter as well as using player as a parameter from a remote event. Like so:

event.OnServerEvent:Connect(function(plr)

It’s working now, I guess it was studio glitch. But I found the issue and product data = nil

local productData = DeveloperProductsConfig[receiptInfo.ProductId]
	print(productData)
	
	if productData and receiptInfo.ProductId == productData.DeveloperProductID then
		local toAdd = productData.ToAdd
		DataManager.AddCoins(player, toAdd)
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end

My mistake, receiptInfo does exist

Is developerproductsconfig a module script? Make sure youre requiring it correctly, or wlse it wont work.

local module = require(game.ServerScriptService.Module)

I’m requiring module correctly

If productData = nil that means

This is returning as nil. So you’d have to figure out why receiptInfo or ProductId are nil because that would make the variable print as nil.