Hello,
I'm encountering an issue with my Flutter app's in-app purchase (IAP) functionality, particularly with restoring purchases on iOS.
My app offers a non-consumable premium version that provides lifetime access to certain features. However, during the App Store review process, I received a rejection due to the following reason:
Guideline 3.1.1 - Business - Payments - In-App Purchase
"We found that your app includes a feature to restore previously purchased in-app purchase products by entering the user's Apple ID and password. However, in-app purchases cannot be restored in this manner."
While the restoration process works smoothly on Android without any sign-in prompts, on iOS, it triggers a sign-in prompt, leading to the rejection.
it only happened for app store, everything was fine for google play
Here's the relevant code snippet from my app:
static Future<void> restorePurchases(
PersistenceViewModel persistenceViewModel, BuildContext context) async {
try {
CustomerInfo customerInfo = await Purchases.restorePurchases();
// Handle restored purchases
if (customerInfo.allPurchasedProductIdentifiers.contains(premium)) {
// Handle the restored product identifiers
if (kDebugMode) {
print('Premium version restored');
}
// Here I make the user premium if successfully restored
await persistenceViewModel.setPremium(true);
// Show Alert
if (!context.mounted) return;
showDialog(
context: context,
builder: (BuildContext context) {
return const ShowRestoredAlert();
},
);
}
} on PlatformException catch (e) {
if (kDebugMode) {
print('Error restoring purchases: $e');
}
}
}
I'd like to resolve this issue and ensure that the restoration process works seamlessly on both iOS and Android. How can I modify my code to achieve this without triggering the sign-in prompt on iOS?
Any guidance or suggestions would be greatly appreciated.
Thank you in advance!