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

Why don't ProductPurchase give me money from the sales?

I tried following the wiki and example place but there still must be something wrong, because when someone buys the developer product in-game, I don't ever receive payment.

This script is in the Workspace:

MarketplaceService = Game:GetService("MarketplaceService")  


local ID = 19690897   
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")  

    MarketplaceService.ProcessReceipt = function(receiptInfo)   
        local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId  
        if PurchaseHistory:GetAsync(playerProductKey) then  
            return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it.  
        end  
        -- find the player based on the PlayerId in receiptInfo  
        for i, player in ipairs(game.Players:GetChildren()) do  
            if player.userId == receiptInfo.PlayerId then  
                -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)  
                if receiptInfo.ProductId == ID then  
                    -- handle purchase. In this case we are healing the player.  
                    player.leaderstats.Points.Value = player.leaderstats.Points.Value + 25000  
                end  
            end   
        end  
        -- record the transaction in a Data Store  
        PurchaseHistory:SetAsync(playerProductKey, true)      
        -- tell ROBLOX that we have successfully handled the transaction (required)  
        return Enum.ProductPurchaseDecision.PurchaseGranted       
    end

And this is used to prompt the purchase after pressing a gui button: MarketplaceService:PromptProductPurchase(player, 19690897)

1 answer

First. ProductPurchase takes 1-24 Hours to load on your account with the money that they bought. Second. 19690897 is a Person's place.

8 comments

0

First, like I specified I have never received the payment....ever... That was 2 days ago by the way. Second, It's not someone's place I copied the ID directly: http://gyazo.com/279b259a766ec661718b81849e71eb96

0

Did you look at my screenshot? It's the exact same ID. Also I forgot to mention that you gain the points from buying it ingame. The only problem is I don't get payment.

0

ProductIds are not the same as AssetIds. A ProductId can be the same as an AssetId.

0

OH ASSET, well in that case thats easy. You don't need scripts just a plugin! Get it off the roblox blog. It should be around where the winter games are about to start section

0

Okay who gave us both -1...

0

I just joined this website because nobody was helping on the forum so I don't know what that means.... So no idea why I'm not getting the payment?

0

Phhh, I came off the scripting forums they never help. So I went to lualearners they closed then I came here...

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