Create a new Tier client. Set { debug: true }
in the
options object to enable debugging output.
Readonly
apiAPI key for use with the hosted service on tier.run
Readonly
baseURLThe URL to the sidecar providing API endpoints
Readonly
fetchThe fetch()
implementation in use. Will default to the Node
built-in fetch
if available, otherwise node-fetch
will be used.
Optional
init: RequestInitOptional
onOptional
signalAbortSignal used to cancel all requests from this client.
Optional
userThe User-Agent header that Tier sends.
Set to false
to not send a user agent header. Leave blank to
send the default User-Agent header, which includes the Tier client
version, along with either Node.js process.version or browser's
navigator.userAgent
Protected
debugProtected
apiProtected
apiCancel an org's subscriptions
Generate a checkout URL to set an org's payment info, and optionally to create a subscription on completion.
successUrl
param should be a URL within your application where the
user will be redirected upon completion.
Protected
debugalias for lookupLimit
alias for lookupLimits
Look up limits for a given FeatureName and OrgName
Look up all OrgInfo metadata about an org
Look up the payment methods on file for a given OrgName
Fetch the current phase for an org
alias for lookupPhase
Similar to pull, but filters plans to only include
the highest version of each plan. Plan versions are sorted numerically
if they are decimal integers, or lexically in the en
locale otherwise.
So, for example, the plan version 20test
will be considered "lower"
than 9test
, because the non-numeric string causes it to be lexically
sorted. But the plan version 20
sill be considered "higher" than the
plan version 9
, because both are strictly numeric.
Note Plan versions are inherently arbitrary, and as such, they really should not be sorted or given any special priority by being "latest".
This method will be removed in version 6 of this SDK.
Report metered feature usage
Advanced interface for creating arbitrary schedule phases in any order.
Optional
phases: Phase[]Simple interface for creating a new phase in the org's subscription schedule.
Setting trialDays
will cause it to prepend a "trial" phase on the
effective date, and delay the creation of the actual non-trial
subscription phase by the specified number of days.
Protected
tryProtected
tryUpdate an org's metadata. Note that any fields not set (other than
metadata
) will be reset to empty ''
values on any update.
Get information about the current sidecare API in use
Get an org's billing provider identifier
Generated using TypeDoc
The Tier client, main interface provided by the SDK.
All methods are re-exported as top level functions by the main package export, in such a way that they create a client and spin up a Tier sidecar process on demand.