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
WLanguage procedure called by inAppPurchaseProduct
Procedure ("Callback") called by inAppPurchaseProduct when the response to the purchase request is received. This procedure can be a local, global or internal procedure.
Example
MyProduct is inAppProduct = arrProduct[nIndex]
inAppPurchaseProduct(MyProduct, ValidateProductPurchase)
PROCÉDURE ValidateProductPurchase(bSuccess is boolean, Product is inAppProduct, Receipt)
 
IF NOT bSuccess THEN
ToastDisplay(ErrorInfo())
RETURN
ELSE
// Android case
IF InAndroidMode() THEN
// Consume the product (optional)
inAppConsumeProduct(Product, Receipt, ConsumeProduct)
END
// iOS case
IF IniOSMode() THEN
// Activate the product in the application
EnableProduct(Product)
// Save the purchase in the application preferences
SaveParameter(Product.Identifier, 1)
END
END
Syntax
inAppPurchaseProduct_Callback(<Success> , <Product> , <Received> , <Quantity>)
<Success>: Boolean
  • True if the purchase was validated,
  • False otherwise. To get more details on the error, use ErrorInfo before any other call to a WLanguage function (this would reinitialize the error). ErrorInfo associated with the errCode constant returns one of the following error codes:
    inAppCancellationPurchase canceled by the user.
    inAppInvalidResponseInvalid response.
    inAppSignatureErrorError while checking the data signature received for the purchase validation (security problem).
    inAppUnknownErrorUnknown error.
<Product>: inAppProduct variable
inAppProduct variable that corresponds to the product or subscription purchased.
<Received>: Character string
  • iPhone/iPad <Receipt> is not available. To validate a purchase, you must use inAppListPurchase and make sure the purchase is in the list.
  • Android <Receipt> is a character string corresponding to the purchase identifier. Then, this identifier can be used to consume the product that was purchased (inAppConsumeProduct).
<Quantity>: Integer
Quantity of products purchased.
  • iPhone/iPad For a subscription, this parameter is always set to 1.
  • Android This parameter is always set to 1.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment

Last update: 06/30/2023

Send a report | Local help