Skip to content

Service · inherits Instance

MarketplaceService

Official docs ↗

The service responsible for in-experience transactions.

About MarketplaceService

MarketplaceService is responsible for in-experience transactions. The most notable methods are PromptProductPurchase and PromptPurchase, as well as the callback ProcessReceipt which must be defined so that developer product transactions do not fail. BindReceiptHandler is a newer alternative that processes developer product receipts (and Robux transfer receipts) through one or more bound handlers instead of the single ProcessReceipt callback.

MarketplaceService also has methods that fetch information about developer products (GetProductInfoAsync and GetDeveloperProductsAsync), passes (UserOwnsGamePassAsync()), and other assets (PlayerOwnsAssetAsync, PlayerOwnsBundleAsync).

Understanding MarketplaceService is the first step towards learning to monetize an experience on Roblox, as well as learning to use DataStoreService, which is responsible for saving and loading all data related to purchases.

Methods 24

  • BindReceiptHandler(transactionType: ReceiptType, handler: Function, filter: Array?) → RBXScriptConnectionRegisters a callback to process receipts of a specific type.

    BindReceiptHandler registers a callback to process receipts of a specific ReceiptType. You can use it to handle developer product receipts (ReceiptType.DeveloperProduct) and Robux transfer receipts (ReceiptType.RobuxTransferSender and ReceiptType.RobuxTransferReceiver).

    For ReceiptType.DeveloperProduct, you can register handlers in two ways:

    • Filtered — Pass a filter array of developer product IDs so the handler only fires for receipts whose ProductId is in that array. Use this to route specific products to dedicated handlers.
    • Catch-all — Omit filter so the handler fires for any developer product receipt not already claimed by a filtered handler.

    For developer products, BindReceiptHandler is an alternative to the legacy ProcessReceipt callback. A bound handler takes precedence; if no bound handler matches a developer product receipt, it falls through to ProcessReceipt. This lets you adopt BindReceiptHandler incrementally without removing an existing ProcessReceipt callback.

    The handler callback receives a receipt info dictionary and must return an ReceiptDecision value:

    • ReceiptDecision.Processed — Indicates the receipt was successfully processed and all benefits have been granted. The receipt is marked as complete.
    • ReceiptDecision.NotProcessedYet — Indicates the receipt has not been processed yet. The receipt remains unresolved and will be delivered again on the next opportunity.

    Receipt Info Dictionary

    The receipt info dictionary passed to the handler contains the following fields:

    Receipt Timing

    For Robux transfer receipts, handler is invoked once the transfer settles. A settled receipt is delivered to whichever server the user is currently in (the user does not need to rejoin).

    • ReceiptType.RobuxTransferReceiver — Delivered to the server the receiver is currently in once the transfer settles. If the receiver is offline at that time, delivery happens the next time they join a server.
    • ReceiptType.RobuxTransferSender — Delivered immediately if the transfer settles synchronously. If the transfer is gated on receiver approval (for example, parental consent), delivery happens once the receiver accepts, to whichever server the sender is currently in or on their next join if they are offline.

    For developer product receipts, handler is invoked when the purchase completes while the buyer is on a server. If the handler returns ReceiptDecision.NotProcessedYet, or the buyer is not reachable, the receipt remains unresolved and is redelivered on a later opportunity or the next time the buyer joins a server.

    The user must be on a server for handler to fire.

    Errors

    This method throws an error if:

    • A handler is already registered for the same ReceiptType and product ID combination.
    • A catch-all handler is already registered for the same ReceiptType.
  • GetDeveloperProductsAsync() → InstanceYieldsReturns a Pages object which contains information for all of the current experience's developer products.

    Returns a Pages object which contains information for all of the current experience's developer products.

  • GetProductInfoAsync(assetId: int64, infoType: InfoType = Asset) → DictionaryYieldsReturns the product information of an asset using its asset ID.

    This method provides information about an asset, developer product, or pass based on the asset ID and the InfoType. If an item with the given ID does not exist, this method throws an error.

    Information about the queried item is provided in a dictionary with the following keys. Note that not all information is provided or necessarily relevant for the kind of product you're querying.

    Creator Information

    Asset Information

    Collectibles Information

    Sale Location Settings

    Timed Options

    Batching behavior

    This method is Transparent Batching capable. If you spawn multiple calls concurrently using task.spawn, the engine automatically combines them into fewer HTTP requests behind the scenes. This is faster and helps you avoid rate limits. See Transparent Batching for details and a code example.

  • GetRobloxSubscriptionDetailsAsync(user: Player) → DictionaryYieldsReturns the subscription details for the given user for the Roblox Subscription ecosystem.

    This method is a streamlined endpoint to check for a single, platform-wide Roblox subscription product. By providing StartTime (conditionally) and IsOriginExperience to reward long-term loyalists without compromising user data across the platform.

    The returned dictionary contains the following fields:

  • GetSubscriptionProductInfoAsync(subscriptionId: string) → DictionaryYieldsReturns the product information of a subscription for the given subscriptionId.

    Returns the product information of a subscription for the given subscriptionId. Because it returns a localized price, you can only call this method from a Script with RunContext.Client.

  • GetUsersPriceLevelsAsync(userIds: Array) → List<PriceLevelInfo>YieldsReturns the regionalized price levels of users, representing the recommended price for an item in each user's regional market.

    Returns the regionalized price levels of users, representing the recommended price for an item in each user's regional market. For example, a price level of 100 means that the suggested price for that user (based on their region and purchasing power) is 100 Robux.

    See Protect your trades and gifts for more information.

  • GetUserSubscriptionDetailsAsync(user: Player, subscriptionId: string) → DictionaryYieldsReturns a table that contains the details of the user's subscription for a given subscriptionId.

    Returns a dictionary table containing the details of the user's subscription for the given subscriptionId. The table contains the following keys:

    Note that this method can only be called from a Script with RunContext of Server. If you only need to determine the IsSubscribed status of a user, it's recommended to use GetUserSubscriptionStatusAsync as it is faster and more efficient for that particular purpose.

  • GetUserSubscriptionPaymentHistoryAsync(user: Player, subscriptionId: string) → ArrayYieldsReturns an Array that contains up to one year of the user's subscription payment history for the given subscriptionId.

    Returns an Array that contains up to one year of the user's subscription payment history for the given subscriptionId, sorted from the most recent status to the least recent. You can only call this method from a Script with RunContext.Server.

    Each entry in the payment history Array contains the following keys:

    Payment History Length

    Only creators affiliated with the subscription product can access up to one year worth of the user's subscription payment history. Non-associated creators can only get the user's current subscription payment status or an empty Array if the user has no active subscription.

    Grace Period

    Subscription renewal payments can have some processing time. Payment history doesn't return a table for this period. However, in order to preserve a user's subscription experience during the processing period, GetUserSubscriptionStatusAsync returns IsSubscribed: true for the given user. Don't grant durable items or currency type subscription benefits to the user until after payment has been confirmed for the current cycle.

    For example, on August 31, 2023, User A's Subscription B is up for renewal. On September 1, 2023, the payment has yet to be processed. If you call GetUserSubscriptionPaymentHistoryAsync on September 1, 2023 on User A for Subscription B, the first entry of the return value is:

    Note that since the user is within the grace period, the cycle they have yet to pay for (September 1, 2023) does not appear in the return value at all. This field only populates after the payment has been received and processed.

    At the same time, GetUserSubscriptionStatusAsync returns the following result until the renewal payment process fails or the user cancels:

  • GetUserSubscriptionStatusAsync(user: Player, subscriptionId: string) → DictionaryYieldsReturns a table that contains the subscription status of the user for the given subscriptionId.

    Returns a table that contains the subscription status of the user for the given subscriptionId. The table contains the following keys:

    Note that IsSubscribed will be true only when a user has purchased the subscription and the payment has been successfully processed. If the payment for a user's initial subscription purchase is still processing or has failed, IsSubscribed returns false. To understand when a user's subscription status has changed, see the Players.UserSubscriptionStatusChanged event.

  • OpenShop(player: Player) → ()Opens a personalized in-game Shop for the given player.

    Opens an in-game Shop as an overlay window for the given Player. Shop displays a personalized list of the experience's passes and developer products ranked for the user.

    A default Shop is generated automatically for every game and requires no additional developer setup. You can customize which items appear in the shop from Creator Hub.

    This method can be called from either a server Script or a LocalScript. When called from a LocalScript, player must match the local player.

    You can call this method in response to any user action, such as a button click, the player reaching a specific location, or joining the experience.

  • PlayerOwnsAssetAsync(player: Instance, assetId: int64) → booleanYieldsReturns whether the given user has the given asset.

    Returns whether the inventory of a specific user contains an asset, based on the asset ID. This method throws an error if the query fails, so you should wrap calls to this method in pcall().

    • This method should not be used for passes since they use a separate ID system. Legacy passes that still depend on an asset ID should use UserOwnsGamePassAsync() instead of this method.
    • This method cannot be used to check for developer products since they can be purchased multiple times but not owned themselves. Instead, use a data store to save when a user buys a developer product.
  • PlayerOwnsBundleAsync(player: Player, bundleId: int64) → booleanYieldsReturns whether the given player owns the given bundle.

    Returns whether the inventory of a specific user contains a bundle, based on the bundle ID. This method throws an error if the query fails, so you should wrap calls to this method in pcall().

  • PromptBulkPurchase(player: Player, lineItems: Array, options: Dictionary) → ()Prompts a user to purchase multiple avatar items with the given assetId or bundleId.

    Prompts a user to purchase multiple avatar items with the given assetId or bundleId. Does not work with non-avatar items.

    PromptBulkPurchase only allows prompting from server scripts.

    For limited items, original copies are prompted until they run out, regardless of the price. Once original copies are out, resale copies are prompted.

    A maximum of 20 items can be added to a single bulk purchase prompt.

    PurchaseOptions

    Each line item can optionally include a PurchaseOptions array to control which purchase option appears in the prompt. If omitted, the user is prompted for a permanent purchase only (default behavior).

    PurchaseOptions currently supports only one entry. If more than one option is provided, the API throws an error.

    Each entry in PurchaseOptions contains:

    Do not hardcode duration values. Available durations and prices are determined by the backend and may change at any time. Always retrieve them from one of the following APIs and pass the values through to PurchaseOptions:

  • PromptBundlePurchase(player: Instance, bundleId: int64) → ()Prompts a user to purchase a bundle with the given bundleId.
  • PromptCancelSubscription(user: Player, subscriptionId: string) → ()Prompts a user to cancel a subscription for the given subscriptionId.

    Prompts a user to cancel a subscription for the given subscriptionId. Once the user successfully cancels the subscription, the Players.UserSubscriptionStatusChanged event fires.

  • PromptGamePassPurchase(player: Instance, gamePassId: int64) → ()Prompts a user to purchase a pass with the given gamePassId.

    Prompts a user to purchase a pass with the given gamePassId.

  • PromptProductPurchase(player: Instance, productId: int64, equipIfPurchased: boolean = true, currencyType: CurrencyType = Default) → ()Prompts a user to purchase a developer product with the given productId.

    Prompts a user to purchase a developer product with the given productId.

  • PromptPurchase(player: Instance, assetId: int64, equipIfPurchased: boolean = true, currencyType: CurrencyType = Default) → ()Prompts a user to purchase an item with the given assetId. Does not work for USD Creator Store purchases.

    Prompts a user to purchase an item with the given assetId.

    • This does not work for USD Creator Store purchases.
    • If the item has the Sale Location set as Experience By Place ID (API Only), you must call MarketplaceService.PromptPurchase from a server script.
    • If prompting a purchase of a limited item:
      • (Recommended) Server requests prompt original copies until they run out, regardless of the price. Once original copies run out, resale copies are prompted.
      • Client requests prompt from the lowest resale price even if original copies are available.
  • PromptRobloxSubscriptionPurchase(user: Player) → ()Prompts a user to purchase a Roblox Plus subscription.

    Prompts a user to purchase a Roblox Plus subscription. When the user successfully subscribes, any experience-defined rewards for the upsell are granted automatically through the engine API.

    See Also

  • PromptRobuxTransferAsync(sender: Player, receiverUserId: int64, amount: int64) → stringYieldsInitiates a Robux transfer from the sender to another user.

    PromptRobuxTransferAsync initiates a Robux transfer from the sender to the user specified by receiverUserId. This is a server-only method and must be called from a Script with RunContext set to Server.

    After a successful transfer, both the sender and receiver will have receipts delivered to their respective BindReceiptHandler callbacks:

    Both receipts include a TransferRequestId field matching the transferRequestId returned by this method, which you can use for logging or to correlate sender and receiver receipts.

    Receipt Timing

    Both receipts are delivered to whichever server the corresponding user is currently in once the transfer settles (neither side needs to rejoin). If a transfer is gated on receiver approval, for example parental consent for the receiver's account, it does not settle until approval lands; receipts are delivered after that point.

    • Receiver receipt is delivered to the server the receiver is currently in once the transfer settles, or on their next session join if they are offline.
    • Sender receipt is delivered immediately if the transfer settles synchronously. If approval is required, it is delivered to the server the sender is currently in once the receiver accepts, or on the sender's next session join if they are offline.

    Errors

    This method throws an error if:

    • The sender is not a valid Player instance.
    • receiverUserId is not a positive integer.
    • amount is not a positive integer.
    • The method is called from the client instead of the server.
  • PromptSubscriptionPurchase(user: Player, subscriptionId: string) → ()Prompts a user to purchase a subscription for the given subscriptionId.
  • RankProductsAsync(productIdentifiers: Array) → List<RankedItem>YieldsTakes a list of product IDs and returns a personalized ordered list of those products.

    Takes a list of product IDs and returns a personalized ordered list of those products.

    This API has a client-side throttling limit of 10 requests per minute. If you exceed this limit, wait 60 seconds and make the request again.

  • RecommendTopProductsAsync(infoTypes: Array) → List<RankedItem>Yields
    • Takes an array of InfoType and returns up to 50 items representing the products a user is most likely to engage with and purchase.

    Takes an array of InfoType and returns up to 50 items representing the products a user is most likely to engage with and purchase. If no recommendations can be determined, the method returns an empty list.

    This API has a client-side throttling limit of 5 requests per minute. If you exceed this limit, wait 60 seconds and make the request again.

  • UserOwnsGamePassAsync(userId: User, gamePassId: int64) → booleanYieldsReturns true if the player with the given UserId owns the pass with the given gamePassId.

    Returns true if the user with the given UserId owns the pass with the given gamePassId (not to be confused with an asset ID). You can use this method on both the client and the server.

    Caching Behavior

    The results of this function are cached so that repeated calls are returned faster. When the PromptGamePassPurchaseFinished event fires, the cache gets updated to reflect the latest ownership state of the associated game pass.

    If the user purchases a game pass outside of the experience while remaining in the same session, the cache is eventually updated, but this process might take several minutes to propagate.

    When a user first enters a server after purchasing a game pass, this functions always returns true.

    Batching behavior

    This method is Transparent Batching capable. If you spawn multiple calls concurrently using task.spawn, the engine automatically combines them into fewer HTTP requests behind the scenes. This is faster and helps you avoid rate limits. See Transparent Batching for details.

Events 8

  • PromptBulkPurchaseFinishedMarketplaceService.PromptBulkPurchaseFinished:Connect(function(player, status, results))Fires when a purchase prompt for bulk avatar items is closed.

    This event fires when a purchase prompt for a bulk avatar items closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    Note: This is not a trusted event from the client. To check if the user owns the items purchased, use MarketplaceService.PlayerOwnsAssetAsync or MarketplaceService.PlayerOwnsBundleAsync.

  • PromptBundlePurchaseFinishedMarketplaceService.PromptBundlePurchaseFinished:Connect(function(player, bundleId, wasPurchased))Fires when a bundle purchase prompt closes.

    This event fires when a purchase prompt for a bundle closes. Use PlayerOwnsBundleAsync() to verify ownership instead of trusting this client-originated event.

  • PromptGamePassPurchaseFinishedMarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamePassId, wasPurchased))Fires when a purchase prompt for a pass is closed.

    This event fires when a purchase prompt for a pass closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    See Also

  • PromptPremiumPurchaseFinishedMarketplaceService.PromptPremiumPurchaseFinished:Connect(function())Fires when a purchase prompt for Roblox Premium is closed.

    This event fires when a purchase prompt for Roblox Premium closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    See Also

  • PromptProductPurchaseFinishedMarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, isPurchased))Fires when a purchase prompt for a developer product is closed. Do not use this event to process purchases.

    IMPORTANT: Do not use the PromptProductPurchaseFinished event to process purchases; instead, use the ProcessReceipt callback. The firing of PromptProductPurchaseFinished does not mean that a user has successfully purchased an item.

    This event fires when a purchase prompt for a developer product closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK. The firing of this event does not mean that a user has successfully purchased an item.

    While you can use the PromptProductPurchaseFinished event to detect when a user closes a purchase prompt, you should not use it to process purchases because those purchases might still fail in the backend for several reasons. For example, if a Roblox system is offline, or if the product price has changed and the user now doesn't have enough Robux to make the purchase. To process purchases, you must use ProcessReceipt. Using ProcessReceipt allows you to confirm that the purchase has succeeded before you grant the user the item they have purchased.

    The PromptProductPurchaseFinished event fires with a Player.UserId instead of a reference to the Player object.

    See Also

  • PromptPurchaseFinishedMarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased))Fires when a purchase prompt for an affiliate gear sale or other asset is closed. Does not fire for developer product or pass prompts.

    This event fires when a purchase prompt for an affiliate gear sale or other asset closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    This event does not fire for developer product or pass prompts.

    See Also

  • PromptRobloxSubscriptionPurchaseFinishedMarketplaceService.PromptRobloxSubscriptionPurchaseFinished:Connect(function(user, didTryPurchasing))Fires when a purchase prompt for Roblox Plus is closed.

    This event fires when a purchase prompt for Roblox Plus closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    Note that this event firing does not guarantee the subscription was successfully processed. Listen to Player.HasRobloxSubscription via Instance.GetPropertyChangedSignal on the server to confirm a subscription change before granting rewards.

    See Also

  • PromptSubscriptionPurchaseFinishedMarketplaceService.PromptSubscriptionPurchaseFinished:Connect(function(user, subscriptionId, didTryPurchasing))Fires when a purchase prompt for a subscription is closed.

    This event fires when a purchase prompt for an affiliate gear sale or other asset closes. For example, when a user receives the purchase prompt and clicks Cancel, or when they receive a success or error message and click OK.

    See Also

Callbacks 1

  • ProcessReceipt(receiptInfo: Dictionary) → ProductPurchaseDecisionA callback to process receipts of developer product purchases.

MarketplaceService also has every member of Instance. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.