Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit a9106b9

Browse files
committed
feat: more fields on renewalInfoIOS
1 parent 5bd7dab commit a9106b9

File tree

5 files changed

+250
-0
lines changed

5 files changed

+250
-0
lines changed

src/generated/Types.kt

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,7 @@ public data class PurchaseIOS(
12511251
val quantityIOS: Int? = null,
12521252
val reasonIOS: String? = null,
12531253
val reasonStringRepresentationIOS: String? = null,
1254+
val renewalInfoIOS: RenewalInfoIOS? = null,
12541255
val revocationDateIOS: Double? = null,
12551256
val revocationReasonIOS: String? = null,
12561257
val storefrontCountryCodeIOS: String? = null,
@@ -1288,6 +1289,7 @@ public data class PurchaseIOS(
12881289
quantityIOS = (json["quantityIOS"] as Number?)?.toInt(),
12891290
reasonIOS = json["reasonIOS"] as String?,
12901291
reasonStringRepresentationIOS = json["reasonStringRepresentationIOS"] as String?,
1292+
renewalInfoIOS = (json["renewalInfoIOS"] as Map<String, Any?>?)?.let { RenewalInfoIOS.fromJson(it) },
12911293
revocationDateIOS = (json["revocationDateIOS"] as Number?)?.toDouble(),
12921294
revocationReasonIOS = json["revocationReasonIOS"] as String?,
12931295
storefrontCountryCodeIOS = json["storefrontCountryCodeIOS"] as String?,
@@ -1326,6 +1328,7 @@ public data class PurchaseIOS(
13261328
"quantityIOS" to quantityIOS,
13271329
"reasonIOS" to reasonIOS,
13281330
"reasonStringRepresentationIOS" to reasonStringRepresentationIOS,
1331+
"renewalInfoIOS" to renewalInfoIOS?.toJson(),
13291332
"revocationDateIOS" to revocationDateIOS,
13301333
"revocationReasonIOS" to revocationReasonIOS,
13311334
"storefrontCountryCodeIOS" to storefrontCountryCodeIOS,
@@ -1490,17 +1493,68 @@ public data class RefundResultIOS(
14901493
)
14911494
}
14921495

1496+
/**
1497+
* Subscription renewal information from Product.SubscriptionInfo.RenewalInfo
1498+
* https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo
1499+
*/
14931500
public data class RenewalInfoIOS(
14941501
val autoRenewPreference: String? = null,
1502+
/**
1503+
* When subscription expires due to cancellation/billing issue
1504+
* Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
1505+
*/
1506+
val expirationReason: String? = null,
1507+
/**
1508+
* Grace period expiration date (milliseconds since epoch)
1509+
* When set, subscription is in grace period (billing issue but still has access)
1510+
*/
1511+
val gracePeriodExpirationDate: Double? = null,
1512+
/**
1513+
* True if subscription failed to renew due to billing issue and is retrying
1514+
* Note: Not directly available in RenewalInfo, available in Status
1515+
*/
1516+
val isInBillingRetry: Boolean? = null,
14951517
val jsonRepresentation: String? = null,
1518+
/**
1519+
* Product ID that will be used on next renewal (when user upgrades/downgrades)
1520+
* If set and different from current productId, subscription will change on expiration
1521+
*/
1522+
val pendingUpgradeProductId: String? = null,
1523+
/**
1524+
* User's response to subscription price increase
1525+
* Possible values: "AGREED", "PENDING", null (no price increase)
1526+
*/
1527+
val priceIncreaseStatus: String? = null,
1528+
/**
1529+
* Expected renewal date (milliseconds since epoch)
1530+
* For active subscriptions, when the next renewal/charge will occur
1531+
*/
1532+
val renewalDate: Double? = null,
1533+
/**
1534+
* Offer ID applied to next renewal (promotional offer, subscription offer code, etc.)
1535+
*/
1536+
val renewalOfferId: String? = null,
1537+
/**
1538+
* Type of offer applied to next renewal
1539+
* Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
1540+
*/
1541+
val renewalOfferType: String? = null,
14961542
val willAutoRenew: Boolean
14971543
) {
14981544

14991545
companion object {
15001546
fun fromJson(json: Map<String, Any?>): RenewalInfoIOS {
15011547
return RenewalInfoIOS(
15021548
autoRenewPreference = json["autoRenewPreference"] as String?,
1549+
expirationReason = json["expirationReason"] as String?,
1550+
gracePeriodExpirationDate = (json["gracePeriodExpirationDate"] as Number?)?.toDouble(),
1551+
isInBillingRetry = json["isInBillingRetry"] as Boolean?,
15031552
jsonRepresentation = json["jsonRepresentation"] as String?,
1553+
pendingUpgradeProductId = json["pendingUpgradeProductId"] as String?,
1554+
priceIncreaseStatus = json["priceIncreaseStatus"] as String?,
1555+
renewalDate = (json["renewalDate"] as Number?)?.toDouble(),
1556+
renewalOfferId = json["renewalOfferId"] as String?,
1557+
renewalOfferType = json["renewalOfferType"] as String?,
15041558
willAutoRenew = json["willAutoRenew"] as Boolean,
15051559
)
15061560
}
@@ -1509,7 +1563,15 @@ public data class RenewalInfoIOS(
15091563
fun toJson(): Map<String, Any?> = mapOf(
15101564
"__typename" to "RenewalInfoIOS",
15111565
"autoRenewPreference" to autoRenewPreference,
1566+
"expirationReason" to expirationReason,
1567+
"gracePeriodExpirationDate" to gracePeriodExpirationDate,
1568+
"isInBillingRetry" to isInBillingRetry,
15121569
"jsonRepresentation" to jsonRepresentation,
1570+
"pendingUpgradeProductId" to pendingUpgradeProductId,
1571+
"priceIncreaseStatus" to priceIncreaseStatus,
1572+
"renewalDate" to renewalDate,
1573+
"renewalOfferId" to renewalOfferId,
1574+
"renewalOfferType" to renewalOfferType,
15131575
"willAutoRenew" to willAutoRenew,
15141576
)
15151577
}

src/generated/Types.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ public struct PurchaseIOS: Codable, PurchaseCommon {
403403
public var quantityIOS: Int?
404404
public var reasonIOS: String?
405405
public var reasonStringRepresentationIOS: String?
406+
public var renewalInfoIOS: RenewalInfoIOS?
406407
public var revocationDateIOS: Double?
407408
public var revocationReasonIOS: String?
408409
public var storefrontCountryCodeIOS: String?
@@ -456,9 +457,34 @@ public struct RefundResultIOS: Codable {
456457
public var status: String
457458
}
458459

460+
/// Subscription renewal information from Product.SubscriptionInfo.RenewalInfo
461+
/// https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo
459462
public struct RenewalInfoIOS: Codable {
460463
public var autoRenewPreference: String?
464+
/// When subscription expires due to cancellation/billing issue
465+
/// Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
466+
public var expirationReason: String?
467+
/// Grace period expiration date (milliseconds since epoch)
468+
/// When set, subscription is in grace period (billing issue but still has access)
469+
public var gracePeriodExpirationDate: Double?
470+
/// True if subscription failed to renew due to billing issue and is retrying
471+
/// Note: Not directly available in RenewalInfo, available in Status
472+
public var isInBillingRetry: Bool?
461473
public var jsonRepresentation: String?
474+
/// Product ID that will be used on next renewal (when user upgrades/downgrades)
475+
/// If set and different from current productId, subscription will change on expiration
476+
public var pendingUpgradeProductId: String?
477+
/// User's response to subscription price increase
478+
/// Possible values: "AGREED", "PENDING", null (no price increase)
479+
public var priceIncreaseStatus: String?
480+
/// Expected renewal date (milliseconds since epoch)
481+
/// For active subscriptions, when the next renewal/charge will occur
482+
public var renewalDate: Double?
483+
/// Offer ID applied to next renewal (promotional offer, subscription offer code, etc.)
484+
public var renewalOfferId: String?
485+
/// Type of offer applied to next renewal
486+
/// Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
487+
public var renewalOfferType: String?
462488
public var willAutoRenew: Bool
463489
}
464490

src/generated/types.dart

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
15291529
this.quantityIOS,
15301530
this.reasonIOS,
15311531
this.reasonStringRepresentationIOS,
1532+
this.renewalInfoIOS,
15321533
this.revocationDateIOS,
15331534
this.revocationReasonIOS,
15341535
this.storefrontCountryCodeIOS,
@@ -1564,6 +1565,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
15641565
final int? quantityIOS;
15651566
final String? reasonIOS;
15661567
final String? reasonStringRepresentationIOS;
1568+
final RenewalInfoIOS? renewalInfoIOS;
15671569
final double? revocationDateIOS;
15681570
final String? revocationReasonIOS;
15691571
final String? storefrontCountryCodeIOS;
@@ -1600,6 +1602,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
16001602
quantityIOS: json['quantityIOS'] as int?,
16011603
reasonIOS: json['reasonIOS'] as String?,
16021604
reasonStringRepresentationIOS: json['reasonStringRepresentationIOS'] as String?,
1605+
renewalInfoIOS: json['renewalInfoIOS'] != null ? RenewalInfoIOS.fromJson(json['renewalInfoIOS'] as Map<String, dynamic>) : null,
16031606
revocationDateIOS: (json['revocationDateIOS'] as num?)?.toDouble(),
16041607
revocationReasonIOS: json['revocationReasonIOS'] as String?,
16051608
storefrontCountryCodeIOS: json['storefrontCountryCodeIOS'] as String?,
@@ -1640,6 +1643,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
16401643
'quantityIOS': quantityIOS,
16411644
'reasonIOS': reasonIOS,
16421645
'reasonStringRepresentationIOS': reasonStringRepresentationIOS,
1646+
'renewalInfoIOS': renewalInfoIOS?.toJson(),
16431647
'revocationDateIOS': revocationDateIOS,
16441648
'revocationReasonIOS': revocationReasonIOS,
16451649
'storefrontCountryCodeIOS': storefrontCountryCodeIOS,
@@ -1839,21 +1843,77 @@ class RefundResultIOS {
18391843
}
18401844
}
18411845

1846+
/// Subscription renewal information from Product.SubscriptionInfo.RenewalInfo
1847+
/// https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo
18421848
class RenewalInfoIOS {
18431849
const RenewalInfoIOS({
18441850
this.autoRenewPreference,
1851+
/// When subscription expires due to cancellation/billing issue
1852+
/// Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
1853+
this.expirationReason,
1854+
/// Grace period expiration date (milliseconds since epoch)
1855+
/// When set, subscription is in grace period (billing issue but still has access)
1856+
this.gracePeriodExpirationDate,
1857+
/// True if subscription failed to renew due to billing issue and is retrying
1858+
/// Note: Not directly available in RenewalInfo, available in Status
1859+
this.isInBillingRetry,
18451860
this.jsonRepresentation,
1861+
/// Product ID that will be used on next renewal (when user upgrades/downgrades)
1862+
/// If set and different from current productId, subscription will change on expiration
1863+
this.pendingUpgradeProductId,
1864+
/// User's response to subscription price increase
1865+
/// Possible values: "AGREED", "PENDING", null (no price increase)
1866+
this.priceIncreaseStatus,
1867+
/// Expected renewal date (milliseconds since epoch)
1868+
/// For active subscriptions, when the next renewal/charge will occur
1869+
this.renewalDate,
1870+
/// Offer ID applied to next renewal (promotional offer, subscription offer code, etc.)
1871+
this.renewalOfferId,
1872+
/// Type of offer applied to next renewal
1873+
/// Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
1874+
this.renewalOfferType,
18461875
required this.willAutoRenew,
18471876
});
18481877

18491878
final String? autoRenewPreference;
1879+
/// When subscription expires due to cancellation/billing issue
1880+
/// Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
1881+
final String? expirationReason;
1882+
/// Grace period expiration date (milliseconds since epoch)
1883+
/// When set, subscription is in grace period (billing issue but still has access)
1884+
final double? gracePeriodExpirationDate;
1885+
/// True if subscription failed to renew due to billing issue and is retrying
1886+
/// Note: Not directly available in RenewalInfo, available in Status
1887+
final bool? isInBillingRetry;
18501888
final String? jsonRepresentation;
1889+
/// Product ID that will be used on next renewal (when user upgrades/downgrades)
1890+
/// If set and different from current productId, subscription will change on expiration
1891+
final String? pendingUpgradeProductId;
1892+
/// User's response to subscription price increase
1893+
/// Possible values: "AGREED", "PENDING", null (no price increase)
1894+
final String? priceIncreaseStatus;
1895+
/// Expected renewal date (milliseconds since epoch)
1896+
/// For active subscriptions, when the next renewal/charge will occur
1897+
final double? renewalDate;
1898+
/// Offer ID applied to next renewal (promotional offer, subscription offer code, etc.)
1899+
final String? renewalOfferId;
1900+
/// Type of offer applied to next renewal
1901+
/// Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
1902+
final String? renewalOfferType;
18511903
final bool willAutoRenew;
18521904

18531905
factory RenewalInfoIOS.fromJson(Map<String, dynamic> json) {
18541906
return RenewalInfoIOS(
18551907
autoRenewPreference: json['autoRenewPreference'] as String?,
1908+
expirationReason: json['expirationReason'] as String?,
1909+
gracePeriodExpirationDate: (json['gracePeriodExpirationDate'] as num?)?.toDouble(),
1910+
isInBillingRetry: json['isInBillingRetry'] as bool?,
18561911
jsonRepresentation: json['jsonRepresentation'] as String?,
1912+
pendingUpgradeProductId: json['pendingUpgradeProductId'] as String?,
1913+
priceIncreaseStatus: json['priceIncreaseStatus'] as String?,
1914+
renewalDate: (json['renewalDate'] as num?)?.toDouble(),
1915+
renewalOfferId: json['renewalOfferId'] as String?,
1916+
renewalOfferType: json['renewalOfferType'] as String?,
18571917
willAutoRenew: json['willAutoRenew'] as bool,
18581918
);
18591919
}
@@ -1862,7 +1922,15 @@ class RenewalInfoIOS {
18621922
return {
18631923
'__typename': 'RenewalInfoIOS',
18641924
'autoRenewPreference': autoRenewPreference,
1925+
'expirationReason': expirationReason,
1926+
'gracePeriodExpirationDate': gracePeriodExpirationDate,
1927+
'isInBillingRetry': isInBillingRetry,
18651928
'jsonRepresentation': jsonRepresentation,
1929+
'pendingUpgradeProductId': pendingUpgradeProductId,
1930+
'priceIncreaseStatus': priceIncreaseStatus,
1931+
'renewalDate': renewalDate,
1932+
'renewalOfferId': renewalOfferId,
1933+
'renewalOfferType': renewalOfferType,
18661934
'willAutoRenew': willAutoRenew,
18671935
};
18681936
}

src/generated/types.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ export interface PurchaseIOS extends PurchaseCommon {
487487
quantityIOS?: (number | null);
488488
reasonIOS?: (string | null);
489489
reasonStringRepresentationIOS?: (string | null);
490+
renewalInfoIOS?: (RenewalInfoIOS | null);
490491
revocationDateIOS?: (number | null);
491492
revocationReasonIOS?: (string | null);
492493
storefrontCountryCodeIOS?: (string | null);
@@ -633,9 +634,50 @@ export interface RefundResultIOS {
633634
status: string;
634635
}
635636

637+
/**
638+
* Subscription renewal information from Product.SubscriptionInfo.RenewalInfo
639+
* https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo
640+
*/
636641
export interface RenewalInfoIOS {
637642
autoRenewPreference?: (string | null);
643+
/**
644+
* When subscription expires due to cancellation/billing issue
645+
* Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
646+
*/
647+
expirationReason?: (string | null);
648+
/**
649+
* Grace period expiration date (milliseconds since epoch)
650+
* When set, subscription is in grace period (billing issue but still has access)
651+
*/
652+
gracePeriodExpirationDate?: (number | null);
653+
/**
654+
* True if subscription failed to renew due to billing issue and is retrying
655+
* Note: Not directly available in RenewalInfo, available in Status
656+
*/
657+
isInBillingRetry?: (boolean | null);
638658
jsonRepresentation?: (string | null);
659+
/**
660+
* Product ID that will be used on next renewal (when user upgrades/downgrades)
661+
* If set and different from current productId, subscription will change on expiration
662+
*/
663+
pendingUpgradeProductId?: (string | null);
664+
/**
665+
* User's response to subscription price increase
666+
* Possible values: "AGREED", "PENDING", null (no price increase)
667+
*/
668+
priceIncreaseStatus?: (string | null);
669+
/**
670+
* Expected renewal date (milliseconds since epoch)
671+
* For active subscriptions, when the next renewal/charge will occur
672+
*/
673+
renewalDate?: (number | null);
674+
/** Offer ID applied to next renewal (promotional offer, subscription offer code, etc.) */
675+
renewalOfferId?: (string | null);
676+
/**
677+
* Type of offer applied to next renewal
678+
* Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
679+
*/
680+
renewalOfferType?: (string | null);
639681
willAutoRenew: boolean;
640682
}
641683

0 commit comments

Comments
 (0)