Unity IAP: Problem when submitting to iOS App Review.
Hello, I have developed an app for iOS. When I submit it to the App Review for the store they reject it because of this unrespected guideline. Guideline 3.1.1 - Business - Payments - In-App Purchase
We found that your app offers in-app purchases that can be restored but does not include a "Restore Purchases" feature to allow users to restore the previously purchased in-app purchases, as specified in the "Restoring Purchase Products" section of the In-App Purchase Programming Guide:
"Users restore transactions to maintain access to content they've already purchased. For example, when they upgrade to a new phone, they don't lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button."
To restore previously purchased in-app purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped by the user.
Now, I have no idea what I should do. This is the code in my app that does something about restoration. In my IStoreListener.
// Restore purchases previously made by this customer. Some platforms automatically restore purchases, like Google.
// Apple currently requires explicit purchase restoration for IAP, conditionally displaying a password prompt.
public void RestorePurchases() {
// If Purchasing has not yet been set up ...
if (!IsInitialized())
{
// ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
Debug.Log("RestorePurchases FAIL. Not initialized.");
return;
}
// If we are running on an Apple device ...
if (Application.platform == RuntimePlatform.IPhonePlayer ||
Application.platform == RuntimePlatform.OSXPlayer)
{
// ... begin restoring purchases
Debug.Log("RestorePurchases started ...");
// Fetch the Apple store-specific subsystem.
var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
// Begin the asynchronous process of restoring purchases. Expect a confirmation response in
// the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
apple.RestoreTransactions((result) => {
// The first phase of restoration. If no more responses are received on ProcessPurchase then
// no purchases are available to be restored.
Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
});
}
// Otherwise ...
else
{
// We are not running on an Apple device. No work is necessary to restore purchases.
Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
}
}
// THIS IS ON OnInitialized.
#if UNITY_IOS
extensions.GetExtension<IAppleExtensions> ().RestoreTransactions (result => {
if (result) {
// This does not mean anything was restored,
// merely that the restoration process succeeded.
Debug.Log ("Products restoration succeeded.");
} else {
// Restoration failed.
Debug.Log ("Products restoration failed.");
}
});
#endif
Answer by ap-unity · Aug 01, 2017 at 06:06 PM
Apple requires you to put a button in your UI somewhere that allows users to restore their purchases. You have all the code necessary to implement it. You just need the button. Some apps put it in the options menu, but where you put it will depend on your game.
How can I know whether I should show a purchase or a restore button? public void RestorePurchases() is enough as the code run when I press the button? Should I add it on the Android version too or only on iOS?
How can I know whether I should show a purchase or a restore button?
You show both. You need a Restore button that restores all of the purchases your customer has made. And you also need a purchase button for every product you are selling. They don't need to be in the same place.
public void RestorePurchases() is enough as the code run when I press the button?
Yes.
This will depend on the store you are supporting. Apple requires a Restore button in your app. Product restoration happens automatically for Google Play, so you don't need a button.Should I add it on the Android version too or only on iOS?