Hooks

getCustomerInfo()

Fetch the customer's latest subscription and purchase info snapshot.

Purpose

Retrieves the customer's latest purchase and subscription info: subscription transactions, non-subscription transactions and entitlements. The call waits for the SDK to load customer data. On Android it waits up to 5 seconds, then resolves with what the SDK has.

Since v1.9.0, getCustomerInfo() no longer waits forever. On Android, if the SDK can't load the customer info, it resolves after 5 seconds with what the SDK has. On iOS, it no longer hangs when the SDK can't load its configuration.

To fetch the latest entitlements from Superwall instead of reading the SDK's snapshot, such as after your server reports a custom product purchase, call refreshCustomerInfo() from useSuperwall() or Superwall.shared. It updates the customerInfo state too. On Android, where the SDK can't force a refresh, it returns the same snapshot as getCustomerInfo().

Snapshots are immutable and don't auto-update. Call getCustomerInfo() again for a fresh snapshot, or subscribe to changes via useSuperwallEvents's onCustomerInfoChange callback (or SuperwallDelegate.customerInfoDidChange in the compat SDK).

Signature

Hook usage:

const { getCustomerInfo, customerInfo } = useSuperwall()
// or
const { getCustomerInfo, customerInfo } = useUser()

await getCustomerInfo(): Promise<CustomerInfo>

Compat API usage:

import Superwall from "expo-superwall/compat"

await Superwall.shared.getCustomerInfo(): Promise<CustomerInfo>

Returns / State

Both variants resolve to a CustomerInfo snapshot. The hook also updates the store's customerInfo state as a side effect:

Prop

Type

The customerInfo state on useSuperwall / useUser is also seeded automatically after configure(), and cleared and reseeded across identify() / reset().

Subscription data in v1.8.0

On iOS with StoreKit 2, entitlements remain active during a billing grace period. SubscriptionTransaction.isActive is true and expirationDate is the date the grace period ends.

On Android, subscription transactions and entitlements use the base plan actually purchased. When it cannot be determined, such as after reinstalling or for older purchases, productId / latestProductId contain the Play subscription ID and expiry dates are null. These users keep their access. See the transaction fields.

Usage

import { useUser } from "expo-superwall"

function AccountScreen() {
  const { customerInfo, getCustomerInfo } = useUser()

  const refresh = async () => {
    const info = await getCustomerInfo()
    console.log("Active entitlements:", info.entitlements)
  }

  return (
    <>
      <Text>Subscriptions: {customerInfo?.subscriptions.length ?? 0}</Text>
      <Button title="Refresh" onPress={refresh} />
    </>
  )
}
  • useSuperwall - Hook access to the main Expo SDK store, including customerInfo state.
  • useUser - Convenience hook for user identity and info.
  • useSuperwallEvents - Subscribe to onCustomerInfoChange for live updates.

How is this guide?

On this page