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.
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.
Locked by OniiCh_n, Spongocardo, and Perci1
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?