Help Needed with Verifying Bulk Purchase Ownership in Roblox

Hi All,

I am designing a security feature to verify a bulk purchase in Roblox. Since you can only use MarketplaceService.PromptBulkPurchaseFinished locally, I pass all the necessary data to the server using a remote event. On the server side, I attempt to verify that all purchased items are owned by the player using the following function:

function BulkPurchase.VerifyBulkPurchase(player, results)
	local items = {}
	for _, item in ipairs(results.Items) do
		if item.status == Enum.MarketplaceItemPurchaseStatus.Success then
			local success, ownsAssetOrError = pcall(function()
				--print(tonumber(item.id)) --item id is valid!
				return MarketplaceService:PlayerOwnsAsset(player, tonumber(item.id))
			end)
			if success then
				if ownsAssetOrError then
					table.insert(items, item)
					print(player.Name .. " owns asset ID: " .. item.id)
				else
					warn("Player does not own asset ID: " .. item.id .. " for player: " .. player.Name)
				end
			else
				warn("Error during verification for asset ID: " .. item.id)
				warn("Error message: " .. tostring(ownsAssetOrError))
			end
		else
			warn("Item purchase failed for asset ID: " .. item.id)
		end
	end
	return items -- return all items that were succesfully purchased
end

For easy of access I’ve linked the official documentation here: MarketplaceService.PromptBulkPurchaseFinished | Documentation - Roblox Creator Hub

The goal is for this function to return the items that were successfully purchased. However, my output is flooded with warnings, as shown in the image below:

What I don’t understand is how this is possible, especially considering that if I attempt to purchase the same item after a bulk purchase, the Roblox prompt confirms that I already own the item. This suggests that I do own the asset ID.

I suspect this issue might be related to testing in Studio, as I haven’t yet tested on a live server(I would prefer not to). But I’m unsure if this is the root cause. If anyone has encountered this issue or knows how to resolve it, I’d appreciate your input!

What solutions have you tried so far?
I’ve asked in popular Discord servers and searched online but couldn’t find a solution. I also tested this with an item in my inventory, and it worked fine. I’m confident this isn’t influenced by inventory privacy since I was able to use an item from my inventory.

If anyone has any suggestions or advice, please let me know!

Thank you in advance!

EDIT: (12/12/2024)
Heres what I tried:

  • tried in a live server and same warn errors appeared on console log
  • I tried waiting 5 mins after purchase to see if the warn would reappear, and it still warned.
  • I suspect that PlayerOwnsAsset() is session based, however I lack evidence to support this claim. I purchased an asset and it did not work, then I rejoined with the asset in my inventory and it did work.
1 Like