@@ -440,6 +440,11 @@ public data class ActiveSubscription(
440440 * Required for subscription upgrade/downgrade on Android
441441 */
442442 val purchaseTokenAndroid : String? = null ,
443+ /* *
444+ * Renewal information from StoreKit 2 (iOS only). Contains details about subscription renewal status,
445+ * pending upgrades/downgrades, and auto-renewal preferences.
446+ */
447+ val renewalInfoIOS : RenewalInfoIOS ? = null ,
443448 val transactionDate : Double ,
444449 val transactionId : String ,
445450 val willExpireSoon : Boolean? = null
@@ -458,6 +463,7 @@ public data class ActiveSubscription(
458463 productId = json[" productId" ] as String ,
459464 purchaseToken = json[" purchaseToken" ] as String? ,
460465 purchaseTokenAndroid = json[" purchaseTokenAndroid" ] as String? ,
466+ renewalInfoIOS = (json[" renewalInfoIOS" ] as Map <String , Any ?>? )?.let { RenewalInfoIOS .fromJson(it) },
461467 transactionDate = (json[" transactionDate" ] as Number ).toDouble(),
462468 transactionId = json[" transactionId" ] as String ,
463469 willExpireSoon = json[" willExpireSoon" ] as Boolean? ,
@@ -477,6 +483,7 @@ public data class ActiveSubscription(
477483 " productId" to productId,
478484 " purchaseToken" to purchaseToken,
479485 " purchaseTokenAndroid" to purchaseTokenAndroid,
486+ " renewalInfoIOS" to renewalInfoIOS?.toJson(),
480487 " transactionDate" to transactionDate,
481488 " transactionId" to transactionId,
482489 " willExpireSoon" to willExpireSoon,
@@ -1189,6 +1196,7 @@ public data class PurchaseIOS(
11891196 val quantityIOS : Int? = null ,
11901197 val reasonIOS : String? = null ,
11911198 val reasonStringRepresentationIOS : String? = null ,
1199+ val renewalInfoIOS : RenewalInfoIOS ? = null ,
11921200 val revocationDateIOS : Double? = null ,
11931201 val revocationReasonIOS : String? = null ,
11941202 val storefrontCountryCodeIOS : String? = null ,
@@ -1226,6 +1234,7 @@ public data class PurchaseIOS(
12261234 quantityIOS = (json[" quantityIOS" ] as Number ? )?.toInt(),
12271235 reasonIOS = json[" reasonIOS" ] as String? ,
12281236 reasonStringRepresentationIOS = json[" reasonStringRepresentationIOS" ] as String? ,
1237+ renewalInfoIOS = (json[" renewalInfoIOS" ] as Map <String , Any ?>? )?.let { RenewalInfoIOS .fromJson(it) },
12291238 revocationDateIOS = (json[" revocationDateIOS" ] as Number ? )?.toDouble(),
12301239 revocationReasonIOS = json[" revocationReasonIOS" ] as String? ,
12311240 storefrontCountryCodeIOS = json[" storefrontCountryCodeIOS" ] as String? ,
@@ -1264,6 +1273,7 @@ public data class PurchaseIOS(
12641273 " quantityIOS" to quantityIOS,
12651274 " reasonIOS" to reasonIOS,
12661275 " reasonStringRepresentationIOS" to reasonStringRepresentationIOS,
1276+ " renewalInfoIOS" to renewalInfoIOS?.toJson(),
12671277 " revocationDateIOS" to revocationDateIOS,
12681278 " revocationReasonIOS" to revocationReasonIOS,
12691279 " storefrontCountryCodeIOS" to storefrontCountryCodeIOS,
@@ -1428,17 +1438,68 @@ public data class RefundResultIOS(
14281438 )
14291439}
14301440
1441+ /* *
1442+ * Subscription renewal information from Product.SubscriptionInfo.RenewalInfo
1443+ * https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo
1444+ */
14311445public data class RenewalInfoIOS (
14321446 val autoRenewPreference : String? = null ,
1447+ /* *
1448+ * When subscription expires due to cancellation/billing issue
1449+ * Possible values: "VOLUNTARY", "BILLING_ERROR", "DID_NOT_AGREE_TO_PRICE_INCREASE", "PRODUCT_NOT_AVAILABLE", "UNKNOWN"
1450+ */
1451+ val expirationReason : String? = null ,
1452+ /* *
1453+ * Grace period expiration date (milliseconds since epoch)
1454+ * When set, subscription is in grace period (billing issue but still has access)
1455+ */
1456+ val gracePeriodExpirationDate : Double? = null ,
1457+ /* *
1458+ * True if subscription failed to renew due to billing issue and is retrying
1459+ * Note: Not directly available in RenewalInfo, available in Status
1460+ */
1461+ val isInBillingRetry : Boolean? = null ,
14331462 val jsonRepresentation : String? = null ,
1463+ /* *
1464+ * Product ID that will be used on next renewal (when user upgrades/downgrades)
1465+ * If set and different from current productId, subscription will change on expiration
1466+ */
1467+ val pendingUpgradeProductId : String? = null ,
1468+ /* *
1469+ * User's response to subscription price increase
1470+ * Possible values: "AGREED", "PENDING", null (no price increase)
1471+ */
1472+ val priceIncreaseStatus : String? = null ,
1473+ /* *
1474+ * Expected renewal date (milliseconds since epoch)
1475+ * For active subscriptions, when the next renewal/charge will occur
1476+ */
1477+ val renewalDate : Double? = null ,
1478+ /* *
1479+ * Offer ID applied to next renewal (promotional offer, subscription offer code, etc.)
1480+ */
1481+ val renewalOfferId : String? = null ,
1482+ /* *
1483+ * Type of offer applied to next renewal
1484+ * Possible values: "PROMOTIONAL", "SUBSCRIPTION_OFFER_CODE", "WIN_BACK", etc.
1485+ */
1486+ val renewalOfferType : String? = null ,
14341487 val willAutoRenew : Boolean
14351488) {
14361489
14371490 companion object {
14381491 fun fromJson (json : Map <String , Any ?>): RenewalInfoIOS {
14391492 return RenewalInfoIOS (
14401493 autoRenewPreference = json[" autoRenewPreference" ] as String? ,
1494+ expirationReason = json[" expirationReason" ] as String? ,
1495+ gracePeriodExpirationDate = (json[" gracePeriodExpirationDate" ] as Number ? )?.toDouble(),
1496+ isInBillingRetry = json[" isInBillingRetry" ] as Boolean? ,
14411497 jsonRepresentation = json[" jsonRepresentation" ] as String? ,
1498+ pendingUpgradeProductId = json[" pendingUpgradeProductId" ] as String? ,
1499+ priceIncreaseStatus = json[" priceIncreaseStatus" ] as String? ,
1500+ renewalDate = (json[" renewalDate" ] as Number ? )?.toDouble(),
1501+ renewalOfferId = json[" renewalOfferId" ] as String? ,
1502+ renewalOfferType = json[" renewalOfferType" ] as String? ,
14421503 willAutoRenew = json[" willAutoRenew" ] as Boolean ,
14431504 )
14441505 }
@@ -1447,7 +1508,15 @@ public data class RenewalInfoIOS(
14471508 fun toJson (): Map <String , Any ?> = mapOf (
14481509 " __typename" to " RenewalInfoIOS" ,
14491510 " autoRenewPreference" to autoRenewPreference,
1511+ " expirationReason" to expirationReason,
1512+ " gracePeriodExpirationDate" to gracePeriodExpirationDate,
1513+ " isInBillingRetry" to isInBillingRetry,
14501514 " jsonRepresentation" to jsonRepresentation,
1515+ " pendingUpgradeProductId" to pendingUpgradeProductId,
1516+ " priceIncreaseStatus" to priceIncreaseStatus,
1517+ " renewalDate" to renewalDate,
1518+ " renewalOfferId" to renewalOfferId,
1519+ " renewalOfferType" to renewalOfferType,
14511520 " willAutoRenew" to willAutoRenew,
14521521 )
14531522}
0 commit comments