Commerce.Purchase
ClassRepresents a completed or pending transaction for a product.
- 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
Represents 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).
Index
Properties
Methods
Extends
Properties
expiryTime
readonlyexpiryTime:number
SPECS
For subscription purchases, the end of the current billing period in milliseconds since the Unix epoch. Not set for non-subscription purchases.
Since
Lens Scripting Version 377
isAcknowledged
readonlyisAcknowledged:boolean
SPECS
Indicates whether this purchase has been acknowledged via Client#acknowledgePurchase.
Since
Lens Scripting Version 377
isAutoRenewing
readonlyisAutoRenewing:boolean
SPECS
Indicates whether a subscription purchase renews automatically at the end of the current billing period. Always false for non-subscription purchases.
Since
Lens Scripting Version 377
productId
readonlyproductId:string
SPECS
The unique identifier for the product that was purchased. It's the same ID you use to identify the product in the store or when querying for product details.
purchaseState
readonlypurchaseState:PurchaseState
SPECS
Indicates the current status of the transaction.
purchaseTime
readonlypurchaseTime:number
SPECS
Represents the exact moment the purchase was made, measured as the number of milliseconds since January 1, 1970, UTC (Unix epoch time). This timestamp is crucial for tracking purchase dates, managing subscriptions, and for reconciliation purposes.
token
readonlytoken:string
SPECS
A unique identifier generated by the payment system for the order. It can be useful for linking purchases to specific order records in your backend or for support purposes.
Methods
getTypeName()
staticgetTypeName():TypeName<Purchase>
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<Purchase>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
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
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean