Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why isn't the purchase being prompted? [closed]

Asked by
OniiCh_n 410 Moderation Voter
10 years ago

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.

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?

1 answer

Log in to vote
1
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

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.

0
Hmmm... lol. I should probably double check that. OniiCh_n 410 — 10y
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?) OniiCh_n 410 — 10y
Ad