@collectivtech/alana-sdk-js / resources/server/membership / ServerMembership
Class: ServerMembership
Defined in: src/resources/server/membership.ts:5
Base class for an API resource object.
This is an abstract class. You shouldn't create objects from it directly, but instead use one of the defined subclasses, which handle the needed conversion to and from raw JSON.
All resource classes hold a reference to a context object, and this may be a shared object to allow for state tracking.
Extends
Constructors
Constructor
new ServerMembership(
apiResponse,context):ServerMembership
Defined in: src/resources/server/membership.ts:12
Create a new Server-enabled Membership resource
Parameters
apiResponse
any
An API response
context
The resource's API context
Returns
ServerMembership
Overrides
Properties
_context
protected_context:ApiContext
Defined in: src/resource.ts:148
The API context for this resource.
Inherited from
business?
optionalbusiness?:Brand
Defined in: src/resources/membership.ts:63
The business who created the membership.
Inherited from
creditName?
optionalcreditName?:string
Defined in: src/resources/membership.ts:47
The type of ALANA Platform Credit provided by this membership.
Inherited from
credits?
optionalcredits?:number
Defined in: src/resources/membership.ts:42
The number of ALANA Platform Credits this membership provides per month as an incentive for subscribers.
Inherited from
description?
optionaldescription?:string
Defined in: src/resources/membership.ts:18
A freeform description of this membership.
Inherited from
features
features: [
any]
Defined in: src/resources/membership.ts:58
A freeform list of features included in the membership.
Inherited from
id
id:
number
Defined in: src/resources/membership.ts:8
The unique plan ID for this membership.
Inherited from
image?
optionalimage?:string
Defined in: src/resources/membership.ts:24
A cover image for this membership. This can be a logo or other image used to identify the membership plan for users.
Inherited from
name
name:
string
Defined in: src/resources/membership.ts:13
The name of this membership.
Inherited from
period?
optionalperiod?:number
Defined in: src/resources/membership.ts:36
The number of months this membership is paid for.
Inherited from
price?
optionalprice?:number
Defined in: src/resources/membership.ts:31
The base price of the membership. Note that this is a rate based on the period value. (e.g., a base price of 100 with a period of 1 costs $100/month, while the same base price with a period of 12 is $100/year.)
Inherited from
tier?
optionaltier?:number
Defined in: src/resources/membership.ts:53
A general tier level for the membership. Higher tiers allow access to members-only experiences and other resources.
Inherited from
Methods
cancel()
cancel():
Promise<boolean>
Defined in: src/resources/membership.ts:113
Cancel the active user's subscription to this membership plan. This operation will only cancel a membership for your ALANA partner site.
Returns
Promise<boolean>
true if the operation succeeded
Inherited from
changeTo()
changeTo():
Promise<Membership>
Defined in: src/resources/membership.ts:90
Change the active user's membership to this one. This action will replace any existing membership only for your ALANA partner site.
Returns
Promise<Membership>
The Membership resource representing the plan
Inherited from
checkout()
checkout(
successUrl,cancelUrl):Promise<MembershipCheckout>
Defined in: src/resources/membership.ts:190
Create a checkout session for the active user purchasing this membership. The result of calling this method is an object with a url string property. The caller MUST redirect the user to this URL to complete the checkout process.
Note that the checkout URL is hosted by Stripe.
Parameters
successUrl
string
The URL to redirect to after successfully completing checkout
cancelUrl
string
The URL to redirect to if the checkout is canceled
Returns
Promise<MembershipCheckout>
A URL and session ID
Inherited from
delete()
delete():
Promise<boolean>
Defined in: src/resources/server/membership.ts:55
Delete this membership plan from the ALANA Platform. This is a soft delete, allowing users who are currently subscribed using this plan to continue on it until their next billing cycle.
Returns
Promise<boolean>
true if the operation succeeded
pause()
pause(
months):Promise<boolean>
Defined in: src/resources/membership.ts:138
Pause the active user's membership to this subscription. This operation is only allowed on memberships for your ALANA partner site. After pausing, payments will not be collected until the duration of the pause has expired, or until the unpause() method is called on the same membership for the active user.
Parameters
months
number
The number of months to pause the membership
Returns
Promise<boolean>
true if the operation succeeded
Inherited from
unpause()
unpause():
Promise<boolean>
Defined in: src/resources/membership.ts:162
Unpause the active user's subscription to this membership. This operation is only permitted on memberships for your ALANA partner site. After calling this method, payments will resume following the active user's regular billing cycle. If this membership is not paused, this method has no effect.
Returns
Promise<boolean>
true if the operation succeeded
Inherited from
update()
update():
Promise<ServerMembership>
Defined in: src/resources/server/membership.ts:23
Update this membership. Note that this method currently cannot change the Coin associated with the membership, but it can remove any Coins rewards to the user for subscribing.
Returns
Promise<ServerMembership>
An updated Membership resource