How To Integrate CheddarGetter in Your Subscription Module? | Blog-1| Hosted Page and Service Hook
CheddarGetter provides a full-featured, easy-to-use billing & subscription management system. CheddarGetter API enables you to leverage the full power of CheddarGetter directly into your subscription module. You can use these APIs with any programming language for recurring billing and subscription management.
In one of my projects, I have used Java to interact with CheddarGetter, but you can use Ruby, Python, PHP and C# to interact with CheddarGetter. CheddarGetter API utilizes REST-like interface where method calls are made by sending HTTP GET or POST requests. Response data is returned in XML format. The response contains an HTTP status code of 200 for a successful request. A status code of 400 or greater is returned upon an adverse condition. That makes handling errors quite simple.
Configuration:
To integrate your subscription module with CheddarGetter you will go to the https://cheddargetter.com and need to follow below steps:
1. Sign-up in CheddarGetter:
At first, you need to sign-up in CheddarGetter with a valid email id. After sign-up you will receive a verification link in your registered email, after clicking on that link, verification will be done and you would get redirected to product setup page.
2. Product setup:
To setup your own product in CheddarGetter, you have to specify a product name.
After specifying the product name CheddarGetter automatically creates a product code and secret key through which you can link up your subscription module with CheddarGetter, you can see that information in “Configuration”->”Product Settings” tab in CheddarGetter. You can specify more product related setting here as per your requirement.
3. Pricing Plan:
Here you can specify different types of pricing plan as per your product requirement. Pricing Plans tell CheddarGetter how much your customers pay, how often, and what they get in return. To configure pricing plan manually you have to go “Configuration” → “Pricing Plan”, here you can create a new plan or edit any existing plan.
4. Billing Solution:
In Billing Solution, you have to specify the method to process the customer payment that is Paypal or Credit-Card or both.
5. Integration:
You can integrate CheddarGetter with your site using CheddarGetter’s API, Hosted Payment Pages, or a combination of the both. Here you can specify your own custom curl request or specify custom hosted payment page. Here I’m specifying to integrate CheddarGetter with your subscription module using “Hosted Page” and “Web Hooks”.
Hosted Page is a payment page provide by CheddarGetter where a user can subscribe, or any existing user can renew his/her subscription by providing credit card details or through PayPal.
Other Configurations:
After quick setup few more things need to configure manually in CheddarGetter, for the betterment of your subscription module:
1. Product Settings:
To configure Product Settings manually you have to go to “Configuration” → “Product Settings” tab and specify the “Dunning Schedule” as per your requirement. Here you need to specify the period in days for retrying when a transaction failed and how many times it will be retrying. You also need to configure “Subscription Field” as per your requirements and “Bill Reminder Event” sends a reminder to the customer before the expiry of the plan.
2. Promotions:
Configuration → Promotions
Promotions are the best thing ever. You can use Promotions to increase demand and differentiate your product. You can use incentives like discounts to drive up sales of any given product. You can create a new promotion or modify the existing promotion or you can delete a promotion from “Configuration” → “Promotions” tab. To create a new promotion you have to specify these mandatory fields: coupon name, description, incentive type, discount amount, coupon validity duration, coupon code through which customer applied for the discount. Remaining fields are optional like “limit of redemptions” by which you can set total redemption limit of that coupon, “coupon expiry date” specifies the date after that it will be expired etc.
3. Customer Communication:
“Configuration” → “Customer Communication”.
Using this feature of CheddarGetter we can communicate with our customers through email for several activities like New Subscription, Subscription Change, Bill Reminder etc. We can customize that entire facility, for any particular service we can enable or disable the email notification, email subject, body etc.
4. Service Hooks:
“Configuration” → “Service Hooks”.
This is one of the most important features of CheddarGetter. It allows you to use “Custom URL” facility of Service Hooks. When the Custom URL service hook is enabled, CheddarGetter sends HTTP POST data to the URL when various events occur in CheddarGetter. Here we have to specify our listener URL and services. If any activity/service is performed which is mentioned in Selected list CheddarGetter send HTTP POST request to your specified custom URL. You can create more than one “Custom URL Hook” as per your need and enable and disable them.
Sample Code to Handle Service Hooks:
@RequestMapping(value = “activity”, method = RequestMethod.POST)
@ResponseBody
public void activity(HttpEntity<String> httpEntity) {
ResponseDTO responseDTO = new ResponseDTO(false);
Map<String, Object> jsonMap = validatedRequestJson(httpEntity);
if (jsonMap != null) {
if (jsonMap.containsKey(“activityType”)) {
ActivityType activityType = ActivityType.findByValue(jsonMap.get(“activityType”).toString());
if (activityType != null) {
switch (activityType) {
case “newSubscription”:
responseDTO = newSubscription(jsonMap);
break;
case “subscriptionChanged”:
responseDTO = subscriptionChanged(jsonMap);
break;
case “subscriptionCanceled”:
responseDTO = subscriptionCanceled(jsonMap);
break;
case “subscriptionReactivated”:
responseDTO = subscriptionReactivated(jsonMap);
break;
case “customerDeleted”:
responseDTO = customerDeleted(jsonMap);
break;
case “transaction”:
responseDTO = transaction(jsonMap);
break;
default:
System.out.println(“ACTIVITY <” + jsonMap.get(“activityType”) + “> IS NOT RECOGNISED”);
}
}
}
}
}
Cheddargetter largely simplifies billing and subscription processes. Moreover, it has a mobile friendly interface that enables you to check critical metrics anytime, anywhere and it also provides for real-time updates about your business.