store.purchaseSubscription()

Type Function
Return value none
Revision Release 2024.3703
Keywords Google, IAP, in-app purchases, purchase
See also store.init()
store.*

Overview

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().

Gotchas

This call does not work for subscription purchases.

Syntax

store.purchaseSubscription( productIdentifier [, options] )
productIdentifier (required)

String. String representing the product identifier of the item to purchase.

options (optional)

Table. A table that specifies additional parameters of the purchase API call.

Options Reference

The options table contains details about the purchase request.

accountId (optional)

String. Specifies an optional string that is uniquely associated with the user's account in your app. This value would be obfuscated (SHA-256 hash) before sending to Google. For more details see documentation.

obfuscatedAccountId (optional)

String. Specifies an optional obfuscated string that is uniquely associated with the user's account in your app. If set, accountId would be ignored. For more details see documentation.

profileId (optional)

String. Specifies an optional string that is uniquely associated with the user's profile in your app. This value would be obfuscated (SHA-256 hash) before sending to Google. For more details see documentation.

obfuscatedProfileId (optional)

String. Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app. If set, profileId would be ignored. For more details see documentation).

offerPersonalized (optional)

Boolean. Specifies whether the offer is personalized to the buyer see documentation.

subscriptionUpdate (optional)

Table. Params used to upgrade or downgrade a subscription. documentation.

subscriptionUpdate Reference

purchaseToken (required)

String. Value which is Google Play Billing purchase token that the user is upgrading or downgrading from

prorationMode (required)

String. Specifies the Google Play Billing mode of proration during subscription upgrade/downgrade. Supported values for prorationMode: unknownSubscriptionUpgrade, deferred, immediateAndChargeFullPrice, immediateAndChargeProratedPrice, immediateWithoutProration, and immediateWithTimeProration. i.e {purchaseToken="abcd123",prorationMode="immediateWithoutProration" }