Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't the purchase being prompted?

Upon all attempts to call PromptProductPurchase(), it gives me:

could not get product info because MarketplaceService:getProductInfo() failed because rawProductInfo was empty

What is causing this? Here is my client-side code. I'm not sure if server-side is involved, but it's there as well

Client-side

local player = game.Players.LocalPlayer
local productId = 176578601
local Market = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:connect(function()
	Market:PromptProductPurchase(player, productId)
end)

Server-side

local marketplaceService = game:GetService("MarketplaceService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:WaitForChild("RemoteEvent")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productIds = {176578601, 123456}

game.Players.PlayerAdded:connect(function()
	print("start")
local DeveloperProducts = marketplaceService:GetDeveloperProductsAsync():GetCurrentPage()
for _, DevProductContainer in pairs(DeveloperProducts) do
    for Field, Value in pairs(DevProductContainer) do
        print(Field .. ": " .. Value)
    end
    print(" ")
end
print("end")
end)


marketplaceService.ProcessReceipt = function(receiptInfo)
	for i, player in pairs(game.Players:GetPlayers()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == productIds[1] then --Donation
				event:FireAllClients("Donation", player.Name)
				local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_testDonation_" .. receiptInfo.PurchaseId
				ds:IncrementAsync(playerProductKey, 1)
			else
				print("nothing yet")
			end
		end
	end
	
	return Enum.ProductPurchaseDecision.PurchaseGranted	
end

The client-side code is in a LocalScript, which is inside an ImageButton. The ImageButton is in a Frame, which is in a ScreenGui.

The server-side code is in a Script, which is in ServerScriptStorage.

1 answer

✓ Accepted answer

It looks like there is no developer product with ID of 176578601

Where did you get that ID from? I recommend going to your place configuration page, clicking on "Developer Products", and copying/pasting the ID from there.

2 comments

0

Hmmm... lol. I should probably double check that.

0

Yep, that was the problem. The real ID was 21410672... (Don't know where I got 176578601, might've been a sound or decal?)

This discussion is preserved as it was. New answers, comments, and votes are closed.