Skip to main content

Commerce.Product

Class

Contains all the essential details about an item available for purchase in a Lens.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported — Available on SPECS only
  • SPECSFully supported
  • Camera Kit WebNot supported — Available on SPECS only
  • Camera Kit MobileNot supported — Available on SPECS only

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Contains all the essential details about an item available for purchase in a Lens. When products are queried, these objects are received, which include information like the product's unique ID, its type (e.g., a non-consumable), its display name, a description, and its price. This information is crucial for presenting products to users in a Lens's store or interface.

Index

Extends

Constructors

Constructor

new Product(id, type, displayName, description, price, iconUri?, extras?): Product

Parameters

ParameterType
idstring
typeProductType
displayNamestring
descriptionstring
pricePrice
iconUri?string
extras?string

Returns

Product

Overrides

ScriptObject.constructor

Properties

description

readonly description: string

SPECS

A brief explanation of what the product is, its features, or its benefits. This text helps users understand what they are buying before they make a purchase.


displayName

readonly displayName: string

SPECS

The name of the product as it will appear to users in the store or within your Lens. It should be clear and appealing.


extras

readonly extras: string

SPECS

Allows you to include any additional information or custom data related to the product. It can be used to store JSON-encoded strings with extra metadata that is not covered by the other standard fields. This is useful for flexible product configurations or displaying unique product attributes within your Lens.


iconUri

readonly iconUri: string

SPECS

An optional field that provides a URI to an image file that can serve as an icon for the product. It's typically used to display a visual representation of the product within a store interface or other UI elements, helping users quickly identify and differentiate items.


id

readonly id: string

SPECS

A unique identifier for the product of the Lens. This is a crucial piece of information for referencing the product within the commerce system and for internal tracking.


price

readonly price: Price

SPECS

The cost of the product, provided as a Price object. This object holds the price as a standard decimal value, along with currency and country codes, ensuring accurate and properly formatted display of prices to users.


subscriptionOfferDetails

readonly subscriptionOfferDetails: SubscriptionOfferDetails[]

SPECS

The subscription offers available for this product. Contains one or more entries for ProductType.Subscription products and is null for other product types.

Since

Lens Scripting Version 377


type

readonly type: ProductType

SPECS

Specifies the category of the product, which impacts how it behaves in the store.

Methods

getTypeName()

static getTypeName(): TypeName<Product>

SPECS

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<Product>

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame