ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / In-App Purchase functions
  • Special cases
  • Managing subscriptions
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
Returns the list:
  • of application products purchased by the user and not consumed.
  • of active subscriptions for the user.
iPhone/iPad This function is now available for iPhone/iPad applications.
Example
// Retrieve the list of purchases for the user
inAppListPurchase(ListPurchase, inAppPurchaseID)
PROCÉDURE ListPurchase(bSuccess is boolean, sPurchaseList is string)
IF NOT bSuccess THEN
ToastDisplay(ErrorInfo())
ELSE
// Browses the purchases performed
FOR EACH STRING sPurchaseInfo OF sPurchaseList SEPARATED BY CR
// Retrieves the product identifier
sProductID is string = ExtractString(sPurchaseInfo, 1, TAB)
// Retrieves the purchase identifier
sPurchaseID is string = ExtractString(sPurchaseInfo, 2, TAB)
// Consumes the product if necessary
IF sProductID = "PRODUCT_ID" THEN
inAppConsumeProduct(sProductID, ConsumeProduct)
END
END
END
END
PROCÉDURE ConsumeProduct(nSuccess is boolean)
IF NOT bSuccess THEN
ToastDisplay(ErrorInfo())
ELSE
// Consume the product in the application
...
END
END
Syntax
<Result> = inAppListPurchase(<Procedure> [, <Type of information>])
<Result>: Boolean
  • True if the request for retrieving the list of purchases was performed,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Procedure>: Character string
Name of the WLanguage procedure ("callback") executed when the list of purchases is received. For more details on this procedure, see Parameters of the procedure used by inAppListPurchase.
<Type of information>: Optional Integer constant
Additional information that will be returned for each listed purchase (in addition to the product identifier):
inAppAutoRenewal
  • 1 if the subscription is automatically renewed at the next invoicing date.
  • 0 if the subscription was canceled by the user or if the purchase does not correspond to a subscription.
iPhone/iPad Information not available. Always corresponds to 0.
inAppOrderIDNumber of the order corresponding to the purchase.
inAppPurchaseDatePurchase date in YYYYMMDD format.
For a subscription: purchase date of subscription.
inAppPurchaseIDIdentifier of purchase.
Android This identifier is used in inAppConsumeProduct to consume a product that was purchased.
iPhone/iPad This identifier has the same value as the one obtained with the inAppOrderID constant.
inAppSubscriptionEndDateEnd date of subscription in YYYYMMDD format.
Android Information not available. Always corresponds to empty string ("").
If the subscription was canceled by the user, this subscription will be listed by inAppListPurchase until the next invoicing date and the access to the subscription will be lost at this time (see Managing subscriptions).
Remarks

Special cases

  • Android When a product is consumed (inAppConsumeProduct), it is no longer displayed in the list returned by inAppListPurchase and it can be purchased again by the user (inAppPurchaseProduct).
  • inAppListPurchase has no effect if it is run from the simulator or emulator.
iPhone/iPad At consumable product is always consumed when it is purchased and therefore if will never appear in the result of inAppListPurchase.

Managing subscriptions

Android In Android:
  • If a subscription is listed by inAppListPurchase, the user must be able to access the subscription content.
  • If the subscription was canceled by the user, this subscription will be listed by inAppListPurchase until the next invoicing date and the access to the subscription will be lost at this time. You can allow the user to renew his subscription from the application (inAppPurchaseProduct).
iPhone/iPad In iOS:
  • The subscription is valid between the purchase date and the end date of subscription.
  • An expired subscription can be returned by inAppListPurchase. It is up to the application to decide which content remains accessible at the end of a subscription.
Component: wd290android.aar
Minimum version required
  • Version 19
Comments
Click [Add] to post a comment

Last update: 06/26/2023

Send a report | Local help