Supertab.api
Methods reference for Supertab.api
Supertab.api
provides a streamlined interface for making authenticated requests to the Customer API. This client handles the underlying HTTP communication, authentication, and error management, allowing developers to interact directly with Customer API endpoints.
While some endpoints don’t require authentication, users must be authenticated via Supertab.auth first to call endpoints with mandatory authentication. Once authenticated, the API client automatically includes the necessary authorization headers with each request.
This interface is particularly useful for custom integrations that require direct control over API interactions beyond what the pre-built experiences provide.
Methods
See Errors for a list of common exceptions.
retrieveCustomer
Retrieves the current customer.
Auth: optional
When called without an existing session, the response will return limits in a currency based on the user’s geographical location. Call this method again after auth to get limits in the user’s tab currency.
You must re-fetch this information after a new auth session is started.
Returns
Customer object. See Retrieve current customer. Supertab.js returns the response object keys in camelCase.
Example
retrieveSite
Retrieves the site object associated with the client ID used to initialize Supertab.js.
Auth: optional
If called without auth, the response will return prices in a currency based on the user’s geographical location. Call this method again after auth to get prices in the user’s tab currency.
You must re-fetch this information after a new auth session is started in order to show correct pricing.
Returns
Site object. See Retrieve site. Supertab.js returns the response object keys in camelCase.
Example
checkEntitlement
This method checks the entitlement details for a given content key.
Parameters
The content key of the entitlement to check.
Returns
An object with the entitlement details. See Retrieve entitlement status. Supertab.js returns the response object keys in camelCase.
Examples
purchase
Purchases an offering or a one-time offering.
Parameters
offeringId
or onetimeOfferingId
must be provided.The offering ID to purchase.
The onetime offering ID to purchase.
ISO4217 currency code.
Free-form metadata to associate with the purchase.
Returns
Purchase object. See Purchase an offering endpoint in Customer API docs for detailed list of returned properties. Supertab.js returns the response object keys in camelCase.
Example
retrievePurchase
This method retrieves a purchase object for a given purchase ID.
Parameters
The purchase ID to retrieve.
Returns
Purchase object. See Retrieve a purchase. Supertab.js returns the response object keys in camelCase.