Property Documentation

The androidPublicKey property is mandatory if you want to use in-app purchases on Google Play Store.

Every app on Google Play Store has a unique public key for communication between the app and Play Store. To find the public key, open your application's details in your Developer Console after uploading a draft apk, then
click on Services & APIs, and look at the field titled Your License Key for This Application. For more information have a look at Getting an app's license key.

Currency packs are collections you can offer your users to buy a certain amount of your in-game currencies. You need at least one currency and one currency pack defined to be able to offer virtual purchases.

You define your virtual currencies packs like the following example. For more information have a look at CurrencyPack item.

The goods property holds all virtual goods you want to offer within your game. Depending on your store design goods can either be purchased with virtual currency (VirtualPurchase) or from the platform's stores directly (StorePurchase).

The secret property is used to encrypt the purchase and inventory data stored locally on the device. Be sure to set the secret only once per app and don't change it while running your game and after publishing
your app (and updates), otherwise all purchased items from your user get lost.

Be sure to keep your game's secret in private. The property is mandatory.

A boolean read-only flag holding the state if billing (in-app purchases in general) is supported on the currently used device.

Possible reasons for unsupported devices are for example an unsupported platform (e.g. the current device is MeeGo powered), activated parental control (iOS) or an outdated Google Play app on Android. If supported is
false calls involving StorePurchase items won't succeed, you then could inform the user that his device is currently not able to perform in-app purchases.

Bump the version every time you make changes to your game's assets to overwrite the old settings. Like changes to secret, version changes will delete all user items
stored locally, so don't change it while running your game and after publishing your app unless you have to do so.

If you omit this property a default value of 1 is used.

Signal Documentation

This handler is called when the balance of a currency given with the itemId parameter changes. The amountAdded parameter describes the positive (when added) or negative (when subtracted) change of the
balance.

Note: In most cases the usage of the Currency::balance property is preferable over the usage of this signal in order to retrieve the current balance of a given
Currency, as you can then benefit from the advantages of QML property bindings.

This handler is called when the balance of a good item given with the itemId parameter changes. The amountAdded parameter describes the positive (when added) or negative (when subtracted) change of the
balance.

Note: In most cases the usage of the good's balance property is preferable over the usage of this signal in order to retrieve the current balance of a given Currency, as you can
then benefit from the advantages of QML property bindings.

This handler is called whenever a purchase of an item with VirtualPurchase type failed because the user's payment item balance is not sufficient. For example, you can then give the
hint that new credits can be purchased:

This handler is called whenever an item with StorePurchase or VirtualPurchase type was purchased successfully. If the purchase is of type
StorePurchase the signal storePurchased also gets emitted, so make sure to prevent certain actions from performing twice after a
purchase.

This handler is called right after restoreAllTransactions finished. You can use it to hide a status indicator as long as the user's transactions are loaded.

The success parameter indicates if the restoreAllTransactions was successful or not. If the restore operation was successful this would be the right
place to re-download content of a LifetimeGood or update the game's UI.

This handler is called whenever a user cancels the purchase of an item with type StorePurchase. This may happen if the user selects the cancel button of the platform's store overlay
or no valid payment options are given.

This handler is called whenever a user starts a purchase of an item with type StorePurchase. This implies usually that the platform's store overlay is shown and asks the user for a
valid store account.

This handler is called whenever an item with StorePurchase type was purchased successfully. Whenever this signal is emitted the signal itemPurchased also gets emitted, so make sure to prevent certain actions from performing twice after a purchase.

On iOS, the additional parameter transactionData contains information about the payment transaction. The information is forwarded from SKPaymentTransaction. It is a JSON map with the following entries:

receiptBase64: Payment receipt data encoded in Base64.

transactionIdentifier: A string that uniquely identifies a successful payment transaction.

transactionDate: The date the transaction was added to the App Store’s payment queue as a string formatted MM/dd/YYYY.

originalTransactionIdentifier: A string that uniquely identifies a payment transaction that was restored by the App Store.

originalTransactionDate: The date the restored transaction was added to the App Store’s payment queue as a string formatted MM/dd/YYYY.

Returns the balance of the an item with the given itemId. Keep in mind that only items of type Currency, LifetimeGood and SingleUseGood have a meaningful balance. You can also use the item's balance property to retrieve the balance of the specific item

Use this method to export CSV data sets for importing to the specific platform stores.

In order to be able to use in-app purchases on Google Play and iOS App Store you have to define the in-app products beforehand in the platform developer consoles. This is a tedious process as you generally have to define
at least a name, description and item id for each platform separately.

To improve this step you can use printStoreProductLists() to print a corresponding CSV list which you then can save into a text file and import to the specific platform stores.

Note: You are not required to use the output of this function, it's only meant to make publishing your game a lot easier.

Calling this method makes only sense if you've defined the itemId, name, description and price properties in your virtual items which are encapsulated by a StorePurchase item. Here
is an example:

On iOS the productId must be unique across all in-app purchases and uploaded apps. It's therefore best practice to prepend the productId with your game's package identifier (like
net.vplay.plugins.SoomlaSample). Please also keep in mind that the productId may only contain alphanumeric characters, underscores, and periods.

Add ascreenshot for review for each of your in-app products. These screenshots should show where and how you use the in-app purchases in you app, they are only for the Apple Review Team and therefore never publicly
shown withtin the App Store.

Adapt the other settings to your need and then select the "Delivery2 tab and click the "Deliver" button.

Google Play

Copy the text block below "Google Play CSV file:" into a text file.

Open the Google Play Developer Console, select your app, open the "In-App Products" tab.

Click the "Import/Export" button and import the created text file. You can then further adapt the settings of your in-app products.

Note: You need to upload a draft apk with "BILLING" permissions set before being able to define in-app products first.

You can then check your in-app purchases online and further adapt the settings to your needs.

Note: This method only supports consumable and non-consumable purchases. It currently does not support exporting subscriptions (goods with StorePurchase::isSubscription of true). You can define subscriptions manually in the app store backends.

Usually this call happens automatically at the app start. In some cases this automatic call can fail, for example if there is no internet connection. You can then use this method to retry loading the details.