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 until the SDK has loaded real customer data on both platforms, so the resolved snapshot is never an unloaded placeholder.
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().
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} />
</>
)
}Related
useSuperwall- Hook access to the main Expo SDK store, includingcustomerInfostate.useUser- Convenience hook for user identity and info.useSuperwallEvents- Subscribe toonCustomerInfoChangefor live updates.
How is this guide?