ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Mobile specific functions / In-App Purchase functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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 Under Android, it is not possible to buy a product that the user has already purchased. The product must be consumed before it can be purchased again.
Example
// Demande l'achat d'un produit 
inAppPurchaseProduct(MonProduit, AchatProduit)
PROCEDURE AchatProduit(bSuccès is boolean, Produit is inAppProduct, IDAchat)
IF NOT bSuccès THEN
	ToastDisplay(ErrorInfo())
ELSE
	// Consommation du produit
	inAppConsumeProduct(Produit, IDAchat, ConsommationProduit)
END
PROCEDURE ConsommationProduit(bSuccès is boolean)
IF NOT bSuccès THEN
	ToastDisplay(ErrorInfo())
ELSE
	// Consommation du produit dans l'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 the 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 the WLanguage procedure (also called "callback") executed when the response to the product consumption request is received. 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: wd300android.jar
Minimum version required
  • Version 19
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help