Skip to content

billabear/javascript-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BillaBear - JavaScript client for BillaBear The REST API provided by BillaBear This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.javascript.JavaScriptClientCodegen For more information, please visit http://www.billabear.com/support

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install billa_bear --save

git

If the library is hosted at a git repository, e.g. https://github.com/billabear/go-sdk then install it via:

    npm install billabear/go-sdk --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var BillaBear = require('billa_bear');
var defaultClient = BillaBear.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
var 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['X-API-Key'] = "Token"

var api = new BillaBear.CheckoutApi()
var body = new BillaBear.CheckoutBody(); // {CheckoutBody} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createCheckout(body, callback);

Documentation for API Endpoints

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

Class Method HTTP request Description
BillaBear.CheckoutApi createCheckout POST /checkout Create Checkout
BillaBear.CustomersApi addSeatsSubscriptions POST /subscription/{subscriptionId}/seats/add Add Seats
BillaBear.CustomersApi applyVoucherToCustomer POST /customer/{customerId}/voucher Apply voucher
BillaBear.CustomersApi createCustomer POST /customer Create
BillaBear.CustomersApi createCustomerUsageLimit POST /customer/{customerId}/uasge-limit Create Usage Limit
BillaBear.CustomersApi customerCustomerIdUasgeLimitLimitIdDelete DELETE /customer/{customerId}/uasge-limit/{limitId} Delete Usage Limit
BillaBear.CustomersApi disableCustomer POST /customer/{customerId}/disable Disable Customer
BillaBear.CustomersApi enableCustomer POST /customer/{customerId}/enable Enable Customer
BillaBear.CustomersApi getActiveForCustomer GET /customer/{customerId}/subscription/active List Customer Active Subscriptions
BillaBear.CustomersApi getAllCustomers GET /customer List
BillaBear.CustomersApi getCustomerById GET /customer/{customerId} Detail
BillaBear.CustomersApi getCustomerCosts GET /customer/{customerId}/costs Usage Cost Estimate
BillaBear.CustomersApi getCustomerLimitsById GET /customer/{customerId}/limits Fetch Customer Limits
BillaBear.CustomersApi getCustomerUsageLimitsById GET /customer/{customerId}/uasge-limit Fetch Customer Usage Limits
BillaBear.CustomersApi getForCustomer GET /customer/{customerId}/subscription List Customer Subscriptions
BillaBear.CustomersApi getInvoicesForCustomer GET /customer/{customerId}/invoices List Customer Invoices
BillaBear.CustomersApi getPaymentsForCustomer GET /customer/{customerId}/payment List Customer Payments
BillaBear.CustomersApi getRefundsForCustomer GET /customer/{customerId}/refund List Customer Refunds
BillaBear.CustomersApi listPaymentDetails GET /customer/{customerId}/payment-methods List Customer's Payment Details
BillaBear.CustomersApi removeSeatsSubscriptions POST /subscription/{subscriptionId}/seats/remove Remove Seats
BillaBear.CustomersApi updateCustomer PUT /customer/{customerId} Update
BillaBear.InvoicesApi chargeInvoice POST /invoice/{invoiceId}/charge Charge Invoice
BillaBear.InvoicesApi downloadInvoice GET /invoice/{invoiceId}/download Download Invoice
BillaBear.InvoicesApi getInvoicesForCustomer GET /customer/{customerId}/invoices List Customer Invoices
BillaBear.PaymentDetailsApi completeFrontendPaymentDetails POST /customer/{customerId}/payment-methods/frontend-payment-token Complete Frontend Detail Collection
BillaBear.PaymentDetailsApi deletePaymentDetails DELETE /payment-methods/{paymentDetailsId} Delete
BillaBear.PaymentDetailsApi deletePaymentDetailsCustomer DELETE /customer/{customerId}/payment-methods/{paymentDetailsId} Delete With Customer
BillaBear.PaymentDetailsApi getPaymentDetails GET /payment-methods/{paymentDetailsId} Fetch
BillaBear.PaymentDetailsApi listPaymentDetails GET /customer/{customerId}/payment-methods List Customer's Payment Details
BillaBear.PaymentDetailsApi makeDefaultPaymentDetails POST /payment-methods/{paymentDetailsId}/default Make Default
BillaBear.PaymentDetailsApi makeDefaultPaymentDetailsCustomer POST /customer/{customerId}/payment-methods/{paymentDetailsId}/default Make Default With Customer
BillaBear.PaymentDetailsApi startFrontendPaymentDetails GET /customer/{customerId}/payment-methods/frontend-payment-token Start Frontend Detail Collection
BillaBear.PaymentsApi chargeInvoice POST /invoice/{invoiceId}/charge Charge Invoice
BillaBear.PaymentsApi downloadInvoice GET /invoice/{invoiceId}/download Download Invoice
BillaBear.PaymentsApi downloadReceipt GET /receipt/{receiptId}/download Download Receipt
BillaBear.PaymentsApi getInvoicesForCustomer GET /customer/{customerId}/invoices List Customer Invoices
BillaBear.PaymentsApi getPaymentsForCustomer GET /customer/{customerId}/payment List Customer Payments
BillaBear.PaymentsApi listPayment GET /payment List
BillaBear.PaymentsApi refundPayment POST /payment/{paymentId}/refund Refund Payment
BillaBear.PricesApi createPrice POST /product/{productId}/price Create
BillaBear.PricesApi listPrice GET /product/{productId}/price List
BillaBear.ProductsApi createProduct POST /product Create
BillaBear.ProductsApi listProduct GET /product List
BillaBear.ProductsApi showProductById GET /product/{productId} Detail
BillaBear.ProductsApi updateProduct PUT /product/{productId} Update
BillaBear.ReceiptApi downloadReceipt GET /receipt/{receiptId}/download Download Receipt
BillaBear.RefundsApi getRefundsForCustomer GET /customer/{customerId}/refund List Customer Refunds
BillaBear.RefundsApi listRefund GET /refund List
BillaBear.RefundsApi showRefundById GET /refund/{refundId} Detail
BillaBear.SubscriptionsApi addSeatsSubscriptions POST /subscription/{subscriptionId}/seats/add Add Seats
BillaBear.SubscriptionsApi cancelSubscription POST /subscription/{subscriptionId}/cancel Cancel Subscription
BillaBear.SubscriptionsApi changeSubscriptionPrice POST /subscription/{subscriptionId}/price Change Price
BillaBear.SubscriptionsApi createSubscription POST /customer/{customerId}/subscription/start Create Subscription
BillaBear.SubscriptionsApi customerChangeSubscriptionPlan POST /subscription/{subscriptionId}/plan Change Subscription Plan
BillaBear.SubscriptionsApi extendTrial POST /subscription/{subscriptionId}/extend Extend Trial Subscription
BillaBear.SubscriptionsApi getActiveForCustomer GET /customer/{customerId}/subscription/active List Customer Active Subscriptions
BillaBear.SubscriptionsApi getForCustomer GET /customer/{customerId}/subscription List Customer Subscriptions
BillaBear.SubscriptionsApi listSubscriptionPlans GET /subscription/plans List Subscription Plans
BillaBear.SubscriptionsApi listSubscriptions GET /subscription List
BillaBear.SubscriptionsApi removeSeatsSubscriptions POST /subscription/{subscriptionId}/seats/remove Remove Seats
BillaBear.SubscriptionsApi showSubscriptionById GET /subscription/{subscriptionId} Detail
BillaBear.SubscriptionsApi startTrial POST /customer/{customerId}/subscription/trial Start Trial Subscription For Customer
BillaBear.UsageApi createCustomerUsageLimit POST /customer/{customerId}/uasge-limit Create Usage Limit
BillaBear.UsageApi createEvent POST /events Create Event
BillaBear.UsageApi customerCustomerIdUasgeLimitLimitIdDelete DELETE /customer/{customerId}/uasge-limit/{limitId} Delete Usage Limit
BillaBear.UsageApi getCustomerCosts GET /customer/{customerId}/costs Usage Cost Estimate
BillaBear.UsageApi getCustomerUsageLimitsById GET /customer/{customerId}/uasge-limit Fetch Customer Usage Limits

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header