Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Subscriptions

Index

Constructors

constructor

Properties

Private Readonly store

store: Store

Methods

add

  • Add a subscription to an account for the first time.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.add({
      Account: {
        Uid: accountUid
      },
      Plan: {
        Uid: planUid
      },
      BillingRenewalTerm: 1 // Monthly, 2 for Annually
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    Returns Promise<Subscription | ValidationError<Subscription>>

    The response body if response status OK, or response body of validation errors if response status 400.

changeTrialToSubscribed

  • Convert a trial into a subscription.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.changeTrialToSubscribed(uid);
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • uid: string

      The uid of the subscription to convert to a subscription.

    Returns Promise<null | ValidationError<Account>>

    Null if the response status OK, or response body of validation errors if response status 400.

get

  • get(uid: string, options?: { fields?: string }): Promise<Subscription>
  • Get a specific subscription from Outseta:

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.get(uid);
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • uid: string

      The uid of the subscription to retrieve.

    • options: { fields?: string } = {}
      • Optional fields?: string

        Not all fields on the model are returned by default - you can request specific fields with a that looks something like ',Plan.,Account.Uid'. Note: the shape of the returned object may not match the model in this library if this string does not start with '*' as shown.

    Returns Promise<Subscription>

    The response body if response status OK.

getAll

  • getAll(options?: { Account?: Required<Pick<Account, "Uid">>; fields?: string; limit?: number; offset?: number }): Promise<List<Subscription>>
  • Get all subscriptions from Outseta:

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.getAll();
    console.log(response);
    

    Get all subscriptions for a particular account from Outseta:

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const Account = {
      Uid: 'jW7GJVWq'
    };
    const response = await client.billing.subscriptions.getAll({ Account });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • options: { Account?: Required<Pick<Account, "Uid">>; fields?: string; limit?: number; offset?: number } = {}
      • Optional Account?: Required<Pick<Account, "Uid">>

        Get all subscriptions only for a particular account.

      • Optional fields?: string

        Not all fields on the model are returned by default - you can request specific fields with a that looks something like ',Plan.,Account.Uid'. Note: the shape of the returned object may not match the model in this library if this string does not start with '*' as shown.

      • Optional limit?: number

        The number of results returned by the API.

      • Optional offset?: number

        For pagination; returns (limit) results after this value.

    Returns Promise<List<Subscription>>

    The response body if response status OK.

previewAdd

  • Like add, but returns an Invoice object without actually saving any changes. Used to show the user what they would be charged.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.previewAdd({
      Account: {
        Uid: accountUid
      },
      Plan: {
        Uid: planUid
      },
      BillingRenewalTerm: 1 // Monthly, 2 for Annually
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    Returns Promise<ValidationError<Subscription> | ChargeSummary>

    The response body if response status OK, or response body of validation errors if response status 400.

previewUpdate

  • Like update, but returns an Invoice object without actually saving any changes. Used to show the user what they would be charged.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.previewUpdate({
      Uid: uid,
      Account: {
        Uid: accountUid
      },
      Plan: {
        Uid: planUid
      },
      SubscriptionAddOns: [],
      BillingRenewalTerm: 1 // Monthly, 2 for Annually
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    Returns Promise<ValidationError<Subscription> | ChargeSummary>

    The response body if response status OK, or response body of validation errors if response status 400.

setSubscriptionUpgradeRequired

  • Set the "subscription upgrade required" flag on the subscription.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.setSubscriptionUpgradeRequired({
      IsPlanUpgradeRequired: true,
      PlanUpgradeRequiredMessage: 'Usage too high',
      Uid: 'LmJMEYWP'
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • subscription: SubscriptionUpgradeRequired

      The subscription with 'IsPlanUpgradeRequired' and a 'PlanUpgradeRequiredMessage' if desired.

    Returns Promise<Subscription | ValidationError<null>>

    The response body if response status OK, or response body of validation errors if response status 400.

update

  • Update an existing subscription.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.subscriptions.update({
      Uid: uid,
      Account: {
        Uid: accountUid
      },
      Plan: {
        Uid: planUid
      },
      SubscriptionAddOns: [],
      BillingRenewalTerm: 1 // Monthly, 2 for Annually
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    Returns Promise<Subscription | ValidationError<Subscription>>

    The response body if response status OK, or response body of validation errors if response status 400.

Generated using TypeDoc