Billing
This class defines the Billing information for a [[User]].
The Billing information includes the plan, the admin email, and the billing portal URL.
Extends
Resource<bkper.Billing>
Constructors
Constructor
new Billing(json?, config?): Billing;Parameters
| Parameter | Type |
|---|---|
json? | Billing |
config? | Config |
Returns
Billing
Overrides
Resource<bkper.Billing>.constructorProperties
payload
payload: Billing;The underlying payload data for this resource
Inherited from
Resource.payloadMethods
getAdminEmail()
getAdminEmail(): string | undefined;Gets the admin email for this User’s billing account.
Returns
string | undefined
The billing admin email
getCheckoutUrl()
getCheckoutUrl( plan, successUrl?, cancelUrl?,cycle?): Promise<string | undefined>;Gets the URL to redirect the User to the billing checkout.
Parameters
| Parameter | Type | Description |
|---|---|---|
plan | string | The plan to checkout |
successUrl? | string | The URL to redirect to after the User has successfully checked out |
cancelUrl? | string | The URL to redirect to in case the checkout is cancelled |
cycle? | string | The billing cycle to checkout - “monthly” (default) or “yearly” |
Returns
Promise<string | undefined>
The URL to redirect the User to the billing checkout
getCounts()
getCounts(): Promise<Counts>;Gets the transaction counts associated to the User’s billing account.
Returns
Promise<Counts>
The transaction counts associated to the User’s billing account
getDaysLeftInTrial()
getDaysLeftInTrial(): number | undefined;Gets the number of days left in User’s trial period.
Returns
number | undefined
The number of days left in trial period
getEmail()
getEmail(): string | undefined;Gets the email for the User.
Returns
string | undefined
The User’s email
getHostedDomain()
getHostedDomain(): string | undefined;Gets the hosted domain for the User.
Returns
string | undefined
The User’s hosted domain
getPlan()
getPlan(): string | undefined;Gets the current plan of the User.
Returns
string | undefined
The User’s plan
getPortalUrl()
getPortalUrl(returnUrl): Promise<string | undefined>;Gets the URL to redirect the User to the billing portal.
Parameters
| Parameter | Type | Description |
|---|---|---|
returnUrl | string | The URL to return to after the User has been redirected to the billing portal |
Returns
Promise<string | undefined>
The URL to redirect the User to the billing portal
getTotalTransactionsThisMonth()
getTotalTransactionsThisMonth(): number | undefined;Gets the number of total transactions this month for the User’s billing account.
Returns
number | undefined
The number of total transactions this month
getTotalTransactionsThisYear()
getTotalTransactionsThisYear(): number | undefined;Gets the number of total transactions this year for the User’s billing account.
Returns
number | undefined
The number of total transactions this year
hasStartedTrial()
hasStartedTrial(): boolean | undefined;Tells if the User has started the trial period.
Returns
boolean | undefined
True if the User has started the trial period
isEnabled()
isEnabled(): boolean | undefined;Tells if billing is enabled for the User.
Returns
boolean | undefined
True if billing is enabled for the User
isPlanOverdue()
isPlanOverdue(): boolean | undefined;Tells if the User’s current plan payment is overdue.
Returns
boolean | undefined
True if the plan payment is overdue
json()
json(): Billing;Gets an immutable copy of the JSON payload for this resource.
Returns
Billing
An immutable copy of the json payload
Inherited from
Resource.json