Skip to content

isabella232/moesif-chargebee-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moesif Chargebee Example

An example app integrating Moesif with Chargebee for usage-based billing based Tutorial to Set Up Usage-Based API Billing with Moesif and Chargebee

  • Moesif handles API metering and providing usage metrics to customers
  • Chargebee handles invoicing customers and accepting payments through a gateway like Stripe.

Embedded billing dashboard

This example app does a few things:

  1. Sync Chargebee Subscription info to Moesif
  2. Handle metered billing webhooks of type pending_invoice_created
  3. Calculate the usage by querying Moesif's Management API
  4. Add a line-item charged based on API usage for that customer

How to run this example.

  1. Install all dependencies:
npm install
  1. Set the following environment variables
Environment variable Description
CHARGEBEE_SITE The slug of your Chargebee site which is the subdomain when logging into your dashboard.
CHARGEBEE_API_KEY A Chargebee API key that has at least read access to both subscriptions and customers.
CHARGEBEE_WEBHOOK_USERNAME The username you define when creating a new webhook in Chargebee
CHARGEBEE_WEBHOOK_PASSWORD The password you define when creating a new webhook in Chargebee
MOESIF_APPLICATION_ID Your Moesif Application Id displayed during onboarding and found under the API keys menu in Moesif
MOESIF_MANAGEMENT_API_KEY A generated management API key which has the scope read:events which can be found under the API keys menu in Moesif
  1. Run the example, it will listen on port 5000.
node index.js
  1. Verify the app works:
  • Your Chargebee users and companies will be synced to your Moesif app
  • Set up a Chargebee webhook to the app's endpoint POST /chargebee/webhooks

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%