SubscriptionTransaction
Represents a subscription transaction in the customer's purchase history.
Introduced in 4.10.0. offerType, subscriptionGroupId, and store were added in 4.11.0.
Purpose
Provides details about a single subscription transaction returned from CustomerInfo. Use this to understand renewal status, applied offers, and the store that fulfilled the purchase.
Properties
| Property | Type | Description |
|---|---|---|
transactionId | String | Unique identifier for the transaction. |
productId | String | The product identifier for the subscription. |
purchaseDate | Date | When the App Store charged the account. |
willRenew | Bool | Whether the subscription is set to auto-renew. |
isRevoked | Bool | true if the transaction has been revoked. |
isInGracePeriod | Bool | true if the subscription is in grace period. |
isInBillingRetryPeriod | Bool | true if the subscription is in billing retry. |
isActive | Bool | true when the subscription is currently active. |
expirationDate | Date? | Expiration date, if applicable. |
offerType | LatestSubscription.OfferType? | Offer applied to this transaction (4.11.0+). |
subscriptionGroupId | String? | Subscription group identifier if available (4.11.0+). |
store | ProductStore | Store that fulfilled the purchase (4.11.0+). |
Offer types (4.11.0+)
trial— introductory offer.code— offer redeemed with a promo code.promotional— StoreKit promotional offer.winback— win-back offer (iOS 17.2+ only).
Store values (4.11.0+)
appStore, stripe, paddle, playStore, superwall, other.
Usage
Inspect subscription transactions:
let customerInfo = Superwall.shared.customerInfo
for subscription in customerInfo.subscriptions {
print("Product: \(subscription.productId)")
print("Store: \(subscription.store)")
print("Offer: \(subscription.offerType?.rawValue ?? "none")")
print("Group: \(subscription.subscriptionGroupId ?? "unknown")")
print("Expires: \(String(describing: subscription.expirationDate))")
}Related
CustomerInfo- Source of subscription dataNonSubscriptionTransaction- Non-subscription transactionsgetCustomerInfo()- Fetch customer info asynchronously
How is this guide?
Edit on GitHub