Skip to main content

Commerce

Namespace

Namespace in the Lens Scripting API.

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

Enumerations

EnumerationDescription
ProductTypeDefines the type of product that can be purchased in a Lens.
PurchaseStateRepresents the state of a purchase in a Lens.
RecurrenceModeDescribes how a subscription pricing phase repeats over time.
ResponseCodeDefines the possible outcomes of a purchase attempt in a Lens

Classes

ClassDescription
ClientThe primary interface for interacting with the commerce system within a Lens. Once built and configured using the CommerceKitModule, its methods are used to perform all key commerce operations. This includes initiating connections to the payment service, querying details about products, launching purchase flows for users, checking a user's purchase history, and acknowledging completed purchases.
ClientOptionsSpecifies 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.
PriceRepresents the price of a product in a Lens.
PricingPhaseDescribes one phase of a subscription offer's pricing schedule, such as a free trial, an introductory price, or the regular recurring price. Phases apply in the order they are provided.
ProductContains 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.
PurchaseRepresents a completed or pending transaction for a product. When a user buys something, or when their purchase history is retrieved, Purchase objects are received. These objects contain important details like the unique ID of the purchase, the ID of the product that was bought, when the purchase occurred, and its current state (e.g., purchased, pending, or invalidated).
PurchaseResultProvides an immediate summary of the outcome of a purchase attempt. It indicates whether the transaction was successful, canceled by the user, or if an error occurred. This is the first place to look to understand the immediate result of a purchase flow.
SubscriptionOfferDetailsDescribes a specific offer for a subscription product, such as a base plan or a promotional plan with a trial. A single subscription product can expose multiple offers through Product#subscriptionOfferDetails.