Couldn't find donation amount for product ID

  1. What do you want to achieve?
    A working product.

  2. What is the issue?

  3. What solutions have you tried so far?
    Couldn’t find any post about this error.

This is the code in local script:

local MPS = game:GetService("MarketplaceService")

local plr = game:GetService("Players").LocalPlayer

local productId = 1737502343

script.Parent.MouseButton1Click:Connect(function()

	local function promptPurchase()
		MPS:PromptProductPurchase(plr, productId)
	end
	
	promptPurchase()

end)

This is the code in script found in server script service:

local SSS = game:GetService("ServerScriptService")
local dataManager = require(SSS:WaitForChild("Modules"):WaitForChild("DataManager"))

local MPS = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productFunctions = {}

--HERE 
productFunctions[1737502343] = function(receipt, player)
	local profile = dataManager.Profiles[player]
	if not profile then return end
	
	local fortune = player:WaitForChild("leaderstats").Fortune
	
	profile.Data.Fortune += 100
	fortune.Value = profile.Data.Fortune

    return true
end
--HERE

-- Product ID 456456 awards 100 gold to the user
productFunctions[456456] = function(receipt, player)
	local leaderstats = player:FindFirstChild("leaderstats")
	local gold = leaderstats and leaderstats:FindFirstChild("Gold")

	if gold then
		gold.Value += 100
		return true
	end
end

local function processReceipt(receiptInfo)
	local userId = receiptInfo.PlayerId
	local productId = receiptInfo.ProductId

	local player = Players:GetPlayerByUserId(userId)
	if player then
		-- Get the handler function associated with the developer product ID and attempt to run it
		local handler = productFunctions[productId]
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			-- The user has received their benefits
			-- Return "PurchaseGranted" to confirm the transaction
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			warn("Failed to process receipt:", receiptInfo, result)
		end
	end

	-- The user's benefits couldn't be awarded
	-- Return "NotProcessedYet" to try again next time the user joins
	return Enum.ProductPurchaseDecision.NotProcessedYet
end

-- Set the callback; this can only be done once by one server-side script
MPS.ProcessReceipt = processReceipt

I am completely new to making products or gamepasses and i have been following this to try and learn it:

2 Likes

You forgot to return true in your function.

Code:

productFunctions[1737502343] = function(receipt, player)
	local profile = dataManager.Profiles[player]
	if not profile then return end
	
	profile.Data.Fortune += 100

	local fortune = player:WaitForChild("leaderstats").Fortune
	fortune.Value = profile.Data.Fortune

	return true
end
2 Likes

Hi, it still gives me the error even with the return true. Is there anything else that might be missing?

Where’s the code where that warning happens?

image
This is in the Core script

I need more than that. Like for example, what is DONATION_OPTIONS?

1 Like

image
I think i see the problem now lol
I didnt add the product in the table

Thanks for the help, should have looked through the core script before hand

Okay so it turns out the true problem was me using a receipt function in another script (a donation board). Now i realize that you can only have one receipt function in one script.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.