PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Characteristics of WLanguage procedure
  • Special cases
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.
Note: The purchase request is asynchronous. A "Callback" procedure is run when receiving the response to the purchase request.
Example
MyProduct is inAppProduct = arrProduct[nIndex]
inAppPurchaseProduct(MyProduct, ValidateProductPurchase)
//-------------------------------------------
PROCEDURE 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(sProduct, Received, ConsumeProduct)
END
// iOS case
IF IniOSMode() THEN
// Activate the product in the application
EnableProduct(Product)
// Stores the purchase in the preferences of the application
SaveParameter(Product..Identifier, 1)
END
END
Syntax
iPhone/iPad

iOS: Sending a purchase request Hide the details

<Result> = inAppPurchaseProduct(<Product to Purchase> , <Quantity> , <Procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To find out the error details, 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.
<Procedure>: Character string (with or without quotes)
Name of WLanguage procedure ("callback" procedure) run when receiving the response to the purchase request. See the Notes paragraph in the help page for more details.
Android

Android: Sending a purchase request Hide the details

<Result> = inAppPurchaseProduct(<Product to Purchase> , <Procedure>)
<Result>: Boolean
  • True if the purchase request was performed,
  • False otherwise. To find out the error details, 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.
<Procedure>: Character string (with or without quotes)
Name of WLanguage procedure ("callback" procedure) run when receiving the response to the purchase request. See the Notes paragraph in the help page for more details.
Remarks

Characteristics of WLanguage procedure

<Procedure> must have the following format:
PROCEDURE <Procedure Name>(<Success> is boolean, <Product> is inAppProduct,
<Receipt>, <Quantity> is int)
where:
  • <Success> is boolean:
    • True if the purchase was validated,
    • False otherwise. To retrieve the error details, use ErrorInfo before any other call to a WLanguage function (that would reinitialize the error). ErrorInfo associated with the errCode constant returns 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 that was purchased.<Product> is an inAppProduct variable corresponding to the product or subscription that was purchased.
  • <Receipt> :
    • iPhone/iPad <Receipt> is a buffer containing the receipt of purchase. Then, this receipt can be used to perform additional security checks toward the Apple store.
      Reminder: To validate a purchase, we advise you to use inAppListPurchase and to check whether the purchase is found 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 from 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 from the corresponding period.
    If inAppPurchaseProduct is used to purchase a subscription that is already active for the user, this subscription is automatically extended from 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 in the Google Play developer console products corresponding to the requested quantity. 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.
  • Android inAppPurchaseProduct is available on the devices running Android version 2.2 or later (api level 8).
    A fatal error will occur if the function is used with an earlier system version.
    To find out the version of Android system on which the application is run, use SysAndroidVersion.
Components
Android wd230android.jar
Minimum required version
  • Version 19
Comments
Click [Add] to post a comment