# 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. |
| 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. |
| 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. |
||
| 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. |
| 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). |
||
| 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). |
||
| 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. |
||
| 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. |
| 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. |
| 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.
|
| 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.
|
| Key | Value |
|---|---|
CycleStartTime |
... |
CycleEndTime |
August 31, 2023 |
PaymentStatus |
Enum.SubscriptionPaymentStatus.Paid |
| Key | Return |
|---|---|
IsSubscribed |
True |
IsRenewing |
True |
| 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. |
| 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. |