@@ -522,6 +522,11 @@ abstract class ProductCommon {
522522}
523523
524524abstract class PurchaseCommon {
525+ /// The current plan identifier. This is:
526+ /// - On Android: the basePlanId (e.g., "premium", "premium-year")
527+ /// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
528+ /// This provides a unified way to identify which specific plan/tier the user is subscribed to.
529+ String? get currentPlanId;
525530 String get id;
526531 List<String>? get ids;
527532 bool get isAutoRenewing;
@@ -539,6 +544,12 @@ abstract class PurchaseCommon {
539544class ActiveSubscription {
540545 const ActiveSubscription({
541546 this.autoRenewingAndroid,
547+ this.basePlanIdAndroid,
548+ /// The current plan identifier. This is:
549+ /// - On Android: the basePlanId (e.g., "premium", "premium-year")
550+ /// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
551+ /// This provides a unified way to identify which specific plan/tier the user is subscribed to.
552+ this.currentPlanId,
542553 this.daysUntilExpirationIOS,
543554 this.environmentIOS,
544555 this.expirationDateIOS,
@@ -551,6 +562,12 @@ class ActiveSubscription {
551562 });
552563
553564 final bool? autoRenewingAndroid;
565+ final String? basePlanIdAndroid;
566+ /// The current plan identifier. This is:
567+ /// - On Android: the basePlanId (e.g., "premium", "premium-year")
568+ /// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
569+ /// This provides a unified way to identify which specific plan/tier the user is subscribed to.
570+ final String? currentPlanId;
554571 final double? daysUntilExpirationIOS;
555572 final String? environmentIOS;
556573 final double? expirationDateIOS;
@@ -564,6 +581,8 @@ class ActiveSubscription {
564581 factory ActiveSubscription.fromJson(Map<String, dynamic> json) {
565582 return ActiveSubscription(
566583 autoRenewingAndroid: json['autoRenewingAndroid'] as bool?,
584+ basePlanIdAndroid: json['basePlanIdAndroid'] as String?,
585+ currentPlanId: json['currentPlanId'] as String?,
567586 daysUntilExpirationIOS: (json['daysUntilExpirationIOS'] as num?)?.toDouble(),
568587 environmentIOS: json['environmentIOS'] as String?,
569588 expirationDateIOS: (json['expirationDateIOS'] as num?)?.toDouble(),
@@ -580,6 +599,8 @@ class ActiveSubscription {
580599 return {
581600 '__typename': 'ActiveSubscription',
582601 'autoRenewingAndroid': autoRenewingAndroid,
602+ 'basePlanIdAndroid': basePlanIdAndroid,
603+ 'currentPlanId': currentPlanId,
583604 'daysUntilExpirationIOS': daysUntilExpirationIOS,
584605 'environmentIOS': environmentIOS,
585606 'expirationDateIOS': expirationDateIOS,
@@ -1260,6 +1281,7 @@ class ProductSubscriptionIOS extends ProductSubscription implements ProductCommo
12601281class PurchaseAndroid extends Purchase implements PurchaseCommon {
12611282 const PurchaseAndroid({
12621283 this.autoRenewingAndroid,
1284+ this.currentPlanId,
12631285 this.dataAndroid,
12641286 this.developerPayloadAndroid,
12651287 required this.id,
@@ -1281,6 +1303,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
12811303 });
12821304
12831305 final bool? autoRenewingAndroid;
1306+ final String? currentPlanId;
12841307 final String? dataAndroid;
12851308 final String? developerPayloadAndroid;
12861309 final String id;
@@ -1303,6 +1326,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
13031326 factory PurchaseAndroid.fromJson(Map<String, dynamic> json) {
13041327 return PurchaseAndroid(
13051328 autoRenewingAndroid: json['autoRenewingAndroid'] as bool?,
1329+ currentPlanId: json['currentPlanId'] as String?,
13061330 dataAndroid: json['dataAndroid'] as String?,
13071331 developerPayloadAndroid: json['developerPayloadAndroid'] as String?,
13081332 id: json['id'] as String,
@@ -1329,6 +1353,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
13291353 return {
13301354 '__typename': 'PurchaseAndroid',
13311355 'autoRenewingAndroid': autoRenewingAndroid,
1356+ 'currentPlanId': currentPlanId,
13321357 'dataAndroid': dataAndroid,
13331358 'developerPayloadAndroid': developerPayloadAndroid,
13341359 'id': id,
@@ -1387,6 +1412,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
13871412 this.countryCodeIOS,
13881413 this.currencyCodeIOS,
13891414 this.currencySymbolIOS,
1415+ this.currentPlanId,
13901416 this.environmentIOS,
13911417 this.expirationDateIOS,
13921418 required this.id,
@@ -1421,6 +1447,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
14211447 final String? countryCodeIOS;
14221448 final String? currencyCodeIOS;
14231449 final String? currencySymbolIOS;
1450+ final String? currentPlanId;
14241451 final String? environmentIOS;
14251452 final double? expirationDateIOS;
14261453 final String id;
@@ -1456,6 +1483,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
14561483 countryCodeIOS: json['countryCodeIOS'] as String?,
14571484 currencyCodeIOS: json['currencyCodeIOS'] as String?,
14581485 currencySymbolIOS: json['currencySymbolIOS'] as String?,
1486+ currentPlanId: json['currentPlanId'] as String?,
14591487 environmentIOS: json['environmentIOS'] as String?,
14601488 expirationDateIOS: (json['expirationDateIOS'] as num?)?.toDouble(),
14611489 id: json['id'] as String,
@@ -1495,6 +1523,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
14951523 'countryCodeIOS': countryCodeIOS,
14961524 'currencyCodeIOS': currencyCodeIOS,
14971525 'currencySymbolIOS': currencySymbolIOS,
1526+ 'currentPlanId': currentPlanId,
14981527 'environmentIOS': environmentIOS,
14991528 'expirationDateIOS': expirationDateIOS,
15001529 'id': id,
@@ -2528,6 +2557,12 @@ sealed class Purchase implements PurchaseCommon {
25282557 throw ArgumentError('Unknown __typename for Purchase: $typeName');
25292558 }
25302559
2560+ /// The current plan identifier. This is:
2561+ /// - On Android: the basePlanId (e.g., "premium", "premium-year")
2562+ /// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
2563+ /// This provides a unified way to identify which specific plan/tier the user is subscribed to.
2564+ @override
2565+ String? get currentPlanId;
25312566 @override
25322567 String get id;
25332568 @override
0 commit comments