Use this page with AI

Copy this into your coding assistant and add your request.

Read https://openiap.dev/docs/apis/get-active-subscriptions and https://openiap.dev/llms.txt. Follow the reading instructions, detailed reference, and linked guides relevant to my task before making changes.
Inspect my existing project and reuse its framework and conventions. Ask me for missing product decisions. Implement the requested behavior and run the applicable checks.
Show the working result, the commands and actual test results, and any remaining limitations. Keep your explanation brief.

My request: [describe what customers should be able to do]
See an example request →

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 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 ActiveSubscription fields; 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 on iOS while the expiration date is in the future (billing grace reads inactive); on Android while the purchase state is purchased.
  • 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.

When upgrading from an older major, see the subscription-check upgrade notes.

Example

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