I am fetching past purchase details and as mentioned in the documentation I am providing the fetched details to ChangeSubscriptionParam
with required ProationMode
.
However I am getting error in playstore modal as Something went wrong on our end. Please try again
, and the debug console says Activity finished with resultCode 0 and billing's responseCode: 5
.
This is the code I am using :
final platform = iapConnection
.getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
final pastPurchases = await platform.queryPastPurchases();
GooglePlayPurchaseDetails? oldPurchaseDetails;
// Assumes 1 or none active purchase.
for (var purchase in pastPurchases.pastPurchases) {
oldPurchaseDetails = purchase;
}
final purchaseParam = GooglePlayPurchaseParam(
productDetails: event.productDetails,
changeSubscriptionParam: oldPurchaseDetails != null
? ChangeSubscriptionParam(
oldPurchaseDetails: oldPurchaseDetails,
prorationMode: ProrationMode.deferred)
: null);
await iapConnection.buyNonConsumable(purchaseParam: purchaseParam);
I figured out the reason for my error. So I was trying subscription model in India and had 3 subscription model set up however 2 of them were priced above 5000 because of which they were being treated as prepaid plan (India's Subscription Rules). And according to documentation When upgrading, downgrading to a prepaid plan from auto-renewing plan, the only allowed proration mode is IMMEDIATE_AND_CHARGE_FULL_PRICE and I was aiming for DEFERED proration mode, hence the error.