# Check subscription entitlements

Gate premium access with Aplyna's server-verified entitlements, respecting expiry, cancellation, signed billing grace and revocation in the iOS billing pilot.

## Check the entitlement, not renewal intent

An entitlement is the access level mapped to a verified store product. Monthly and annual products can unlock the same entitlement identifier. Subscription auto-renewal describes future renewal intent; a cancelled subscription can retain current paid access until expiry.

### React Native · verified access

```
import Aplyna from '@aplyna/react-native';

const info = await Aplyna.billing.sync();
const hasPremium = info.entitlements.some((entitlement) =>
  entitlement.identifier === 'premium' &&
  entitlement.active &&
  (entitlement.expiresAt === null ||
    Date.parse(entitlement.expiresAt) > Date.now())
);
```

Replace premium with your actual mapped entitlement identifier. Swift uses customerInfo.hasAccess(to:); Flutter uses customerInfo.hasAccessTo(). A null expiry on an explicitly active entitlement is supported for non-expiring access; invalid or expired dates cannot grant subscription access.

## Respect verified lifecycle changes

- Cancellation retains access through the valid paid period; it does not mean an immediate refund.
- Signed grace can retain access only through the verified grace deadline. Billing retry alone cannot extend access.
- An expired or revoked entitlement cannot grant access. A refund request is not a confirmed revocation, and an older refund must not remove a later valid purchase.
- Refresh on launch/foreground and after purchase/restore. Native transaction updates and server notifications are distinct sources; neither justifies assuming every change is instantaneous.

## Enforce protected features on your server

Client access checks are for the app's UI. A backend serving protected resources must verify access through its own authenticated server-side integration and the exact billing app/customer/environment. Never trust a client-supplied premium flag or put a provider/admin credential in the mobile app. The pilot does not expose a general customer-login or durable offline-authorization contract.

- [Verification & subscription events](https://aplyna.com/docs/billing-verification): Signed proof, ownership and notification routing.
- [Security](https://aplyna.com/docs/security): Credential and application boundaries.
