Amazon CloudWatch is a monitoring service for AWS cloud resources and the applications you run on AWS.
Chargebee is a subscription management and recurring billing application that helps SaaS and SaaS-like enterprises streamline revenue operations. Chargebee works with the world's most popular payment gateways.
It's easy to connect Amazon CloudWatch + Chargebee without coding knowledge. Start creating your own business flow.
Triggers when a new log is created.
Triggers when customer details such as first name, last name, email, billing address, etc., are updated.
Triggers when a customer is created.
Triggers when a new invoice is generated(with line item support).
Triggers when a payment is collected successfully.
Triggers when a subscription is created.
Triggers when a payment fails.
Triggers when a subscription is cancelled.
Triggers when a subscription is scheduled for cancellation.
Triggers when subscription details such as custom fields, billing information, recurring items etc., are modified.
Triggers when a subscription is paused.
Triggers when a paused subscription is resumed.
Updates next billing date of a subscription.
Creates a new customer in Chargebee.
Creates a new subscription along with the customer in Chargebee. This action does not support adding subscription to an existing customer.
Pauses a subscription in Chargebee.
Records an offline payment for unpaid invoices.
Resumes a paused subscription in Chargebee
Updates customer details in Chargebee.
Amazon CloudWatch is a monitoring service that provides detailed statistics and other information on the computing resources of Amazon Web Services (AWS. It was originally launched in 2009 and has been running successfully ever since. CloudWatch can be integrated with any other AWS service, not just Chargebee. However, we choose to integrate it with Chargebee and here is why.
Chargebee is an online subscription management platform which helps retailers and subscription companies to run their entire business from one single dashboard. They provide customers with an overview of their subscriptions, so they can manage it easily and effectively by themselves.
We will use a simple approach to integration of Amazon CloudWatch and Chargebee. We want to create an alert for Chargebee based on the metrics provided by CloudWatch. In order to do this, we need to add a new metric from CloudWatch to Chargebee. We will do this by using an API created by Chargebee itself called “ChargeBee API”. This API will allow us to send the data generated by CloudWatch to Chargebee, and Chargebee will take care of creating an alert based on the data received.
We will first log in to AWS conspe and go to CloudWatch Conspe where we can configure our metrics. We will create a new alarm based on the fplowing criteria:
Metric Name. Session Duration (in minutes)
Threshpd. 120 minutes (2 hours)
Alarm Name. Session Duration Alarm
Next, we will go to ChargeBee dashboard, and click on “API Explorer”. Then, we must select the “New API” button and then click on “Create New API”. We will create a new API named “CloudWatch-ChargeBee”. We will provide a name for the API as well as its description. Next, we are required to enter the endpoint URLs of our application; in our case, the URL is https://cloudrw.chargebee.com/api/v1/apps/app_id/. After this, we have to click on “Create API” button. On the next screen, we have to “click on Create API key”. This time, we have to provide a Name for the key as well as its description. We will then copy the API key and paste it into ChargeBee configuration file in our application directory at /config/initializers/chargebee_api_key.rb .
Now we can start creating an integration between Amazon CloudWatch and Chargebee. First, we must include the gem “chargebee-api-client” into our Rails application by adding this line into Gemfile :
gem 'chargebee-api-client' , '~> 1.0'
We must also run bundle install to install it. Then, we must require this gem in config/initializers/chargebee_api_key.rb as fplows:
Finally, we have to configure ChargeBee by adding some settings like api_key , api_secret , app_id etc into chargebee.yml . We will have to add these lines into app/models/chargebee_client.rb :
chargebee_config = YAML . load ( File . read ( File . expand_path ( "../../config/initializers/chargebee_api_key.rb" )). chargebee = ChargeBee :. Client . new ( chargebee_config [ "client" ][ "api_key" ], chargebee_config [ "client" ][ "api_secret" ]. chargebee . app_id = chargebee_config [ "client" ][ "app_id" ] chargebee . version = chargebee_config [ "client" ][ "version" ] chargebee . locale = chargebee_config [ "client" ][ "locale" ] chargebee . currency = chargebee_config [ "client" ][ "currency" ] chargebee . enable = chargebee_config [ "client" ][ "enable" ]
The process to integrate Amazon CloudWatch and Chargebee may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.