CommerceService

Show Deprecated
Not Creatable
Service

CommerceService is a service that supports real-world purchases that you can bundle with virtual items. For information on eligibility and implementation, see Commerce products.

Summary

Methods

Events

Properties

Methods

PromptCommerceProductPurchase

()

Prompts a user to purchase a commerce product using the provided commerceProductId. Opens a webview that guides the user through the purchasing flow.

Parameters

user: Player
Default Value: ""
commerceProductId: string
Default Value: ""

Returns

()

PromptRealWorldCommerceBrowser

()

This is a legacy endpoint that is not meant for use. To open the webview to the purchasing flow for real world commerce, see CommerceService:PromptCommerceProductPurchase(). For more information, see Commerce products

Parameters

player: Player
Default Value: ""
url: string
Default Value: ""

Returns

()

GetCommerceProductInfoAsync

Yields

Retrieves information about the products that you are selling and surface them within your experience. How you surface products to your users is entirely up to you.

NamestringLocalized name of of the physical item
DescriptionstringLocalized description of the physical item
IconImageAssetIdnumberThe image asset id of main default image of the physical item
DisplayPricestringLocalized price string with currency symbol of the physical item. e.g. “$4.99“
IsPurchasableboolIf the item can be added to a merchant checkout session, i.e. item is in stock, or can be backordered

Parameters

commerceProductId: string
Default Value: ""

Returns

UserEligibleForRealWorldCommerceAsync

Yields

This is a legacy endpoint that is not meant for use. To check if a user is eligible for real world commerce, see PolicyService.IsEligibleToPurchaseCommerceProduct. For more information, see Commerce products


Returns

Events

PromptCommerceProductPurchaseFinished

Use this signal to detect when a user has completed the purchasing flow and the webview has closed to resume gameplay within the experience. This signal does not indicate a successful purchase, so do not grant virtual items solely from this signal.

While optional, it is recommended to use this signal to reorient your users on Android, as the commerce purchasing flow will have forced them into portrait mode.

Parameters

user: Player
productId: string