StoreManager external objectOfficial Content
Note: This document applies for GeneXus 15 Upgrade 3. Those developers who use previous upgrades must refer to previous version of this document.

StoreManager External Object is a component of the GeneXus Smart Devices API which allow the developers to manage In-App Purchases in their applications.

StoreAPIEO - GeneXus 15 as of Upgrade 3
 

Properties

CanMakePurchases

Allow the developer to know if the device can make purchases. For example, it can be used to restrict purchases if the device does not admit them.

Return value Boolean

 

Methods

GetProducts

Given a list of products, returns a collection with detailed information about them. Useful to get the title in the user local language and the price in the user local currency.

Return value StoreProduct
Parameters ProductIdentifications:Collection<VarChar(100)>

PurchaseProduct

Sends the purchase request of the given product to the platform In-App Purchases store.

Return value PurchaseResult
Parameters ProductIdentifier:VarChar(100) [, Quantity:Numeric(8.0)]

Note: On Android, the Quantity parameter only accepts the value 1 because every product can be purchased or not purchased.

GetPurchases

Gets a list of information of the user's purchased products.

Return value PurchasesInformation
Parameters None

ConsumeProduct

Consume a product for which the user has a purchase and returns the success status.

Return value Boolean
Parameters ProductIdentifier:VarChar(100)

RestorePurchases

Only available for iOS. Restore the purchases through the device.

Return value PurchasesInformation
Parameters None

 

Events

PurchaseStateChange

This event only applies to iOS. When a purchase is made, this event will be called indefinitely with the Handled parameter in False until the developer assigns it in True.
The reason for this behavior is that iOS does not persist the information of a purchase (as Android does) when the product type is consumable. A typical scenario might occur when the app crash before without the response of the store platform after a transaction request. In such case, the purchase can be processed when the app is opened again.
It's the responsibility of the developers to persist in their systems the user status in relation to the billings (in replacement of EnableProduct or DisableProduct deprecated methods --- see the previous version of this document for details).

Parameters Purchase:PurchaseResult, PurchaseState:StorePurchaseState, Handled:Boolean

Note: Only available for iOS (1).

 

Domains

StorePurchaseState

Set of state values of a purchase. Only applies for iOS (in ).

  Value Description
  Purchasing When the purchase begins.
  Purchased When the purchase was successful.
  Failed When the purchase fails.
  Restored When the purchases are restored.
  Deferred When the purchase depends on parental control.

StorePurchasePlatform

Store platforms where the purchase was made.

  Value Description
  GooglePlay Google Play (for Android) as store platform.
  iTunes iTunes (for iOS) as store platform.

StoreProductType

Nature of the purchased product.

  Value Description
  Subscription The purchase is a subscription.
  Product The purchase is a product.

StorePurchaseStatus

Status of a purchase after it has been validated with the platform stores (Google/Apple).

  Value Description
  Invalid The purchase is invalid.
  Valid The purchase is valid.
  Expired Indicate if the purchase of a subscription has been expired.
  Cancelled On iOS indicate if the purchase has been cancelled by the Apple Store Support Team.
On Android, if the purchase has been cancelled by the user, or if the purchase is a subscription cancelled by the system (e.g. billing problem)  
  Deferred The purchase is waiting for validation of parental control.

 

Structured Data Types

PurchaseResult

PurchaseResult - GX15

  Field Domain Description
  Success  Boolean Indicates if the purchase process was successfully completed.
  PurchaseId VarChar(100) Purchase identifier from the platform store.
  PurchasePlatform  StorePurchasePlatform  Store platform where the purchase was made.
  ProductIdentifier   VarChar(100)  Purchased product identifier.
  TransactionData VarChar(100) Encrypted data of the purchase transaction.

PurchaseInformation

PurchaseInformation - GX15

Given a platform store, it keeps the information of a collection of purchases.

  Field Domain Description
  Purchases Collection Collection of purchase result for each product queried.
    Item PurchaseResult  
  Receipt LongVarChar(2M) Receipt information retrived from Apple.
  PurchasePlatform  StorePurchasePlatform  The store platform where the purchase was made.

StoreProduct

StoreProduct - GX15

  Field Domain Description
  LocalizedTitle  VarChar(100)   Product title in the user local language.
  LocalizedDescription  VarChar(100) Product description in the user local language.
  LocalizedPriceAsString  VarChar(100) String with the product price indicated in the user local currency.
  Identifier  VarChar(100) Product identifier.
  Purchased  Boolean Indicates if the product has been purchased by the user.

 

Notes

  • The concept of "enable a product" introduced in the PurchaseStateChange event section is only applicable for iOS that manages the purchases on the client-side. Android, on the other hand, centralizes the purchases on the Google Play's servers and it only notices when a product was purchased or not. For example, the "enable" concept allows the developer to implement a gift-mechanism on the device (i.e. under certain conditions, it is possible to enable a product for free). The same scenario on Android can be solved from the Google Play's console using In-app Promotion codes.
  • In order to simulate the "deferred" state in iOS, the developer can add the GXSimulateAskToByInSandbox key into the generated project adopting boolean value.
    A typical scenario is when the app is installed in a children's device and the developer uses Progress.Show() while the purchase is being validated. If the parent takes a long time to validate or reject the request of its child, the progress status will be displaying indefinitely. 

 

Scope

Objects Panel for Smart DevicesWork With for Smart Devices 
SD Generators iOS, Android
Languages .NET, Java

 

Availability

This API is available as from GeneXus 15 Upgrade 3



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.