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:
01 | MarketplaceService = Game:GetService( "MarketplaceService" ) |
05 | local PurchaseHistory = game:GetService( "DataStoreService" ):GetDataStore( "PurchaseHistory" ) |
07 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
08 | local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId |
09 | if PurchaseHistory:GetAsync(playerProductKey) then |
10 | return Enum.ProductPurchaseDecision.PurchaseGranted |
13 | for i, player in ipairs (game.Players:GetChildren()) do |
14 | if player.userId = = receiptInfo.PlayerId then |
16 | if receiptInfo.ProductId = = ID then |
18 | player.leaderstats.Points.Value = player.leaderstats.Points.Value + 25000 |
23 | PurchaseHistory:SetAsync(playerProductKey, true ) |
25 | return Enum.ProductPurchaseDecision.PurchaseGranted |
And this is used to prompt the purchase after pressing a gui button:
MarketplaceService:PromptProductPurchase(player, 19690897)