# Tracking Subscription State

Read or set subscription status from a Unity game.

If you do not pass a custom purchase controller, Superwall uses the native iOS and Android SDKs to
manage purchases and subscription-related state.

Read Subscription Status [#read-subscription-status]

```csharp C#
using Superwall;

var status = Superwall.Shared.SubscriptionStatus;

if (status.Type == SubscriptionStatus.StatusType.Active)
{
    var active = (SubscriptionStatus.ActiveStatus)status;
    Debug.Log($"Active entitlements: {active.Entitlements.Count}");
}
```

You can also fetch customer info asynchronously:

```csharp C#
Superwall.Shared.GetCustomerInfo(info =>
{
    Debug.Log($"Customer: {info.UserId}");
    Debug.Log($"Entitlements: {info.Entitlements.Count}");
});
```

Set Subscription Status Manually [#set-subscription-status-manually]

Set subscription status manually when another purchase system is the source of truth for access. In
a complete custom purchase integration, configure Superwall with an
[`IPurchaseController`](/docs/unity/guides/custom-purchase-controller) so paywall purchase and restore
actions are routed to your purchase code, then update `SubscriptionStatus` whenever the player's
entitlements change.

> **Warning**

If you are using Superwall-managed purchases, do not set `SubscriptionStatus` directly. The native
iOS and Android SDKs update it automatically after purchases, restores, and receipt checks.



```csharp C#
using System.Collections.Generic;
using Superwall;

var entitlements = new List<Entitlement>
{
    new Entitlement
    {
        Id = "pro",
        IsActive = true,
        Type = EntitlementType.ServiceLevel
    }
};

Superwall.Shared.SubscriptionStatus = SubscriptionStatus.CreateActive(entitlements);
```

Set the status to inactive when the player loses access:

```csharp C#
Superwall.Shared.SubscriptionStatus = SubscriptionStatus.CreateInactive();
```

Listen for Changes [#listen-for-changes]

Implement `ISuperwallDelegate` when you need callbacks for subscription or customer changes.

```csharp C#
public void SubscriptionStatusDidChange(SubscriptionStatus from, SubscriptionStatus to)
{
    Debug.Log($"Subscription status changed: {from.Type} -> {to.Type}");
}

public void CustomerInfoDidChange(CustomerInfo from, CustomerInfo to)
{
    Debug.Log($"Customer info changed for {to.UserId}");
}
```

See [Using the Superwall Delegate](/docs/unity/guides/using-superwall-delegate) for setup.