MarketplaceService
MarketplaceService : Instance
Overview
MarketplaceService is a service responsible for handling in-world purchases and processing delivery upon successful transactions
Creators must define the ProcessReceipt callback function to ensure deliveries are not omitted, and are responsible for using DataStore or similar to complete deliveries successfully.
Properties
Methods
GetProductInfo
Returns the product information corresponding to the product ID (productId) and product type (Enum.InfoType).
Parameters
number ProductId
Product Id
Enum.InfoType InfoType
Product Type
Return
Value
A dictionary containing product information
stringName: Product namestringDescription: Product descriptionnumberProductId: Product IdstringProductType: Product typenumberPriceInBLUC: Product pricenumberCreated: Product creation time (UNIX timestamp)numberUpdated: Product modification time (UNIX timestamp)
Code Samples
GetWorldProductsAsync
Returns a Pages Object containing information on all world products.
Parameters
Return
Pages
Code Samples
PromptProductPurchase
Request the purchase of the product corresponding to the product ID (productID). (Purchase window appears using the system UI.)
Parameters
Player Player
The player purchasing the product
number ProductId
World product Id
Return
void
Code Samples
Events
PromptProductPurchaseFinished
This event is triggered when the purchase window, opened via request Purchase (PromptProductPurchase), is closed. If the purchase is successful, "true" will be sent to isPurchased; if the user cancels or the purchase fails, "false" will be sent to isPurchased.
This event should only be used to detect whether the purchase window is closed. It must never be used to process the deliver of purchased products.
Parameters
string UserId
The UserId of the player requesting the purchase
number ProductId
Product Id of the purchase request
bool bIsPurchased
Purchase success status
Code Samples
Callback
ProcessReceipt
Trigger the event that returns undelivered receipt information from successfully purchased products.
Trigger Conditions
When a world product is successfully purchased (the successful purchase popup is shown to the user),
if there are any undelivered products, those previous pending items will also be triggered together when the new purchase is made.
When the user connects (or reconnects) to the server
How to Update Delivery Status
After successfully delivering the product, return Enum.ProductPurchaseDecision.PurchaseGranted.
Important Notes
The ProcessReceipt event should be connected only once in a server-side script.
This callback can yield indefinitely and remains valid until it receives a response, as long as the server is running.
If there are multiple undelivered receipts, each one will be triggered individually, and the order of these callbacks is non-deterministic.
The callback will only be triggered when the user is present on the server.
However, the result of the callback may still be recorded on the backend even if the user is no longer on the server.
Returning PurchaseGranted from the callback does not guarantee that the backend will successfully record it. In such cases, the receipt status remains unchanged (remains undelivered).
Products in an undelivered state will have their funds held in an Escrow state.
Parameters
table Receipt
The dictionary containing receipt information of purchased products
stringPurchaseId: Receipt IdstringPlayerId: Player's UserIdnumberProductId: Product IdnumberCurrencySpent: Amount of currency usednumberPurchaseDateTime: Time of purchase (UNIX timestamp)
Return
Enum.ProductPurchaseDecision
World product delivery status
PurchaseGranted: Product successfully delivered to the player
NotProcessedYet: Product not yet delivered
Code Samples
See also
World Product SalesLast updated