getActiveSubscriptions

Get all active subscriptions with detailed renewal status information.

iOS: Iterates Transaction.currentEntitlements and filters to subscription product types; checks expirationDate and revocationDate. Apple docs. Android: Calls queryPurchasesAsync(SUBS) and treats purchaseState == PURCHASED && autoRenewing as active. Google docs.

Fire OS: uses the Amazon adapter's purchase-update stream under the Android API shape. App code still passes the same subscription SKU list and reads the same ActiveSubscriptionfields; the adapter handles Amazon receipt IDs and the in-flight purchase response correlation so examples and framework apps do not need ad-hoc SKU alias logic.

Signature

swift
func getActiveSubscriptions(_ subscriptionIds: [String]?) async throws -> [ActiveSubscription]

Parameters#

  • subscriptionIds (optional, string[]) — If provided, the result is filtered to these SKUs. Omit / pass null to return every active subscription the store knows about.

Failure semantics#

Store, serialization, and bridge-decoding failures reject the query; they are not an authoritative empty subscription list. The React Native and Expo hooks call onError and rethrow. Godot entitlement code must use get_active_subscriptions_result() and leave its existing entitlement state unchanged when success is false.

Returns#

Promise<ActiveSubscription[]> — one entry per active subscription. Each row carries:

  • productId (required, string) — Subscription product identifier.
  • basePlanIdAndroid (optional, string) Android. Base plan identifier when applicable.
  • isActive (required, boolean) true while the subscription is in a paying or grace state.
  • expirationDateIOS (optional, number) iOS. Epoch ms expiration timestamp.
  • environmentIOS (optional, string) iOS. "Sandbox" or "Production".
  • autoRenewingAndroid (optional, boolean) Android. Whether Play will auto-renew at the next cycle.

Example

swift
let subscriptions = try await OpenIapModule.shared.getActiveSubscriptions(nil)