User, Subscription, Invoice & Address
This page describes all of the user and subscription methods available within the Limio SDK.
In the context of Limio Self-Service, authenticated users can view and manage their subscriptions directly through a self-service portal. To support this, the Limio SDK provides a set of hooks and utility functions that allow developers to retrieve and display real-time data about the user, their subscriptions, payment schedules, and account information.
These SDK methods are essential for building authenticated experiences such as:
Account overviews and profile displays
Subscription management and renewal flows
Billing and invoice history pages
Displaying upcoming charges and subscription status
This page covers the most commonly used methods, including:
useUser
– Retrieve the logged-in user's profile (e.g. email, authentication status)useSubscriptions
– Access the list of subscriptions linked to the useruseSubInfo
– Extract subscription metadata such as status, quantity, and pending changesuseUserInvoices
– Retrieve billing invoices directly from ZuoragetCurrentAddress
– Get the user's active billing or delivery addressgetCurrentOffer
,getPeriodForOffer
– Understand the current subscription offer and billing frequencycheckCurrentSchedule
,getRenewalDateForUserSubscription
,getPriceForUserSubscription
– Display billing details, upcoming payments, and pricinguseSchedule
- Access key dates date prices from a given subscription schdule.
These methods power the Manage My Account journey and other post-purchase experiences in Limio Self-Service.
For more background on Limio Self-Service, see:
useUser
-Retrieving details of the current user
useUser
-Retrieving details of the current userIf you need to find out if a user is validated and get some details about that user, including Subscription you can use the useUser
method.
Example to display authenticated user's email in a navigation bar:
Example to display an authenticated user's Subscriptions and the Status of those Subscriptions, as well as upcoming payments:
Example user
:
useSubInfo
- Getting details from the a subscription
useSubInfo
- Getting details from the a subscriptionuseSubInfo
Extracts and returns key subscription information such as status, gift status, quantity, whether the subscription has lapsed, and if there are any pending changes.
Returns:
SubInfo An object containing:
status
: string: The current status of the subscription.isGift
: boolean: Whether the subscription is a gift.quantity
: number: The quantity associated with the subscription.hasLapsed
: boolean | undefined: Whether the subscription has lapsed.hasPendingChange
: boolean: Whether there is a pending change scheduled for the subscription.
useUserInvoices
- Getting the user's invoices
useUserInvoices
- Getting the user's invoicesTo get all of the account level invoices from Zuora, Limio exposes a hook, useUserInvoices. When called this will retrieve ever invoice from the users account. Example usage:
getCurrentAddress
- Getting the user's address
getCurrentAddress
- Getting the user's addressgetCurrentAddress
Checks a Limio Address Object to find and return the active billing or delivery address associated with a customer account.
Parameters:
type
:string
(required) The type of address to retrieve. Can be"billing"
or"delivery"
.addresses
:LimioAddressObject
(required) An array containing the customer's associated address objects, typically including both billing and delivery addresses.
Returns:
LimioAddressObject
: An object containing the data of the active address matching the specified type. The returned object usually includes the full address details such as street, city, postal code, and country.
Example LimioAddressObject
Subscription helpers
getPriceFromSchedule
Retrieves the price from a Limio schedule item and returns an object containing the price value and currency code. It can also take into account the country code, which may influence the price calculation.
Parameters:
schedule
:LimioScheduleItem
An object representing a schedule item within a Limio subscription.country
:string
(optional) An alpha-2 country code that may be used to adjust the price based on the country.
Example LimioScheduleItem
:
Returns:
{ value: string, currencyCode: string }
An object containing:value
:string
: The price value extracted from the schedule item.currencyCode
:string
: The currency code associated with the price.
getCurrentOffer
Returns the current active offer associated with a user's subscription. Useful for retrieving details about the active promotional or pricing offer that applies to the subscription.
Parameters:
userSubscription
:LimioUserSubscription
An object representing the user's subscription, including any associated offers.
Returns:
LimioOffer
: An object representing the current active offer associated with the subscription. The offer object typically includes details such as pricing, terms, and conditions.
getPeriodForOffer
Returns the billing period of a LimioOffer
object, indicating the duration or frequency of the offer's billing cycle. If the offer is a one-off charge (non-recurring), it returns "N/A"
.
This function can be used in conjunction with getCurrentOffer
to retrieve the billing period of the user's current offer.
Parameters:
offer
:LimioOfferObject
An object representing a Limio offer, containing details such as its billing cycle, price, and attributes.
Returns:
A string representing the period of the offer (e.g., "1 month"), or "N/A" if the offer is a one-off charge or does not auto-renew.
Example Output:
"1 month"
if the offer is recurring monthly."N/A"
if the offer is a one-off charge or evergreen.
checkCurrentSchedule
Determines the next applicable schedule from the existing schedules for a subscription. Useful for displaying information such as the next bill date and price.
Parameters:
schedules: Array An array of schedule objects associated with the subscription. Each schedule object typically includes a status and a data.date.
Returns:
schedule: Array Returns the next applicable schedule object based on the provided parameters, or null/undefined if no suitable schedule is found.
getRenewalDateForUserSubscription
Retrieves and returns the renewal date for a user's subscription, formatted according to the default date format defined in the Limio App settings.
Parameters:
userSubscription: UserSubscription An object containing the user's subscription details, such as status, schedule, and term end date.
Returns:
A string representing the formatted renewal date of the user's subscription. Possible return values include:
The next scheduled renewal date.
The term end date if no next schedule is found.
"N/A"
if the subscription status is "cancelled".
getPriceForUserSubscription
Calculates and returns the price information for a user's subscription, considering factors such as the user's subscription status, country, and any applicable offers or charges.
Parameters:
userSubscription: UserSubscription An object representing the user's subscription details, such as status, schedule, and purchase country.
Returns:
A string representing the price information for the user's subscription. Possible return values include:
A formatted currency amount for the next scheduled payment.
"Currently unavailable"
if the price cannot be determined."N/A"
if the subscription status is "cancelled".
useSchedule
Returns key dates and prices from the provided customer schedule, formatted according to the default date format and pricing format defined in your environment.
Parameters:
purchasedSubscription: UserSubscription An object representing the user's subscription details, such as status, schedule, and purchase country.
Returns:
An object containing:
nextPaymentAmount
: string: The next amount the customer will be charged.renewalPrice
: string: The price the customer will be charged once their current term has lapsed, and they renew onto the next term.termStartDate
: string: The date the subscription term began,termEndDate
: string: The date the current subscription term is due to lapse.
Last updated
Was this helpful?