ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / In-App Purchase functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Used to consume, in an application, a product that was previously purchased by the user. Once consumed, the product will be made available for another purchase.
Reminder: In Android, you cannot purchase a product that was already purchased by the user. The product must be consumed before it can be purchased again.
Example
// Asks to purchase a product
inAppPurchaseProduct(MyProduct, PurchaseProduct)
PROCEDURE PurchaseProduct(bSuccess is boolean, Product is inAppProduct, PurchaseID)
IF NOT bSuccess THEN
ToastDisplay(ErrorInfo())
ELSE
// Consume the product
inAppPurchaseProduct(Product, PurchaseID, ConsumeProduct)
END
PROCEDURE ConsumeProduct(bSuccess is boolean)
IF not bSuccess THEN
ToastDisplay(ErrorInfo())
ELSE
// Consume the product in the application
...
END
Syntax
<Result> = inAppConsumeProduct(<Product to consume> , <Purchase identifier> , <WLanguage procedure>)
<Result>: Boolean
  • True if the request for product consumption was performed,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Product to consume>: Character string or inAppProduct variable
  • Identifier of the product to the consume,
  • Name of inAppProduct variable corresponding to the product to consume.
<Purchase identifier>: Character string
Purchase identifier of product to the consume. This identifier is received when purchasing a product with inAppPurchaseProduct. It can also be retrieved by inAppListPurchase.
<WLanguage procedure>: Procedure name
Name of WLanguage procedure ("callback" procedure) run when receiving the response to the request for product consumption. This procedure has the following format:
PROCEDURE <Procedure Name>(<Success> is boolean)
<Success> is boolean:
  • True if the product was consumed,
  • False otherwise. To get more details on the error, use ErrorInfo before any other call to a WLanguage function (this would reinitialize the error).
Remarks
  • inAppListPurchase is used to retrieve the products purchased by the user and not consumed yet.
  • inAppConsumeProduct has no effect if it is run from the Android simulator or emulator.
  • You cannot consume a subscription.
Component: wd290android.jar
Minimum version required
  • Version 19
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help