Skip to main content

Commerce.ClientOptions

Class

Specifies the configuration for creating a commerce client.

  • 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.

Specifies the configuration for creating a commerce client. It defines important behaviors and callback functions, such as the onPurchasesUpdated, which is essential for receiving real-time notifications about the status of user purchases.

Index

Extends

Constructors

Constructor

new ClientOptions(onPurchasesUpdated): ClientOptions

Parameters

ParameterType
onPurchasesUpdated(result, purchases) => void

Returns

ClientOptions

Overrides

ScriptObject.constructor

Properties

extras

extras: string

SPECS

An optional field that intended for advanced configuration of the CommerceKit client and is not recommended for general developer use. It accepts a JSON-formatted string to allow for flexible customization of the commerce module's behavior, primarily through various settings or extra data, to meet specific internal requirements or features.

Default Value

null
@snapOS

onPurchasesUpdated

onPurchasesUpdated: (result, purchases) => void

SPECS

Essential for receiving real-time updates on the status of user purchases. It is invoked when a purchase is completed, cancelled, or encounters an error, allowing your Lens to react appropriately (e.g., granting access to a purchased item or displaying an error message). The result parameter provides a summary of the outcome, and the optional purchases array contains details of the transactions if successful.

Parameters

ParameterType
resultPurchaseResult
purchasesPurchase[]

Returns

void

Default Value

null
@snapOS

Methods

getTypeName()

static getTypeName(): TypeName<ClientOptions>

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<ClientOptions>

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