Skip to content

Play! framework module for integration with CheddarGetter subscription management API

Notifications You must be signed in to change notification settings

lmcalpin/Play--Cheese

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

play—cheese

play—cheese (http://github.com/lmcalpin/Play—Cheese) is a Play! framework module
that adds some basic support for integration with the CheddarGetter subscription
management service’s API.

create a customer

To use Play—Cheese, you must first configure your service. This requires your CheddarGetter! credentials and
the product code for your service.

 
    Service sub = new Service("account", "password", "productCode");

Your account and password could also come from your standard Play! application.conf:


    cg.user=notactuallymyaccount@account.com
    cg.password=notreallymypassword

Then you simply have to create a Service object using the productCode you used when you set up the product on the
CheddarGetter! admin console.

 
    Service sub = new Service("productCode");

Then you can create a customer by simply calling addCustomer and providing a plan code that you set up on the
CheddarGetter! admin console.


    Customer customer = sub.addCustomer(customerCode, firstName, lastName, email, planCode);
    Customer customer = sub.addCustomer(customerCode, firstName, lastName, email, planCode, creditCard);

You do not have to take in a credit card if the plan is free.

You can retrieve the customer you just created by calling getCustomer:


    Customer customer = sub.getCustomer("customerCode");

subscriptions

A customer can subscribe to one or more of your product plans:


    customer.subscribe(planCode, creditCard);

At any time, you can cancel the customer’s current subscription plan. This change takes effect IMMEDIATELY.


    customer.cancel();

usage tracking

To track item usage, call addItemUsage or setItemUsage on the Customer object. This is used to track how much of
a limited quantity of a particular feature that a customer has used. For example, if you have a SocialMobileLocal
startup that allows users 500 SpecialDealNotifications a month, you would set up a plan with an item with a limited
quantity of 500, and every time the customer received a SuperDuperDealNotification, you would increment their use
of that Item as follows:


    customer.addItemUsage("SuperDuperDealNotification", BigDecimal.ONE);

You can also just set the full amount as well:


    customer.setItemUsage("SuperDuperDealNotification", new BigDecimal("499"));

About

Play! framework module for integration with CheddarGetter subscription management API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published