PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Characteristics of WLanguage procedure
  • Special cases
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sends:
  • a request for purchasing an "In-App" product associated with the application.
  • Versions 23 and later
    a request for purchasing a subscription.
    New in version 23
    a request for purchasing a subscription.
    a request for purchasing a subscription.
Remark: The purchase request is asynchronous. A "Callback" procedure is run when receiving the response to the purchase request.
Example
MonProduit is inAppProduct = tabProduit[nIndex]
inAppPurchaseProduct(MonProduit, ValideAchatProduit)
PROCÉDURE ValideAchatProduit(bSuccès is boolean, Produit is inAppProduct, Reçu)
 
IF NOT bSuccès THEN
ToastDisplay(ErrorInfo())
RETURN
ELSE
// Cas Android
IF InAndroidMode() THEN
// Consommation du produit (optionnel)
inAppConsumeProduct(Produit, Reçu, ConsommationProduit)
END
// Cas iOS
IF IniOSMode() THEN
// Activation du produit dans l'application
ActiveProduit(Produit)
// Mémorisation de l'achat dans les préférences de l'application
SaveParameter(Produit.Identifier, 1)
END
END
Syntax
iPhone/iPad

iOS: Sending a purchase request Hide the details

<Result> = inAppPurchaseProduct(<Product to purchase> , <Quantity> , <WLanguage procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To get the details of the error, use ErrorInfo.
<Product to purchase>: inAppProduct variable
Name of inAppProduct variable corresponding to:
  • the product to purchase.
  • Versions 23 and later
    the subscription to purchase or to renew.
    New in version 23
    the subscription to purchase or to renew.
    the subscription to purchase or to renew.
<Quantity>: Integer
Quantity to purchase.
  • Versions 23 and later
    For a subscription, this parameter must correspond to 1.
    New in version 23
    For a subscription, this parameter must correspond to 1.
    For a subscription, this parameter must correspond to 1.
  • If the value of this parameter is equal to 0, <Result> is set to False and the procedure is not called.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "callback") executed when the purchase request response is received. For more details, see the Remarks section of the help page.
Android

Android: Sending a purchase request Hide the details

<Result> = inAppPurchaseProduct(<Product to purchase> , <WLanguage procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To get the details of the error, use ErrorInfo.
<Product to purchase>: inAppProduct variable
Name of inAppProduct variable corresponding to:
  • the product to purchase.
  • Versions 23 and later
    the subscription to purchase or to renew.
    New in version 23
    the subscription to purchase or to renew.
    the subscription to purchase or to renew.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "callback") executed when the purchase request response is received. For more details, see the Remarks section of the help page.
Remarks

Characteristics of WLanguage procedure

The procedure <WLanguage procedure> must be in the following format:
PROCEDURE <Nom de la procédure>(<Succès> est un booléen, <Produit> est un inAppProduit,
<Reçu>, <Quantité> est un entier)
where:
  • <Success> is boolean:
    • True if the purchase was validated,
    • False otherwise. To get the details of the error, use ErrorInfo before any other call to a WLanguage function (this would reinitialize the error). The ErrorInfo function used with the errCode constant gives one of the following error codes:
      inAppCancelationPurchase canceled by the user.
      inAppUnknownErrorUnknown error.
      inAppSignatureErrorError while checking the data signature received for the purchase validation (security problem).
      inAppInvalidResponseInvalid response.
  • <Product> is an inAppProduct variable corresponding to the product or subscription that was purchased.
  • <Receipt> :
    • 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> is an integer corresponding to the quantity of products purchased.
    • Versions 23 and later
      iPhone/iPad For a subscription, this parameter is always set to 1.
      New in version 23
      iPhone/iPad For a subscription, this parameter is always set to 1.
      iPhone/iPad For a subscription, this parameter is always set to 1.
    • Android This parameter is always set to 1.

Special cases

  • If the purchase is valid, the application must supply the purchase content to the user.
  • iPhone/iPad If the purchase was performed, the application must store this information. This information can be stored in the preferences by SaveParameter.
  • Versions 23 and later
    If inAppPurchaseProduct is used to purchase a subscription that is already active for the user, this subscription is automatically extended for the corresponding period.
    New in version 23
    If inAppPurchaseProduct is used to purchase a subscription that is already active for the user, this subscription is automatically extended for the corresponding period.
    If inAppPurchaseProduct is used to purchase a subscription that is already active for the user, this subscription is automatically extended for the corresponding period.
  • Android You cannot purchase a product that was already purchased by the user. The product must be consumed (with inAppConsumeProduct) before it can be purchased again.
    inAppListPurchase is used to retrieve the products purchased by the user and not consumed yet.
  • Android You cannot specify the quantity of products to purchase. You must create products corresponding to the desired quantity in the Google Play developer console. Then, the application must manage the use of the purchased quantities.
  • Android You cannot perform several requests for purchase at the same time. You must wait for the response to a request before performing a new request.
  • Android inAppPurchaseProduct has no effect if it is run from the Android simulator or emulator.
Versions 25 and later
Android

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
inAppPurchaseProduct can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
New in version 25
Android

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
inAppPurchaseProduct can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Android

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
inAppPurchaseProduct can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd260android.jar
Minimum version required
  • Version 19
Comments
Click [Add] to post a comment