PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Principle
  • Specific features for iOS
  • Specific features for Android
  • Implementation
  • iOS application
  • Android application
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
Overview
The mobile systems (Android/iOS) allow their applications to propose content at extra cost, by using the payment system of App Store or Google Play.
This process is used to create for example:
  • applications with extensions at extra cost.
  • applications proposing products at extra cost (e-books, etc.).
  • Versions 23 and later
    applications proposing a subscription to content or to services.
    New in version 23
    applications proposing a subscription to content or to services.
    applications proposing a subscription to content or to services.
This help page describes the mechanisms used in WINDEV Mobile to enable the management of content at extra cost ("In-App" purchase) in your applications.
Principle
The steps for performing an "In-App" purchase in an Android or iOS application are as follows:
  1. The application asks the store for information about the available products. To do so, it gives the identifiers of products to the store. These identifiers have been entered in iTunesConnect for iOS and in the Google Play developer console for Android.
  2. The store returns (in asynchronous way) this information in list format.
  3. The application displays this list to the user.
  4. The user chooses a product to purchase.
  5. The application transmits the request for purchase to the store.
  6. The store sends (in asynchronous way) a response indicating whether the transaction was performed.
  7. The application activates the purchase.
iPhone/iPad

Specific features for iOS

For an In-App purchase performed from an iPhone/iPad application, the following specific features must be taken into account:
  • When a request for purchasing an "In-App" product is performed and if the transaction is successful, the store returns a receipt to the application. Then, this receipt can be sent to the Apple servers in order to check its validity.
    Versions 23 and later
    To check and validate a transaction, you have the ability to use inAppListPurchase. If the product that was purchased is not returned by this function, the purchase can be considered as being invalid.
    New in version 23
    To check and validate a transaction, you have the ability to use inAppListPurchase. If the product that was purchased is not returned by this function, the purchase can be considered as being invalid.
    To check and validate a transaction, you have the ability to use inAppListPurchase. If the product that was purchased is not returned by this function, the purchase can be considered as being invalid.
  • When uninstalling/reinstalling the application, the application may ask to restore the purchase performed beforehand. In this case, the steps 6 and 7 are called back for each non-consumable product already purchased. The consumable products are never restored : they are considered as being consumed as soon as the purchase.When uninstalling/reinstalling the application, the application may ask to restore the purchase performed beforehand. In this case, the steps 6 and 7 are called back for each non-consumable product and for each subscription already purchased. The consumable products are never restored : they are considered as being consumed as soon as the purchase.
  • The list of products is configured via the interfaces available on iTunes Connect.
  • Versions 23 and later
    Validity of subscriptions: The end date of subscriptions is used to define the validity period of a subscription. Beyond this date, the subscription is considered as being ended. inAppListPurchase is used to check the end date of subscriptions.
    New in version 23
    Validity of subscriptions: The end date of subscriptions is used to define the validity period of a subscription. Beyond this date, the subscription is considered as being ended. inAppListPurchase is used to check the end date of subscriptions.
    Validity of subscriptions: The end date of subscriptions is used to define the validity period of a subscription. Beyond this date, the subscription is considered as being ended. inAppListPurchase is used to check the end date of subscriptions.
  • Versions 23 and later
    Self-renewable subscriptions: When the subscription expires, the subscription is automatically renewed by the AppStore. We advise you to check the valid subscriptions in the initialization code of project via inAppListPurchase.
    New in version 23
    Self-renewable subscriptions: When the subscription expires, the subscription is automatically renewed by the AppStore. We advise you to check the valid subscriptions in the initialization code of project via inAppListPurchase.
    Self-renewable subscriptions: When the subscription expires, the subscription is automatically renewed by the AppStore. We advise you to check the valid subscriptions in the initialization code of project via inAppListPurchase.
Notes:
  • Only the consumable and non-consumable products are supported. The subscriptions and the other types of products are not supported.Only the consumable and non-consumable products as well as the subscriptions are supported. The other types of products are not supported.
  • You cannot manage the downloadable content in the products.
  • Versions 23 and later
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
    New in version 23
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
Android

Specific features for Android

For an In-App purchase performed from an Android application, the following specific features must be taken into account:
  • All the purchases of "In-App" products performed from an application are stored by the Google Play store and kept even when uninstalling the application or if the uses changes his phone. Which means that the application can ask at any time for the list of purchases performed by the user.
  • A user cannot own more than one occurrence of the same product at a time but the purchased products can be consumed. Once consumed, the product is no longer displayed in the list of purchases and it can be purchased again.
  • The application must be published on Google Play Store to propose the purchase of "In-App" products.
  • Purchasing a non-consumable product
    The non-consumable products are purchased once only for a given user and application and they provide a permanent service. Once purchased, they are associated with the user without time limit even if the user unsinstalls the application or installs it on another device.
    Example: Access to the "Gold" version of an application.
    • From an application, the user purchases the "Gold version" product that allows him to access the advanced features of the application.
    • When the purchase is validated, the application "activates" the Gold version and allows the user to access the new available features.
    • At each startup, the application checks the purchases performed by the user to allow him to access the features corresponding to his purchases.
  • Purchasing a consumable product
    The consumable products of an application can be purchased several times by the same user. Once purchased, they produce a temporary effect until they are consumed by the application. After their consumption, the user has the ability to purchase the consumed product again.
    Example: Watching a movie in streaming
    • From an application, the user purchases the "Movie in streaming" product that allows him to watch the movie of his choice during one week from his application.
    • When the purchase is validated, the application asks the user to choose the movie to watch.
    • Before watching a movie, the application retrieves the purchases of the user to check whether he actually purchased the corresponding product.
    • If the purchase date of the product is less than one week, the user start watching the movie. Otherwise, the product must be consumed before it can be purchased again by the user.
  • The "In-App" purchase functions are available from Android 2.2 and they are not supported in the emulator or in the simulator. Furthermore, the device on which the application is run must be running a recent version of the Google Play application (installed by default on most of the devices).The "In-App" purchase functions are not supported in the emulator or in the simulator. Furthermore, the device on which the application is run must be running a recent version of the Google Play application (installed by default on most of the devices).
  • Versions 23 and later
    Purchasing a subscription:
    • The subscriptions are used to sell content, services or features in your application with an automatic and recurring invoicing (every week, every month, every quarter, etc.).
    • The subscriptions are automatically renewed according to the interval and to the price defined in the subscription setting via the Google Play developer console.
      Whenever renewing the subscription, Google Play automatically invoices the user account and sends an email to the user.
    • A user can cancel his subscription at any time via the form of the corresponding application in the Google Play Store application (this form can be opened from the application with AppOpenForm). When the user cancels his subscription, he can still access the content of his subscription for the rest of time that was already paid.
    • A user can also renew a subscription, it is automatically extended from the corresponding period.
    New in version 23
    Purchasing a subscription:
    • The subscriptions are used to sell content, services or features in your application with an automatic and recurring invoicing (every week, every month, every quarter, etc.).
    • The subscriptions are automatically renewed according to the interval and to the price defined in the subscription setting via the Google Play developer console.
      Whenever renewing the subscription, Google Play automatically invoices the user account and sends an email to the user.
    • A user can cancel his subscription at any time via the form of the corresponding application in the Google Play Store application (this form can be opened from the application with AppOpenForm). When the user cancels his subscription, he can still access the content of his subscription for the rest of time that was already paid.
    • A user can also renew a subscription, it is automatically extended from the corresponding period.
    Purchasing a subscription:
    • The subscriptions are used to sell content, services or features in your application with an automatic and recurring invoicing (every week, every month, every quarter, etc.).
    • The subscriptions are automatically renewed according to the interval and to the price defined in the subscription setting via the Google Play developer console.
      Whenever renewing the subscription, Google Play automatically invoices the user account and sends an email to the user.
    • A user can cancel his subscription at any time via the form of the corresponding application in the Google Play Store application (this form can be opened from the application with AppOpenForm). When the user cancels his subscription, he can still access the content of his subscription for the rest of time that was already paid.
    • A user can also renew a subscription, it is automatically extended from the corresponding period.
Notes:
  • Only the consumable and non-consumable products are supported. The subscriptions and the other types of products are not supported.Only the consumable and non-consumable products as well as the subscriptions are supported. The other types of products are not supported.
  • You cannot manage the downloadable content in the products.
  • Versions 23 and later
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
    New in version 23
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
    You have the ability to open the form for configuring the In-App purchases of an application via AppOpenForm.
Implementation
iPhone/iPad

iOS application

To implement the "In-App" purchases in an iOS application:
  1. Develop the iOS application by using the specific WLanguage functions:
    Versions 19 and later
    inAppListProductInfo
    New in version 19
    inAppListProductInfo
    inAppListProductInfo
    Retrieves, from the store, information about the "In-App" products associated with the application.
    Versions 23 and later
    inAppListPurchase
    New in version 23
    inAppListPurchase
    inAppListPurchase
    Returns the list of application products purchased by the user and not consumed.
    Versions 19 and later
    inAppPurchaseProduct
    New in version 19
    inAppPurchaseProduct
    inAppPurchaseProduct
    Sends a request for purchasing an "In-App" product associated with the application.
    Versions 19 and later
    inAppRestorePurchases
    New in version 19
    inAppRestorePurchases
    inAppRestorePurchases
    Restores the purchases of non-consumable products previously performed by the user in an iOS application.
    The inAppProduct variable is used to manage the products during an In-App purchase.
  2. Connect to iTunesConnect then to the account of your application. See Deploying an application via App Store for more details.
  3. Click the "Manage In-App Purchases" button.
  4. Create one or more products ("Create New" button). Only the consumable and non-consumable products are available in the WINDEV Mobile applications. The characteristics of these products (mainly Identifier) are used in the WINDEV Mobile application to identify the products to handle.
  5. Generate your application and deploy it on the store.
Android

Android application

To implement the "In-App" purchases in an Android application:
  1. Save the application in the Google Play developer console.
  2. Develop the Android application by using the specific WLanguage functions:
    Versions 19 and later
    inAppConsumeProduct
    New in version 19
    inAppConsumeProduct
    inAppConsumeProduct
    Used to consume, in an application, a product that was previously purchased by the user.
    Versions 19 and later
    inAppListProductInfo
    New in version 19
    inAppListProductInfo
    inAppListProductInfo
    Retrieves, from the store, information about the "In-App" products associated with the application.
    Versions 19 and later
    inAppListPurchase
    New in version 19
    inAppListPurchase
    inAppListPurchase
    Returns the list of application products purchased by the user and not consumed.
    Versions 19 and later
    inAppPurchaseProduct
    New in version 19
    inAppPurchaseProduct
    inAppPurchaseProduct
    Sends a request for purchasing an "In-App" product associated with the application.
    The inAppProduct variable is used to manage the products during an In-App purchase.
  3. Generate the application.
  4. Import the application into the Google Play developer console.
  5. Create the "In-App" products in the Google Play developer console.
  6. Run the application test. You have the ability to specify the test user accounts in the Google Play developer console.
Minimum required version
  • Version 19
Comments
Click [Add] to post a comment