Hooks for retrieving user identity, subscriptions, addresses, and payment methods in the Limio SDK.
In Limio Self-Service, authenticated users can view and manage their subscriptions through a self-service portal. The SDK provides hooks that retrieve real-time data about the current user, their subscriptions, addresses, and payment methods.
User profile attributes from the identity provider (email, name, custom claims)
loginStatus
"logged-in" | "logged-out"
Current authentication state
loaded
boolean
Always true once the hook resolves
token
string
The current session access token
Example — display the logged-in user's email:
importReactfrom"react"import{useUser}from"@limio/sdk"constAccountHeader=()=>{const{attributes,loginStatus}=useUser()if (loginStatus!=="logged-in") {return<p>Please sign in to view your account.</p>}return (<header><p>Signed in as {attributes.email}</p></header> )}
Example user object
Custom claims (like crm_id above) come from your federated identity provider. See Authentication Integrations for setup.
useSubscriptions()
Returns the list of subscriptions for the authenticated user.
Options:
Field
Type
Description
ownerId
string (optional)
Filter subscriptions by owner ID — used in B2B partner portals where one user manages multiple accounts
Example — list subscriptions with status:
Example — B2B partner portal with ownerId:
Example subscription object
Displaying subscription details
getCurrentOffer
Returns the current active offer from a subscription. Useful for showing the plan name and pricing on subscription management pages.
Reading schedule data
Each subscription includes a schedule array with past and future payment entries. To find the next upcoming payment, filter by date and status:
formatDate and formatCurrency are exported from @limio/sdk and use the app's configured locale and date format.
useSubInfo
A convenience hook that extracts key metadata from a subscription object.
Returns:
Field
Type
Description
status
string
Current subscription status
isGift
boolean
Whether the subscription is a gift
quantity
number
Quantity on the subscription
hasLapsed
boolean | undefined
Whether the subscription has lapsed
hasPendingChange
boolean
Whether there is a scheduled change pending
useSchedule
A convenience hook that returns formatted schedule data for a subscription. Handles date formatting, currency formatting, and renewal price calculation.
Other subscription helpers
These helpers are available from @limio/sdk/subscription and @limio/sdk/offers:
Helper
Import
Description
getPeriodForOffer(offer)
@limio/sdk/offers
Returns the billing period string (e.g. "1 month") or "N/A" for one-off charges
checkCurrentSchedule(schedules)
@limio/sdk/subscription
Returns the next applicable schedule from an array
getRenewalDateForUserSubscription(sub)
@limio/sdk/subscription
Returns the formatted renewal date, or "N/A" if cancelled
getPriceForUserSubscription(sub)
@limio/sdk/subscription
Returns { value, currencyCode } for the next payment
getPriceFromSchedule(schedule, country?)
@limio/sdk/subscription
Extracts { value, currencyCode } from a schedule item
Addresses and payment methods
useLimioUserSubscriptionAddresses
Fetch billing and delivery addresses for a subscription. Returns an array of address objects with a revalidate function to refresh the data.
getCurrentAddress
Extract the active billing or delivery address from the addresses array.
Parameters:
Param
Type
Description
type
"billing" | "delivery"
The address type to retrieve
addresses
LimioAddressObject[]
The addresses array from useLimioUserSubscriptionAddresses
Example — display billing and delivery addresses:
Example address object
useLimioUserSubscriptionPaymentMethods
Fetch stored payment methods for a subscription. Returns payment method details and a revalidate function.
The payment_methods array contains objects with card type, last four digits, and expiry information from the billing provider.