Skip to content

Latest commit

 

History

History
692 lines (496 loc) · 20.7 KB

SubscriptionsApi.md

File metadata and controls

692 lines (496 loc) · 20.7 KB

BillaBear.SubscriptionsApi

All URIs are relative to https://{customerId}.billabear.cloud/api/v1

Method HTTP request Description
addSeatsSubscriptions POST /subscription/{subscriptionId}/seats/add Add Seats
cancelSubscription POST /subscription/{subscriptionId}/cancel Cancel Subscription
changeSubscriptionPrice POST /subscription/{subscriptionId}/price Change Price
createSubscription POST /customer/{customerId}/subscription/start Create Subscription
customerChangeSubscriptionPlan POST /subscription/{subscriptionId}/plan Change Subscription Plan
extendTrial POST /subscription/{subscriptionId}/extend Extend Trial Subscription
getActiveForCustomer GET /customer/{customerId}/subscription/active List Customer Active Subscriptions
getForCustomer GET /customer/{customerId}/subscription List Customer Subscriptions
listSubscriptionPlans GET /subscription/plans List Subscription Plans
listSubscriptions GET /subscription List
removeSeatsSubscriptions POST /subscription/{subscriptionId}/seats/remove Remove Seats
showSubscriptionById GET /subscription/{subscriptionId} Detail
startTrial POST /customer/{customerId}/subscription/trial Start Trial Subscription For Customer

addSeatsSubscriptions

InlineResponse20011 addSeatsSubscriptions(body, subscriptionId)

Add Seats

Adds seats to a per seat subscription<br><br><strong>Since 1.1.4</strong>

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SeatsAddBody(); // SeatsAddBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.addSeatsSubscriptions(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SeatsAddBody
subscriptionId String The id of the subscription to retrieve

Return type

InlineResponse20011

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

cancelSubscription

'String' cancelSubscription(body, subscriptionId)

Cancel Subscription

Info for a specific subscription

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionIdCancelBody(); // SubscriptionIdCancelBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.cancelSubscription(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionIdCancelBody
subscriptionId String The id of the subscription to retrieve

Return type

'String'

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

changeSubscriptionPrice

InlineResponse20011 changeSubscriptionPrice(body, subscriptionId)

Change Price

Changes the price being used for a price. Useful for changing pricing schedule or just price.

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionIdPriceBody(); // SubscriptionIdPriceBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.changeSubscriptionPrice(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionIdPriceBody
subscriptionId String The id of the subscription to retrieve

Return type

InlineResponse20011

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createSubscription

Subscription createSubscription(body, customerId)

Create Subscription

Create subscription for a customer

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionStartBody(); // SubscriptionStartBody | 
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.createSubscription(body, customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionStartBody
customerId String The id of the customer to retrieve

Return type

Subscription

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customerChangeSubscriptionPlan

Subscription customerChangeSubscriptionPlan(body, subscriptionId)

Change Subscription Plan

Change the subscription plan for a customer

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionIdPlanBody(); // SubscriptionIdPlanBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.customerChangeSubscriptionPlan(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionIdPlanBody
subscriptionId String The id of the subscription to retrieve

Return type

Subscription

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

extendTrial

Subscription extendTrial(body, subscriptionId)

Extend Trial Subscription

Extend a trial subscription so it's converted from a trial to a normal subscription.

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionIdExtendBody(); // SubscriptionIdExtendBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.extendTrial(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionIdExtendBody
subscriptionId String The id of the subscription to retrieve

Return type

Subscription

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getActiveForCustomer

InlineResponse2006 getActiveForCustomer(customerId)

List Customer Active Subscriptions

List all Active customer subscriptions

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.getActiveForCustomer(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2006

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getForCustomer

InlineResponse2006 getForCustomer(customerId)

List Customer Subscriptions

List all customer subscriptions<br><br><strong>Since 1.1</strong>

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.getForCustomer(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String The id of the customer to retrieve

Return type

InlineResponse2006

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listSubscriptionPlans

InlineResponse20010 listSubscriptionPlans(opts)

List Subscription Plans

List all subscriptions plans

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let opts = { 
  'limit': 56, // Number | How many items to return at one time (max 100)
  'lastKey': "lastKey_example" // String | The key to be used in pagination to say what the last key of the previous page was
};
apiInstance.listSubscriptionPlans(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
limit Number How many items to return at one time (max 100) [optional]
lastKey String The key to be used in pagination to say what the last key of the previous page was [optional]

Return type

InlineResponse20010

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

listSubscriptions

InlineResponse2006 listSubscriptions(opts)

List

List all subscriptions

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let opts = { 
  'limit': 56, // Number | How many items to return at one time (max 100)
  'lastKey': "lastKey_example" // String | The key to be used in pagination to say what the last key of the previous page was
};
apiInstance.listSubscriptions(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
limit Number How many items to return at one time (max 100) [optional]
lastKey String The key to be used in pagination to say what the last key of the previous page was [optional]

Return type

InlineResponse2006

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

removeSeatsSubscriptions

InlineResponse20011 removeSeatsSubscriptions(body, subscriptionId)

Remove Seats

Remove seats to a per seat subscription<br><br><strong>Since 1.1.4</strong>

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SeatsRemoveBody(); // SeatsRemoveBody | 
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.removeSeatsSubscriptions(body, subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SeatsRemoveBody
subscriptionId String The id of the subscription to retrieve

Return type

InlineResponse20011

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

showSubscriptionById

Subscription showSubscriptionById(subscriptionId)

Detail

Info for a specific subscription

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let subscriptionId = "subscriptionId_example"; // String | The id of the subscription to retrieve

apiInstance.showSubscriptionById(subscriptionId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
subscriptionId String The id of the subscription to retrieve

Return type

Subscription

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

startTrial

Subscription startTrial(body, customerId)

Start Trial Subscription For Customer

Start subscription for a customer

Example

import {BillaBear} from 'billa_bear';
let defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';

let apiInstance = new BillaBear.SubscriptionsApi();
let body = new BillaBear.SubscriptionTrialBody(); // SubscriptionTrialBody | 
let customerId = "customerId_example"; // String | The id of the customer to retrieve

apiInstance.startTrial(body, customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body SubscriptionTrialBody
customerId String The id of the customer to retrieve

Return type

Subscription

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json