Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: in-app purchase: differences RestorePurchasedProducts and QueryProducts


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Francisco Peris

Posts: 91
Registered: 1/5/15
in-app purchase: differences RestorePurchasedProducts and QueryProducts  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 7, 2017 6:13 AM
When my application starts it checks whether a non-consumable product has been purchased:

InAppPurchase1.SetupInAppPurchase;
InAppPurchase1.QueryProducts;


However, I read on embarcadero documentation, that if the user buys this product in one device, and then move to another one (same ID) this check done by QueryProducts fails. We can read:

To restore products purchased from a different device on the current device, you must call RestorePurchasedProducts.

Therefore, when my app starts now the code is:

InAppPurchase1.SetupInAppPurchase;
InAppPurchase1.RestorePurchasedProducts;
InAppPurchase1.QueryProducts;


The second command is for solving that possible problem, and the third one to check whether the product was purchased.

However, bot commands do similar tasks.... and an error occurs because it seems RestorePurchasedProducts makes a QueryProducts. The error says that "a task requested is being done".

Could you confirm that RestorePurchasedProducts is calling QueryProducts?

Is itsafe to leave only this code?:

InAppPurchase1.SetupInAppPurchase;
InAppPurchase1.RestorePurchasedProducts;


Even for users that will only have one device? Will this code always check that the user bought the product?

Thanks in advance

EDIT: I have found a problem with RestorePurchasedProducts. It requires that the user has input before starting the app the password of the Itunes store. Although the user input the password when prompted for my app, no check is done later.

Edited by: Francisco Peris on Oct 7, 2017 6:31 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02