I think i figured it out.
For anyone who is also confused, this helped me:
(I am using flutter)
1static Future<bool> purchase(Package package) async {
2
3try{
4
5//this gets the packages currently subscribed to
6PurchaserInfo purchaserInfo = await Purchases.getPurchaserInfo();
7
8//then we take the entitlement id and add that into the upgradeInfo
9
10PurchaserInfo purchase = await Purchases.purchasePackage(package,upgradeInfo: UpgradeInfo(purchaserInfo.activeSubscriptions[0],prorationMode: ProrationMode.immediateWithTimeProration));
11
12return true;
13
14 } on PlatformException catch (e) {
15 var errorCode = PurchasesErrorHelper.getErrorCode(e);
16 if (errorCode == PurchasesErrorCode.purchaseCancelledError) {
17 print("User cancelled");
18 } else if (errorCode == PurchasesErrorCode.purchaseNotAllowedError) {
19 print("User not allowed to purchase");
20 } else if (errorCode == PurchasesErrorCode.configurationError) {
21 print("Config error");
22 print(e);
23 }
24
25 return false;
26 }
27
28//Note this is only for one subscription at a time
29}
30
31