# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: MarketplaceService type: class memory_category: Instances summary: | The service responsible for in-experience transactions. description: | `Class.MarketplaceService` is responsible for in-experience transactions. The most notable methods are `Class.MarketplaceService:PromptProductPurchase()|PromptProductPurchase` and `Class.MarketplaceService:PromptPurchase()|PromptPurchase`, as well as the callback `Class.MarketplaceService.ProcessReceipt|ProcessReceipt` which must be defined so that developer product transactions do not fail. `Class.MarketplaceService:BindReceiptHandler()|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. `Class.MarketplaceService` also has methods that fetch information about [developer products](../../../production/monetization/developer-products.md) (`Class.MarketplaceService:GetProductInfoAsync()|GetProductInfoAsync` and `Class.MarketplaceService:GetDeveloperProductsAsync()|GetDeveloperProductsAsync`), [passes](../../../production/monetization/passes.md) (`Class.MarketplaceService:UserOwnsGamePassAsync()|UserOwnsGamePassAsync()`), and other assets (`Class.MarketplaceService:PlayerOwnsAssetAsync()|PlayerOwnsAssetAsync`, `Class.MarketplaceService:PlayerOwnsBundleAsync()|PlayerOwnsBundleAsync`). Understanding `Class.MarketplaceService` is the first step towards learning to [monetize](../../../production/monetization/index.md) an experience on Roblox, as well as learning to use `Class.DataStoreService`, which is responsible for saving and loading all data related to purchases. code_samples: [] inherits: - Instance descendants: [] tags: - NotCreatable - Service deprecation_message: '' properties: [] methods: - name: MarketplaceService:BindReceiptHandler summary: | Registers a callback to process receipts of a specific type. description: | `BindReceiptHandler` registers a callback to process receipts of a specific `Enum.ReceiptType`. You can use it to handle developer product receipts (`Enum.ReceiptType.DeveloperProduct`) and Robux transfer receipts (`Enum.ReceiptType.RobuxTransferSender` and `Enum.ReceiptType.RobuxTransferReceiver`). For `Enum.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 `Class.MarketplaceService.ProcessReceipt|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 `Enum.ReceiptDecision` value: - `Enum.ReceiptDecision.Processed` — Indicates the receipt was successfully processed and all benefits have been granted. The receipt is marked as complete. - `Enum.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:
Key Type Description
PurchaseId string A unique identifier for this specific receipt.
PlayerId number The Class.Player.UserId of the user associated with this receipt.
PlaceIdWherePurchased number The place ID where the transaction was initiated.
ReceiptType Enum.ReceiptType The type of this receipt.
ProductId number The developer product ID. Only present for Enum.ReceiptType.DeveloperProduct receipts.
CurrencyType Enum.CurrencyType The currency used for the purchase. Only present for Enum.ReceiptType.DeveloperProduct receipts.
CurrencySpent number The amount of Robux involved in the transaction. For Enum.ReceiptType.DeveloperProduct receipts, this is the product's price. For Enum.ReceiptType.RobuxTransferSender receipts, this is the amount sent. For Enum.ReceiptType.RobuxTransferReceiver receipts, this is the amount received.
TransferRequestId string The transfer request ID from Class.MarketplaceService:PromptRobuxTransferAsync(). Only present for Enum.ReceiptType.RobuxTransferSender and Enum.ReceiptType.RobuxTransferReceiver receipts.
#### 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). - `Enum.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. - `Enum.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 `Enum.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 `Enum.ReceiptType` and product ID combination. - A catch-all handler is already registered for the same `Enum.ReceiptType`. code_samples: - MarketplaceService-BindReceiptHandler1 - MarketplaceService-BindReceiptHandler2 parameters: - name: transactionType type: ReceiptType default: summary: | The `Enum.ReceiptType` indicating which kind of receipt to handle. - name: handler type: Function default: summary: | A callback function that receives a receipt info dictionary and must return an `Enum.ReceiptDecision` value. - name: filter type: Array? default: summary: | An optional array of product IDs. When provided, the handler only fires for receipts matching those product IDs. Not supported for `RobuxTransferSender` or `RobuxTransferReceiver` receipt types. returns: - type: RBXScriptConnection summary: | A `Datatype.RBXScriptConnection` that can be disconnected to unregister the handler. tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:GetDeveloperProductsAsync summary: | Returns a `Class.Pages` object which contains information for all of the current experience's developer products. description: | Returns a `Class.Pages` object which contains information for all of the current experience's [developer products](../../../production/monetization/developer-products.md). code_samples: - MarketplaceService-GetDeveloperProductsAsync1 parameters: [] returns: - type: Instance summary: | A `Class.Pages` object whose entries describe the current experience's developer products. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:GetProductInfo summary: | Returns the product information of an asset using its asset ID. description: '' code_samples: - MarketplaceService-GetProductInfo1 parameters: - name: assetId type: int64 default: summary: | The asset ID of the specified product. - name: infoType type: InfoType default: Asset summary: | An `Enum.InfoType` enum value specifying the type of information being retrieved. returns: - type: Dictionary summary: | A dictionary containing information about the queried item, described in the previous tables. tags: - Yields - Deprecated deprecation_message: | This method has been superseded by `Class.MarketplaceService.GetProductInfoAsync|GetProductInfoAsync()`. security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:GetProductInfoAsync summary: | Returns the product information of an asset using its asset ID. description: | This method provides information about an asset, [developer product](../../../production/monetization/developer-products.md), or [pass](../../../production/monetization/passes.md) based on the asset ID and the `Enum.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.
Key Type Description
Name string The name shown on the asset's page.
Description string The description shown on the asset's page; can be nil if blank.
PriceInRobux number The cost of purchasing the asset using Robux.
UserBasePriceInRobux number The base price of the asset in Robux before any discounts are applied.
PriceDiscountDetails Array An ordered list of discounts representing the difference between UserBasePriceInRobux and PriceInRobux. Each entry contains the following keys:
Type: The type of discount. "RobloxPlusSubscription" indicates that the discount was applied due to the user’s Roblox Plus subscription.
AmountInRobux: number — The value of the discount in Robux.
Percent: number — The percentage of the discount.
ProductId number The product ID if Enum.InfoType is Product.
ProductType string A string describing what the product is. Not to be confused with Enum.MarketplaceProductType.
Created string Timestamp of when the asset was created, for example 2022-01-02T10:30:45Z. Formatted using ISO 8601.
Updated string Timestamp of when the asset was last updated by its creator, for example 2022-02-12T11:22:15Z. Formatted using ISO 8601.
ContentRatingTypeId number Indicates whether the item is marked as 13+ in catalog.
MinimumMembershipLevel number The minimum subscription level necessary to purchase the item.
IsPublicDomain boolean Describes whether the asset can be taken for free.
TargetId number The ID of the product or asset.
#### Creator Information
Key Type Description
Creator table Dictionary table of information describing the creator of the asset, containing the following fields:
CreatorType: Either User or Group.
CreatorTargetId: The ID of the creator user or group.
HasVerifiedBadge: Boolean of whether the creator has a verified badge.
Name: The name/username of the creator.
Id: Use CreatorTargetId instead.
#### Asset Information
Key Type Description
AssetId number The asset ID if Enum.InfoType is Asset.
AssetTypeId number The type of asset. See Enum.AssetType for the asset type ID numbers.
IconImageAssetId number The asset ID of the product's icon, or 0 if there isn't one.
IsForSale boolean Describes whether the asset is purchasable.
IsLimited boolean Describes whether the asset is a Roblox Limited that is no longer (if ever) sold.
IsLimitedUnique boolean Describes whether the asset is a unique Roblox Limited ("Limited U") item that only has a fixed number sold.
IsNew boolean Describes whether the asset is marked as "new" in the catalog.
Remaining number The remaining number of times a limited unique item may be sold.
Sales number The number of times the asset has been sold.
#### Collectibles Information
Key Type Description
CollectibleItemId string The unique item ID of the collectible.
CollectibleProductId string The unique product ID of the collectible.
CollectiblesItemDetails table Dictionary table of information describing the collectible, containing the following fields:
CollectibleLowestAvailableResaleItemInstanceId: The unique item instance ID of the lowest available resale for the collectible.
CollectibleLowestAvailableResaleProductId: The unique product ID of the lowest available resale for the collectible.
CollectibleLowestResalePrice: The lowest resale price for the collectible in Robux.
IsForSale: Boolean of whether the collectible is available for sale (not resale).
IsLimited: Boolean of whether or not the collectible is limited.
TotalQuantity: The total quantity of the collectible available for purchase (not resale).
#### Sale Location Settings
Key Type Description
CanBeSoldInThisGame boolean Describes whether the asset is purchasable in the current experience.
SaleLocation table Dictionary table of information describing where the item can be sold, containing the following fields:
SaleLocationType: The type of sale location setting. See Enum.ProductLocationRestriction for the sale location setting ID numbers.
UniverseIds: Array table of universes in which the item can be sold (not currently implemented).
#### Timed Options
Key Type Description
TimedOptions array Optional. An array of available timed options with durations and prices. Only present for assets that support timed ownership. Do not hardcode duration values; always retrieve them from this API as they may change. Each entry contains:
Duration: number — The duration in seconds (e.g. 259200 for 3 days, 604800 for 7 days).
Price: number — The price in Robux for this duration.
#### 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](../../../scripting/transparent-batching.md) for details and a code example. code_samples: - MarketplaceService-GetProductInfo1 - MarketplaceService-GetProductInfo2 - MarketplaceService-GetProductInfo-TimedOptions - MarketplaceService-GetProductInfo-TransparentBatching parameters: - name: assetId type: int64 default: summary: | The asset ID of the specified product. - name: infoType type: InfoType default: Asset summary: | An `Enum.InfoType` enum value specifying the type of information being retrieved. returns: - type: Dictionary summary: | A dictionary containing information about the queried item, described in the previous tables. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:GetRobloxSubscriptionDetailsAsync summary: | Returns the subscription details for the given user for the Roblox Subscription ecosystem. description: | 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:
Field Type Description
IsSubscribed bool Returns true if the user has an active Roblox Subscription membership.
IsOriginExperience bool Returns true if the user originally subscribed to Roblox Subscription while inside the current Experience (Universe).
StartTime DateTime? A Datatype.DateTime object representing the time when the user’s subscription period first began. Note: For privacy reasons, this field is only returned if IsOriginExperience is true. If the user subscribed in a different experience or on the web, this field will be nil.
code_samples: - MarketplaceService-GetRobloxSubscriptionDetailsAsync1 parameters: - name: user type: Player default: summary: | The user regarding whom to check the subscription status. returns: - type: Dictionary summary: | A dictionary containing subscription details such as `IsSubscribed`, `IsOriginExperience`, and optionally `StartTime`. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:GetSubscriptionProductInfoAsync summary: | Returns the product information of a subscription for the given `subscriptionId`. description: | 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 `Class.Script` with `Enum.RunContext.Client`.
Key Type Description
Name string The name of the subscription product.
Description string The description of the subscription product.
IconImageAssetId number The asset ID of the subscription product icon.
SubscriptionPeriod Enum.SubscriptionPeriod The duration of the subscription (for example, Month, Year, etc.).
DisplayPrice string Localized price with the appropriate currency symbol for display (for example, $4.99). For users in unsupported countries, DisplayPrice returns a string without specific price information.
DisplaySubscriptionPeriod string Localized subscription period text for display (for example, /month). Can be used together with DisplayPrice.
SubscriptionProviderName string Name of the subscription benefit provider (for example, the name of the associated experience).
IsForSale boolean True if the subscription product is available for sale.
PriceTier number A number that can be used to compare the price of different subscription products. This is not the actual price of the subscription (for example, 499).
PriceInRobux number The equivalent cost of the subscription in Robux. Returns 0 if the subscription product is not available to be purchased in Robux.
code_samples: [] parameters: - name: subscriptionId type: string default: summary: | The ID of the subscription to check. returns: - type: Dictionary summary: | A dictionary containing the subscription product information described in the following table. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:GetUsersPriceLevelsAsync summary: | Returns the regionalized price levels of users, representing the recommended price for an item in each user's regional market. description: | 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](../../../production/monetization/regional-pricing.md#protect-your-trades-and-gifts) for more information. code_samples: - MarketplaceService-GetUsersPriceLevelAsync parameters: - name: userIds type: Array default: summary: | An array of user IDs. returns: - type: List summary: | Returns an array of `PriceLevelInfo` objects with a dictionary where the keys are user IDs (strings) and their values are the corresponding price levels (integers between 1 and 1000). tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:GetUserSubscriptionDetailsAsync summary: | Returns a table that contains the details of the user's subscription for a given `subscriptionId`. description: | Returns a dictionary table containing the details of the user's subscription for the given `subscriptionId`. The table contains the following keys:
Key Type Description
SubscriptionState Enum.SubscriptionState Current state of this particular subscription.
NextRenewTime Datatype.DateTime Renewal time for this current subscription. May be in the past if the subscription is in Enum.SubscriptionState.SubscribedRenewalPaymentPending|SubscribedRenewalPaymentPending state. This field is will be nil if the subscription will not renew, is Enum.SubscriptionState.Expired|Expired, or the user never subscribed.
ExpireTime Datatype.DateTime When this subscription expires. This field will be nil if the subscription is not cancelled or the user never subscribed.
ExpirationDetails Library.table Table containing the details of the subscription expiration. This field will be nil if the subscription is not in the Enum.SubscriptionState.Expired|Expired state. If populated, the table contains a ExpirationReason key of type Enum.SubscriptionExpirationReason describing why the subscription is expired.
Note that this method can only be called from a `Class.Script` with `Class.BaseScript.RunContext|RunContext` of `Enum.RunContext.Server|Server`. If you only need to determine the `IsSubscribed` status of a user, it's recommended to use `Class.MarketplaceService:GetUserSubscriptionStatusAsync()|GetUserSubscriptionStatusAsync` as it is faster and more efficient for that particular purpose. code_samples: [] parameters: - name: user type: Player default: summary: | The `Class.Player` object whose subscription details you want to check. - name: subscriptionId type: string default: summary: | The ID of the subscription to check. returns: - type: Dictionary summary: | A dictionary containing the user's subscription details described in the following table. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:GetUserSubscriptionPaymentHistoryAsync summary: | Returns an `Library.table|Array` that contains up to one year of the user's subscription payment history for the given `subscriptionId`. description: | Returns an `Library.table|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 `Class.Script` with `Enum.RunContext.Server`. Each entry in the payment history `Library.table|Array` contains the following keys:
Key Type Description
CycleStartTime Datatype.DateTime Datatype.DateTime at the start of this particular subscription period.
CycleEndTime Datatype.DateTime Datatype.DateTime at the end of this particular subscription period.
PaymentStatus Enum.SubscriptionPaymentStatus Enum.SubscriptionPaymentStatus.Paid if the user paid for this particular subscription period. Enum.SubscriptionPaymentStatus.Refunded if the user refunded this particular subscription period.
#### 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 `Library.table|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, `Class.MarketplaceService.GetUserSubscriptionStatusAsync()|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 `Class.MarketplaceService.GetUserSubscriptionPaymentHistoryAsync()|GetUserSubscriptionPaymentHistoryAsync` on September 1, 2023 on User A for Subscription B, the first entry of the return value is:
Key Value
CycleStartTime ...
CycleEndTime August 31, 2023
PaymentStatus Enum.SubscriptionPaymentStatus.Paid
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, `Class.MarketplaceService.GetUserSubscriptionStatusAsync()|GetUserSubscriptionStatusAsync` returns the following result until the renewal payment process fails or the user cancels:
Key Return
IsSubscribed True
IsRenewing True
code_samples: - MarketplaceService-GetUserSubscriptionPaymentHistoryAsync1 parameters: - name: user type: Player default: summary: | The `Class.Player` whose subscription payment history you want to retrieve. - name: subscriptionId type: string default: summary: | The ID of the subscription whose payment history you want to retrieve. returns: - type: Array summary: | An array of payment-history entries, ordered from most recent to least recent, as described in the following table. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:GetUserSubscriptionStatusAsync summary: | Returns a `Library.table` that contains the subscription status of the user for the given `subscriptionId`. description: | Returns a `Library.table` that contains the subscription status of the user for the given `subscriptionId`. The table contains the following keys:
Key Type Description
IsSubscribed boolean True if the user's subscription is active.
IsRenewing boolean True if the user is set to renew this subscription after the current subscription period ends.
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 `Class.Players.UserSubscriptionStatusChanged` event. code_samples: - MarketplaceService-GetUserSubscriptionStatusAsync1 parameters: - name: user type: Player default: summary: | The `Class.Player` object whose subscription status you want to check. - name: subscriptionId type: string default: summary: | The ID of the subscription to check for. returns: - type: Dictionary summary: | A dictionary containing the user's subscription status described in the following table. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization - name: MarketplaceService:OpenShop summary: | Opens a personalized in-game Shop for the given player. description: | Opens an [in-game Shop](../../../production/monetization/shop.md) as an overlay window for the given `Class.Player`. Shop displays a personalized list of the experience's [passes](../../../production/monetization/passes.md) and [developer products](../../../production/monetization/developer-products.md) 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 `Class.Script` or a `Class.LocalScript`. When called from a `Class.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. code_samples: - MarketplaceService-OpenShop parameters: - name: player type: Player default: summary: | The `Class.Player` for whom to open the shop. If called from a `Class.LocalScript`, this must be the local player. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PlayerOwnsAsset summary: | Returns whether the given user has the given asset. description: '' code_samples: [] parameters: - name: player type: Instance default: summary: | The `Class.Player` whose inventory is tested for ownership of the given asset. - name: assetId type: int64 default: summary: | The asset ID for which the given player's inventory is tested. returns: - type: boolean summary: | Indicates whether the given player's inventory contains the given asset. tags: - Yields - Deprecated deprecation_message: | This method has been superseded by `Class.MarketplaceService:PlayerOwnsAssetAsync()|PlayerOwnsAssetAsync()`. security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:PlayerOwnsAssetAsync summary: | Returns whether the given user has the given asset. description: | 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](../../../production/monetization/passes.md) since they use a separate ID system. Legacy passes that still depend on an asset ID should use `Class.MarketplaceService:UserOwnsGamePassAsync()|UserOwnsGamePassAsync()` instead of this method. - This method cannot be used to check for [developer products](../../../production/monetization/developer-products.md) since they can be purchased multiple times but not owned themselves. Instead, use a [data store](../../../cloud-services/data-stores) to save when a user buys a developer product. code_samples: - MarketplaceService-PlayerOwnsAsset1 parameters: - name: player type: Instance default: summary: | The `Class.Player` whose inventory is tested for ownership of the given asset. - name: assetId type: int64 default: summary: | The asset ID for which the given player's inventory is tested. returns: - type: boolean summary: | Indicates whether the given player's inventory contains the given asset. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:PlayerOwnsBundle summary: | Returns whether the given player owns the given bundle. description: '' code_samples: [] parameters: - name: player type: Player default: summary: | The `Class.Player` whose inventory is tested for ownership of the given bundle. - name: bundleId type: int64 default: summary: | The bundle ID for which the given player's inventory is tested. returns: - type: boolean summary: | Indicates whether the given player's inventory contains the given bundle. tags: - Yields - Deprecated deprecation_message: | This method has been superseded by `Class.MarketplaceService:PlayerOwnsBundleAsync()|PlayerOwnsBundleAsync()`. security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:PlayerOwnsBundleAsync summary: | Returns whether the given player owns the given bundle. description: | 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()`. code_samples: - MarketplaceService-PlayerOwnsBundle1 parameters: - name: player type: Player default: summary: | The `Class.Player` whose inventory is tested for ownership of the given bundle. - name: bundleId type: int64 default: summary: | The bundle ID for which the given player's inventory is tested. returns: - type: boolean summary: | Indicates whether the given player's inventory contains the given bundle. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: MarketplaceService:PromptBulkPurchase summary: | Prompts a user to purchase multiple avatar items with the given `assetId` or `bundleId`. description: | 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:
Key Type Description
Type Enum Enum.PurchaseOption.TimedOption for a timed option, or Enum.PurchaseOption.Permanent for standard purchase.
Value number Required for TimedOption. The duration in seconds.
**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`: - `Class.MarketplaceService:GetProductInfoAsync()` - `Class.AvatarEditorService:GetItemDetailsAsync()` - `Class.AvatarEditorService:GetBatchItemDetailsAsync()` - `Class.AvatarEditorService:SearchCatalogAsync()` code_samples: - Prompt-Bulk-Purchase-Local - Prompt-Bulk-Purchase-Server - MarketplaceService-PromptBulkPurchase-TimedOptions parameters: - name: player type: Player default: summary: | The user to prompt to purchase items. - name: lineItems type: Array default: summary: | An array of avatar items to be included in the bulk purchase. Each line item contains the following structure: ```lua { Type: MarketplaceProductType, Id: string, PurchaseOptions: { {Type: PurchaseOption, Value: number?} }? } ``` Each line item contains the following pairs: - `Type`: The corresponding `Enum.MarketplaceProductType` (Enum). - `Id`: The ID of the asset or bundle. - `PurchaseOptions`: Optional. An array containing a single purchase option to display in the prompt. If omitted, the permanent purchase is prompted. See the PurchaseOptions section below for details. - name: options type: Dictionary default: summary: | Not available at this time. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptBundlePurchase summary: | Prompts a user to purchase a bundle with the given `bundleId`. description: | Prompts a user to purchase a bundle with the given `bundleId`. code_samples: [] parameters: - name: player type: Instance default: summary: | The `Class.Player` to prompt. - name: bundleId type: int64 default: summary: | The ID of the bundle to purchase. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptCancelSubscription summary: | Prompts a user to cancel a subscription for the given `subscriptionId`. description: | Prompts a user to cancel a subscription for the given `subscriptionId`. Once the user successfully cancels the subscription, the `Class.Players.UserSubscriptionStatusChanged` event fires. code_samples: [] parameters: - name: user type: Player default: summary: | The `Class.Player` to prompt. - name: subscriptionId type: string default: summary: | The ID of the subscription to cancel. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptGamePassPurchase summary: | Prompts a user to purchase a pass with the given `gamePassId`. description: | Prompts a user to purchase a [pass](../../../production/monetization/passes.md) with the given `gamePassId`. You can only prompt purchases of passes that belong to the current game. Purchases of passes from other games fail, even if you own both games. In Studio, mocked purchases don't check that the pass belongs to the current game, so prompting a pass purchase from another game might appear to succeed. Before you publish, verify that the `gamePassId` belongs to the current game. code_samples: [] parameters: - name: player type: Instance default: summary: | The `Class.Player` to prompt. - name: gamePassId type: int64 default: summary: | The pass ID to purchase. This is the `TargetId` returned by `Class.MarketplaceService:GetProductInfo()|GetProductInfo()` when `Enum.InfoType` is `GamePass`. It is not the pass's asset ID and not its `ProductId`. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptPremiumPurchase summary: | Prompts a user to purchase Roblox Premium. description: | Prompts a user to purchase [Roblox Premium](https://www.roblox.com/premium/membership). To learn more about Premium and about incorporating Premium incentives into your experience, see [Engagement-based payouts](../../../production/monetization/engagement-based-payouts.md). #### See Also - `Class.MarketplaceService.PromptPremiumPurchaseFinished` which fires when the Premium purchase UI closes. - `Class.Players.PlayerMembershipChanged` which fires when the server recognizes that a user's membership has changed. code_samples: - prompt-premium-upsell parameters: - name: player type: Instance default: summary: | The user being prompted to purchase Premium. returns: - type: () summary: '' tags: - Deprecated deprecation_message: | This method has been superseded by `Class.MarketplaceService:PromptRobloxSubscriptionPurchase()|PromptRobloxSubscriptionPurchase()`. security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptProductPurchase summary: | Prompts a user to purchase a developer product with the given `productId`. description: | Prompts a user to purchase a [developer product](../../../production/monetization/developer-products.md) with the given `productId`. You can only prompt purchases of developer products that belong to the current game. Purchases of developer products from other games fail, even if you own both games. In Studio, mocked purchases don't check that the product belongs to the current game, so prompting a product purchase from another game might appear to succeed. Before you publish, verify that the `productId` belongs to the current game. code_samples: - MarketplaceService-PromptProductPurchase1 parameters: - name: player type: Instance default: summary: | The `Class.Player` to prompt. - name: productId type: int64 default: summary: | The ID of the developer product to purchase. - name: equipIfPurchased type: boolean default: true summary: | Ignored. - name: currencyType type: CurrencyType default: Default summary: | Ignored. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptPurchase summary: | Prompts a user to purchase an item with the given `assetId`. Does not work for USD Creator Store purchases. description: | Prompts a user to purchase an item with the given `assetId`. - This does not work for [USD Creator Store](../../../production/creator-store.md) purchases. - If the item has the [Sale Location](../../../marketplace/publish-to-marketplace.md#sale-location) set as `Experience By Place ID (API Only)`, you must call `Class.MarketplaceService:PromptPurchase` from a server script. - If prompting a purchase of a [limited](../../../marketplace/marketplace-fees-and-commissions.md#limiteds) 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. code_samples: - MarketplaceService-PromptPurchase1 - market parameters: - name: player type: Instance default: summary: | The `Class.Player` to prompt. - name: assetId type: int64 default: summary: | The ID of the asset to purchase. - name: equipIfPurchased type: boolean default: true summary: | Ignored. - name: currencyType type: CurrencyType default: Default summary: | Ignored. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptRobloxSubscriptionPurchase summary: | Prompts a user to purchase a Roblox Plus subscription. description: | 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 - `Class.MarketplaceService.PromptRobloxSubscriptionPurchaseFinished` which fires when the Roblox Plus purchase UI closes. - `Class.Player.HasRobloxSubscription` which can be observed via `Class.Instance:GetPropertyChangedSignal()` to detect when a user's subscription status changes. code_samples: - MarketplaceService-PromptRobloxSubscriptionPurchase parameters: - name: user type: Player default: summary: | The `Class.Player` to be prompted to purchase Roblox Plus. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptRobuxTransferAsync summary: | Initiates a Robux transfer from the sender to another user. description: | `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 `Class.Script` with `RunContext` set to `Server`. After a successful transfer, both the sender and receiver will have receipts delivered to their respective `Class.MarketplaceService:BindReceiptHandler()|BindReceiptHandler` callbacks: - The sender's receipt has `Enum.ReceiptType.RobuxTransferSender`. - The receiver's receipt has `Enum.ReceiptType.RobuxTransferReceiver`. 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 `Class.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. code_samples: - MarketplaceService-PromptRobuxTransferAsync1 parameters: - name: sender type: Player default: summary: | The `Class.Player` initiating the transfer. Must be a valid player currently in the server. - name: receiverUserId type: int64 default: summary: | The `Class.Player.UserId|UserId` of the user who will receive the Robux. - name: amount type: int64 default: summary: | The amount of Robux to transfer. Must be a positive integer. returns: - type: string summary: | A string `transferRequestId` that uniquely identifies this transfer request. Use this ID to correlate with receipts delivered through `Class.MarketplaceService:BindReceiptHandler()|BindReceiptHandler`. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptSubscriptionPurchase summary: | Prompts a user to purchase a subscription for the given `subscriptionId`. description: | Prompts a user to purchase a subscription for the given `subscriptionId`. code_samples: [] parameters: - name: user type: Player default: summary: | The `Class.Player` object to be prompted to subscribe. - name: subscriptionId type: string default: summary: | The ID of the subscription to subscribe to. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:PromptVIPServerPurchase summary: | Prompts a user to purchase a VIP server for the current experience. description: | Prompts a user to purchase a VIP server for the current experience. Roblox checks whether the user is eligible and, if so, shows the price and handles the purchase. Ineligible users see a message explaining that the purchase is unavailable. This method returns immediately and does not report whether the user completed the purchase. If a purchase prompt is already open for the user, additional calls are ignored. This method can be called from a `Class.Script` for any player in the server, or from a `Class.LocalScript` for the local player only. code_samples: - MarketplaceService-PromptVIPServerPurchase parameters: - name: player type: Player default: summary: | The `Class.Player` to be prompted to purchase a private server. returns: - type: () summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - PromptExternalPurchase - name: MarketplaceService:RankProductsAsync summary: | Takes a list of product IDs and returns a personalized ordered list of those products. description: | 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. code_samples: - MarketplaceService-RankProductsSample parameters: - name: productIdentifiers type: Array default: summary: | An array of objects identifying the products you want to rank. This array can include up to 50 items. Each `ProductIdentifier` has: - `Enum.InfoType`: Enum.InfoType - Must be either `Enum.InfoType.GamePass` or `Enum.InfoType.Product`. - `Id`: number - The ID of the game pass or developer product. ```lua local ProductIdentifier = { InfoType = Enum.InfoType.GamePass, Id = 123456 } ``` returns: - type: List summary: | The array of ranked items in a personalized order for the current user. Each array has: - `ProductIdentifier`: The corresponding ID from the input array. - `ProductInfo`: The standard product info dictionary returned by `Class.MarketplaceService.GetProductInfoAsync|GetProductInfoAsync`. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: [] - name: MarketplaceService:RecommendTopProductsAsync summary: | - Takes an array of `Enum.InfoType` and returns up to 50 items representing the products a user is most likely to engage with and purchase. description: | Takes an array of `Enum.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. code_samples: - MarketplaceService-RecommendTopProductsSample parameters: - name: infoTypes type: Array default: summary: | An array of `Enum.InfoType` values specifying the types of product to retrieve recommendations for. Supported `InfoTypes`: `Enum.InfoType.GamePass`, `Enum.InfoType.Product`. ```lua local infoTypes = { Enum.InfoType.GamePass, Enum.InfoType.Product } ``` returns: - type: List summary: | A ranked list of up to 50 items the user is most likely to engage with, based on the provided `InfoTypes`. If no recommendations can be determined, the method returns an empty list. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: [] - name: MarketplaceService:UserOwnsGamePassAsync summary: | Returns true if the player with the given `Class.Player.UserId|UserId` owns the pass with the given `gamePassId`. description: | Returns true if the user with the given `Class.Player.UserId|UserId` owns the [pass](../../../production/monetization/passes.md) 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 `Class.MarketplaceService.PromptGamePassPurchaseFinished|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](../../../scripting/transparent-batching.md) for details. code_samples: - MarketplaceService-UserOwnsGamePassAsync-TransparentBatching parameters: - name: userId type: User default: summary: | The `Class.Player.UserId|UserId` of the `Class.Player` whose inventory you're checking. - name: gamePassId type: int64 default: summary: | The pass ID you want to check for. Not to be confused with an asset ID. returns: - type: boolean summary: | Whether the user owns the pass. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead events: - name: MarketplaceService.PromptBulkPurchaseFinished summary: | Fires when a purchase prompt for bulk avatar items is closed. description: | 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 `Class.MarketplaceService.PlayerOwnsAssetAsync` or `Class.MarketplaceService.PlayerOwnsBundleAsync`. code_samples: [] parameters: - name: player type: Instance default: summary: | The `Class.Player` who received the prompt. - name: status type: MarketplaceBulkPurchasePromptStatus default: summary: | The status of the bulk purchase. - name: results type: Dictionary default: summary: | The table type containing the line items and their status in the following format: ```lua { RobuxSpent: number Items: { { type: MarketplaceProductType, id: string, status: MarketplaceItemPurchaseStatus }, ... } } ``` Each line item contains the following pairs: - `type`: The corresponding `Enum.MarketplaceProductType` (Enum). - `id`: The ID of the asset or bundle (string). - `status`: The `Enum.MarketplaceItemPurchaseStatus` of the purchase (Enum) tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptBundlePurchaseFinished summary: | Fires when a bundle purchase prompt closes. description: | This event fires when a purchase prompt for a bundle closes. Use `Class.MarketplaceService:PlayerOwnsBundleAsync()|PlayerOwnsBundleAsync()` to verify ownership instead of trusting this client-originated event. code_samples: [] parameters: - name: player type: Instance default: summary: | The `Class.Player` who received the prompt. - name: bundleId type: int64 default: summary: | The ID of the bundle shown in the prompt. - name: wasPurchased type: boolean default: summary: | Whether the bundle was purchased. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptGamePassPurchaseFinished summary: | Fires when a purchase prompt for a pass is closed. description: | This event fires when a purchase prompt for a [pass](../../../production/monetization/passes.md) 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 - For repeatable **developer product** purchase prompts, use `Class.MarketplaceService.PromptProductPurchaseFinished|PromptProductPurchaseFinished`. - For **affiliate gear sales** or other assets, use `Class.MarketplaceService.PromptPurchaseFinished|PromptPurchaseFinished`. - For more information on saving and replicating user data like purchases and progress, see [Implementing player data and purchases](https://devforum.roblox.com/t/implementing-player-data-and-purchasing-systems/2839941). code_samples: - handling-gamepass parameters: - name: player type: Instance default: summary: | The `Class.Player` who received the prompt. - name: gamePassId type: int64 default: summary: | The ID number of the pass shown in the prompt. Not to be confused with an asset ID. - name: wasPurchased type: boolean default: summary: | Indicates if the user pressed **OK** (true), **Cancel** (false) on the purchase prompt, or if the purchase prompt errored (false). When `PromptGamePassPurchaseFinished` fires, it updates the cache used by `Class.MarketplaceService:UserOwnsGamePassAsync()|UserOwnsGamePassAsync()` to reflect the current ownership state. `PromptGamePassPurchaseFinished` should only be listened to in a server script. When used on the server, values such as `wasPurchased` reflect the final outcome of the purchase attempt. When used in a local script, these values should not be relied on for validation or game logic. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptPremiumPurchaseFinished summary: | Fires when a purchase prompt for Roblox Premium is closed. description: | This event fires when a purchase prompt for [Roblox Premium](https://www.roblox.com/premium/membership) 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 - `Class.MarketplaceService.PromptPremiumPurchase|PromptPremiumPurchase` to prompt a user to purchase Premium. - `Class.Players.PlayerMembershipChanged|PlayerMembershipChanged`, which fires when the server recognizes that a user's membership has changed. code_samples: [] parameters: [] tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptProductPurchaseFinished summary: | Fires when a purchase prompt for a developer product is closed. Do not use this event to process purchases. description: | **IMPORTANT:** Do **not** use the `PromptProductPurchaseFinished` event to process purchases; instead, use the `Class.MarketplaceService.ProcessReceipt|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](../../../production/monetization/developer-products.md) 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 `Class.MarketplaceService.ProcessReceipt()|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 - `Class.MarketplaceService.PromptGamePassPurchaseFinished|PromptGamePassPurchaseFinished` to prompt a user to purchase a pass. - `Class.MarketplaceService.PromptPurchaseFinished|PromptPurchaseFinished` to prompt a user to purchase affiliate gear or other assets. - For more information on saving and replicating user data like purchases and progress, see [Implementing player data and purchases](https://devforum.roblox.com/t/implementing-player-data-and-purchasing-systems/2839941). code_samples: [] parameters: - name: userId type: int64 default: summary: | The `Class.Player.UserId|UserId` of the user who received the developer product prompt. - name: productId type: int64 default: summary: | The ID number of the developer product shown in the prompt. Not to be confused with an asset ID. - name: isPurchased type: boolean default: summary: | Indicates if the user pressed **OK** (true), **Cancel** (false) on the purchase prompt, or if the purchase prompt errored (false). Do not use this parameter to process developer product purchases. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptPurchaseFinished summary: | Fires when a purchase prompt for an affiliate gear sale or other asset is closed. Does **not** fire for developer product or pass prompts. description: | 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](../../../production/monetization/developer-products.md) or [pass](../../../production/monetization/passes.md) prompts. #### See Also - `Class.MarketplaceService.PromptGamePassPurchaseFinished|PromptGamePassPurchaseFinished` to prompt a user to purchase a pass. - `Class.MarketplaceService.PromptProductPurchaseFinished|PromptProductPurchaseFinished` to prompt a user to purchase a developer product. - For more information on saving and replicating user data like purchases and progress, see [Implementing player data and purchases](https://devforum.roblox.com/t/implementing-player-data-and-purchasing-systems/2839941). code_samples: - MarketplaceService-PromptPurchaseFinished1 parameters: - name: player type: Instance default: summary: | The `Class.Player` who received the prompt. - name: assetId type: int64 default: summary: | The asset ID of the item shown in the prompt. - name: isPurchased type: boolean default: summary: | Indicates if the user pressed **OK** (true), **Cancel** (false) on the purchase prompt, or if the purchase prompt errored (false). This might not accurately reflect if the purchase itself has been successfully processed. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptRobloxSubscriptionPurchaseFinished summary: | Fires when a purchase prompt for Roblox Plus is closed. description: | 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 `Class.Player.HasRobloxSubscription` via `Class.Instance:GetPropertyChangedSignal()` on the server to confirm a subscription change before granting rewards. #### See Also - `Class.MarketplaceService.PromptRobloxSubscriptionPurchase|PromptRobloxSubscriptionPurchase` to prompt a user to purchase Roblox Plus. - `Class.Player.HasRobloxSubscription`, which can be observed via `Class.Instance:GetPropertyChangedSignal()` to detect when a user's subscription status changes. code_samples: - MarketplaceService-PromptRobloxSubscriptionPurchaseFinished parameters: - name: user type: Player default: summary: | The `Class.Player` who received the prompt. - name: didTryPurchasing type: boolean default: summary: | Whether the user attempted to purchase Roblox Plus. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase - name: MarketplaceService.PromptSubscriptionPurchaseFinished summary: | Fires when a purchase prompt for a subscription is closed. description: | 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 - `Class.MarketplaceService.PromptSubscriptionPurchase|PromptSubscriptionPurchase` to prompt a user to purchase a subscription. - `Class.Players.UserSubscriptionStatusChanged|UserSubscriptionStatusChanged`, which fires when the server recognizes that a user's membership has changed. code_samples: [] parameters: - name: user type: Player default: summary: | The `Class.Player` who received the prompt. - name: subscriptionId type: string default: summary: | The ID of the subscription with a status change. - name: didTryPurchasing type: boolean default: summary: | Whether the user attempted to purchase the subscription. tags: [] deprecation_message: '' security: None capabilities: - PromptExternalPurchase callbacks: - name: MarketplaceService.ProcessReceipt summary: | A callback to process receipts of developer product purchases. description: | `ProcessReceipt` is a callback to process receipts from [developer product purchases](../../../production/monetization/developer-products.md). You can sell developer products inside an experience using `MarketplaceService` functions, or outside an experience on the Store tab of your experience details page. You should only set the `ProcessReceipt` callback one time in a single server-side `Class.Script|Script`. This callback must handle the receipts for all developer products you have for sale. **IMPORTANT:** It's **highly recommended** that you properly implement the `ProcessReceipt` callback in order to sell your developer products. You should use `ProcessReceipt` to grant users their purchased product over any other granting method. If your `ProcessReceipt` implementation isn't correct, you will **not** be able to grant users the products they have purchased on the Store tab of your experience details page. #### Guarantees The `ProcessReceipt` callback is called for all unresolved developer product purchases when: - A user successfully completes the purchase of a developer product. - A successful developer product purchase prompt appears to the user. - A user joins the server. A purchase is considered **successfully initiated** when: - The purchase is processed on Roblox's backend. - The funds are placed in escrow. A purchase is considered **resolved** when: - The `ProcessReceipt` callback returns a `Enum.ProductPurchaseDecision` enum of `Enum.ProductPurchaseDecision.PurchaseGranted|PurchaseGranted`. - The purchase is successfully recorded on Roblox's backend. #### Unresolved Developer Product Purchases An **unresolved developer product purchase** takes place when a user's purchase of a developer product has not yet been acknowledged by the server through the `ProcessReceipt` function. Unresolved developer product purchases are not removed or refunded after the escrow period expires. #### Retries and Timeouts `ProcessReceipt` has no time-based retry mechanism. If a user makes a purchase that returns a `Enum.ProductPurchaseDecision` enum of `Enum.ProductPurchaseDecision.PurchaseGranted|NotProcessedYet`, the `ProcessReceipt` callback is only called again on the same server if: - The user successfully initiates another developer product purchase. - The user re-joins any server under the same experience. `ProcessReceipt` also has no timeout for yielded callbacks. A `ProcessReceipt` callback can yield for as long as the server is running, and the callback result is still accepted when the result returns. #### Limitations - If you don't implement a `ProcessReceipt` callback, your receipts will be auto-acknowledged. You can't get a receipt back after it has been acknowledged. - When there are multiple purchases pending for a user, `ProcessReceipt` callbacks are called in a non-deterministic order. - The user must be on the server for the `ProcessReceipt` callback to be invoked. - The user does not have to be on the server for the result of the `ProcessReceipt` callback to be recorded on the backend. - The `ProcessReceipt` callback for a specific purchase might run on two different servers at the same time if the user joins the second server before the callback returns on the first server. - The `ProcessReceipt` callback might still fail to be recorded on the backend, even if it returns a `Enum.ProductPurchaseDecision` enum of `Enum.ProductPurchaseDecision.PurchaseGranted|PurchaseGranted`. When this happens, the purchase remains unresolved. code_samples: - ProcessReceipt-Example parameters: - name: receiptInfo type: Dictionary default: summary: | The `receiptInfo` table passed to this callback contains the following data: - `PurchaseId` — A unique identifier for the specific purchase. - `PlayerId` — The user ID of the user who made the purchase. - `ProductId` — The ID of the purchased product. - `PlaceIdWherePurchased` — The place ID in which the purchase was made. Depending on where the user is during gameplay, the purchase place's ID can be the same as or different from the current place's ID. - `CurrencySpent` — The amount of currency spent in the transaction. - `CurrencyType` — The type of currency spent in the purchase; always `Enum.CurrencyType.Robux`. - `ProductPurchaseChannel` — How the user acquired the developer product. One of `Enum.ProductPurchaseChannel`. returns: - type: ProductPurchaseDecision summary: | An enum that represents how the developer product receipt was processed. - `PurchaseGranted`: - Indicates that the experience successfully granted the player the developer product. - Indicates to Roblox that the developer product sale was successful. - `NotProcessedYet`: - Indicates that the experience failed to grant the player the developer product. tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Monetization writeCapabilities: []