useCustomer hook fetches customer profile data and feature access in one request. If the customer does not exist yet, PriceOS will create it automatically.
- Typed
- Untyped
Parameters
Enable or disable fetching. Defaults to
true.When
true, a 404 is surfaced as an error instead of returning null. Defaults to false.Optional SWR config for caching/revalidation behavior.
Returns
Customer data including profile fields and
featureAccess.Whether data is currently loading.
Error from the latest request.
Manually revalidate customer data.
Tracks usage and revalidates customer and feature-access caches.
Creates a checkout session and redirects to Stripe Checkout.
Creates a customer portal session and redirects to Stripe Customer Portal.
trackUsage body
Feature key to track usage for (typed to your tracked limit feature keys when using generated types).
Usage amount to record. Defaults to
1.Stable event key for retries and deduplication.
Unix timestamp in milliseconds for when the event happened.
Optional string key/value metadata attached to the usage event.
Examples
- Typed Example
- Untyped Example