Failed product purchase - HTTP 500 (InternalServerError)

I have a perfectly working purchasing system for in-game items, but occasionally I get this error in the log:
Error fetching MarketplaceService receipts: HTTP 500 (InternalServerError)

I find the robux were deducted from player’s account (also it shows in the developer exchange page) while he did not get the product. The same player was able to make other purchases before and after this one.

My script is not throwing any error. Is there a way to catch the HTTP 500 error, or any ideas how to prevent it?

3 Likes

Have you used pcalls? It’s used for error catching:

local success, err = pcall(function()
    local bar = 2 + "string"
end)

if success then
    -- if the operation was successful
else
    -- if it failed
end

It is not an error of my script that could be caught with pcall, I think. Where in the product handler can I place the pcall?

local market = game:GetService("MarketplaceService")
market.ProcessReceipt = function(purchaseInfo) 	
	local player = game.Players:GetPlayerByUserId(purchaseInfo.PlayerId)
    -- give item to player
	return Enum.ProductPurchaseDecision.PurchaseGranted
end
1 Like

I’ve read this post carefully and implemented the changes to the game I work. But look, I don’t stop getting these:


I’m confused to know what those mean and if it is my fail. Also, the users who get this, always get in my experience and not in others, even after rejoining - while other users can buy products normally.

How are you handling the method in your script? Looking back at this, I don’t know if you can error catch MarketplaceService.ProcessReceipt (unless anyone can reply to this thread and correct me)