Type Function Return value none Revision Release 2026.3728 Keywords Samsung, IAP, in-app purchases, purchase See also store.init() store.consumePurchase() store.acknowledgePurchase() store.*
Initiates a purchase transaction on a provided product by sending out a purchase request to the store, then dispatches a storeTransaction event to the listener defined in store.init(). Consumable items, non-consumable items and subscriptions can all be purchased with this function.
After the "purchased" event, grant the item to the user and then call store.consumePurchase() (consumable items) or store.acknowledgePurchase() (non-consumable items and subscriptions) with the purchaseId of the transaction.
Samsung IAP processes one request at a time; do not start another purchase before the event of the previous one arrived.
store.purchase( productIdentifier [,options] )
String. String representing the product identifier of the item to purchase.
Table. A table with the following optional keys:
obfuscatedAccountId — A string (up to 64 bytes) that identifies the user’s account in your app, for example a SHA-256 hash of the account name. Samsung uses it for fraud detection and returns it in the purchase, in store.restore() results and in receipts. Never pass the plain account name.
obfuscatedProfileId — A string (up to 64 bytes) that identifies the user’s profile in your app, obfuscated like obfuscatedAccountId. Requires obfuscatedAccountId.
passThroughParam — A string (up to 255 bytes) that is attached to the transaction and returned in the passThroughParam field of the purchase. Deprecated by Samsung since IAP SDK 6.4 in favor of the obfuscated identifiers; it is ignored when obfuscatedAccountId or obfuscatedProfileId is set.
For backwards compatibility, a string can be passed instead of the table; it is used as passThroughParam.
-- Consumable item
store.purchase( "com.mycompany.mygame.coins100" )
-- Subscription, tagged with the (hashed) account of the signed in user
store.purchase( "com.mycompany.mygame.premium.monthly", {
obfuscatedAccountId = hashedAccountId,
} )