What's the best way to check if a player owns a bundle using web a api?

There’s a way to check if a player own’s an asset but how would I do the same for a bundle using a web api?

Only way I could think of is by checking if the player owns the bundle torso but if torso doesn’t exist then I’m guessing I check if the player own’s one of the bundle accessories?

but is there a better way to check or something?

I don’t think there is an API endpoint that allows you to check to see if someone has a bundle but you could use one of these API endpoints to get the bundles they have and then just loop through all the bundles the user has to see if they have the bundle that your looking for.

I think this will be ur best option to do with the Roblox web API endpoints go.

Link: https://catalog.roblox.com/docs#!/Bundle/get_v1_users_userId_bundles

Only problem doing it that way is inventory privacy
You are not authorized to view this users' inventory.

So my way of checking works better for now.

Well there is no real way to get pass the issue of the user inventory being private.

Would that not be the same issue with a player torso? If the inventory is private I would expect everything to be private.

No, my way of checking torso has no problem with privacy as I even tried right now using my guest browser since it’s not logged in and it returned me that my main does own a torso of the torso id I gave it
image

1 Like

If a players inventory is set to private, the only way to obtain inventory information data would be from outdated information, such as that provided by the wayback machine. Otherwise, if you check using a web API (btw using PlayerOwnsBundle() is much better) then it will return an error. To account for that error, you should use a pcall, so that instead of returning an error, it will return false instead, which could transport them do a different server or kick them.

-- Client Side Example
local MarketplaceService=game:GetService('MarketplaceService')
local players=game:GetService('Players')

local player=players.LocalPlayer;
local bundleId=201 -- Headless Horseman Bundle Id

local success,owned=pcall(MarketplaceService.PlayerOwnsBundle,MarketplaceService,player,bundleId)

if success then
	if owned then
		print('Bundle owned.');
	else
		print('Bundle not owned.');
	end
else
	print('PlayerOwnsBundle Failed.');
end

and also I’ve figured out a way ages ago since of an API that used to not exist when this was posted.
https://inventory.roblox.com/v1/users/${userId}/items/${itemType}/${itemTargetId}/is-owned

and should work like this example:
https://inventory.roblox.com/v1/users/197825358/items/3/201/is-owned

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.