I have been trying to get MarketPlaceService.ProcessReceipt to fire without any success so far.
Once a purchase is completed, nothing, absolutely nothing happens. Code is below, can anyone tell me why it is not firing? There is only script that calls MarketplaceService.ProcessReceipt by the way and it is a Script
Code:
local mps = game.MarketplaceService
local Players = game.Players
mps.ProcessReceipt = function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receiptInfo.ProductId == 100309279 then
print("premium purchased")
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
While using a gamepass you don’t use the ProcessReceipt callback function because it has been made for dev-products (and subscriptions i think). You need to use PromptGamePassPurchaseFinished function to handle gamepass purchases.
Example:
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamePassId, wasPurchased)
if gamepassId == VipGamepassId then
local success = SomeVipBoughtFunction(player)
if not success then
warn("There was an error while buying vip by player of id: ", player.UserId) return
else
print("Player of id: ", player.UserId, " has successfully bought vip!")
end
end
end)