There are two subscription setups:
Identifier: tier1:monthly1, Subscription Id: tier1, Base Plan Id: monthly1
Identifier: tier2:monthly2, Subscription Id: tier2, Base Plan Id: monthly2
When changing the plan from tier1:monthly1 to tier2:monthly2, the following error occurs for a specific user:
PlatformException(4, One or more of the arguments provided are invalid., {code: 4, message: One or more of the arguments provided are invalid., readableErrorCode: PurchaseInvalidError, readable_error_code: PurchaseInvalidError, underlyingErrorMessage: Couldn't find existing purchase for SKU: tier1, userCancelled: false}, null)
In testing locally, this error is not reproducible, and the cause of the error is not apparent. The product_id of the subscription for the user where the error occurs is as follows, with tier1:monthly1 set:
{ "app_id": "", ... "product_id": "tier1:monthly1", }
The code for changing the plan is as follows:
final currentEntitleInfo =
(await Purchases.getCustomerInfo()).entitlements.all[_entitlementId];
final result = await Purchases.purchasePackage(
package,
googleProductChangeInfo: currentEntitleInfo?.isActive == true
? GoogleProductChangeInfo(
currentEntitleInfo!.productIdentifier,
)
: null,
);
Can you identify the cause of the error? Any assistance would be appreciated.