How do I PromptPurchase Bundles?

Hi,
In my game I want to prompt users to buy Bundles however, ROBLOX made a “new ID system” (I don’t know how to describe it) for the Bundles.

Normal:
image

“New”:
image

How do I prompt players to buy Bundles (in game) using the PromptPurchase function or using any other functions? I tried using the ID from an Anthro package to prompt purchase but it doesn’t work.

4 Likes

I don’t think any of the purchase APIs support bundles right now, they only work with the old AssetType. You have two options here; either you can fetch the catalog Id of the bundle or you can file a feature request to allow for bundles to be purchased.

I actually had a post about this a while ago but figured it out. What you have to do is get an asset from the bundle using AssetService:GetBundleDetailsAsync(bundleId), get the first asset from the Items part of the dictionary, then find the digits in the description to get the old bundle assetId, then PromptPurchase those digits, and it should give you something like this:image

edit: see How do I PromptPurchase Bundles? for code

1 Like

Which member of the dictionary are you supposed to use? The fact that GetBundleDetailsAsync still has no documentation is really a crowbar in this.

Here’s the exact code that I used, I forgot that I must get the old link from the description of the asset like this:

local bundleId = 39

local AssetService = game:GetService('AssetService')
local MarketplaceService = game:GetService('MarketplaceService')

local BundleItems = AssetService:GetBundleDetailsAsync(bundleId).Items

local FirstBundleInfo = MarketplaceService:GetProductInfo(BundleItems[1].Id)

local OldBundleId = string.match(FirstBundleInfo.Description, "%d+")

MarketplaceService:PromptPurchase(game.Players.LocalPlayer, OldBundleId)

Took me a few hours to figure it out, so hope you enjoy!
image

20 Likes

That somehow feels very terrifying to use, but I suppose it does work. Nice stuff.

2 Likes

It’s extremely bad code, and I wish that there was some API so that we could purchase bundles, or animations directly.

2 Likes

Does this work with rthro bundles?

This most likely works with any bundle.

1 Like

I have used the code and an error pops up, any idea why?

script.Parent.MouseClick:Connect(function(p)
local bundleId = 495
	local AssetService = game:GetService('AssetService')
	local MarketplaceService = game:GetService('MarketplaceService')
	local BundleItems = AssetService:GetBundleDetailsAsync(bundleId).Items
	local FirstBundleInfo = MarketplaceService:GetProductInfo(BundleItems[1].Id)
	local OldBundleId = string.match(FirstBundleInfo.Description, "%d+")
	
	MarketplaceService:PromptPurchase(p, OldBundleId)
end)

The error is:
sergsrg

It appears Roblox has stopped alllowing this method to occur.
Early bundles (Such as the one that I provided code for) will work, as it gets an asset in the bundle and holds a link to it

Now some bundles don’t hold these exclusive assets, and are rather a reaction of old assets

Futhermore, there’s no description.

Now we have to wait for Roblox to release some API for this

3 Likes

If you’re still looking for this, an API has been added for developers as of Update 458.

9 Likes

I’m trying to use the new api for my project but it says thisimage

1 Like

Until it’s enabled, it is possible to buy bundles from a game using InspectPlayerFromHumanoidDescription but very…cumbersome

If you click on an item in the bundle it displays a purchase option

Yeah I use that but I am making a remake of that that lets you copy the ids of the items that consist of the outfit/avatar

Hey, do you by any chance know if that method still works? I tried it with bundles such as Korblox Deathspeaker and it brings up the bundle page but clicking buy has no effect.

If not, are you aware of any methods that allow you to sell the bundle in-game to make a commission off of them? I am mostly asking this in attempts to make a commission out of Headless Horseman.

For some bundles, its assets show the id,

2 Likes

Sorry for the bump, but anyone looking for the solution, here it is:

local bundleId = bundleIdHere

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	game:GetService("MarketplaceService"):PromptBundlePurchase(plr, bundleId)
end)

Change the ClickDetector to your click object (TextButton, ImageButton etc.)

2 Likes

This doesn’t work. You need a certain permission to use this. Not everyone can use the feature, like AvatarEditorService.

Example of needing permission:
image