Polling CG API for item counts

Dan's Avatar

Dan

11 Jun, 2010 03:16 PM

For our pricing structure, we want to be able to sell "plugins", which are either turned on or off for any given account. If they are turned on, the account is charged a certain amount per month. The way I aimed to achieve this with the CG API (and correct me if I'm going in the wrong direction here) was to add items to pricing plans with an included amount of 0, an overage amount equal to the amount that the plugin would cost for a given month, and the "Monthly" field unchecked (we would enforce the hard limit of one by storing the activation of the plugin in a flag on our end).

Currently, I am trying to write a test to ensure that adding and removing a given item to/from an account is working. I'm using Hashrocket's Mousetrap wrapper, so the only API responses I've seen so far have been intercepted and built into Ruby objects -- except Mousetrap, as written, doesn't handle items. I've modified it to add/remove items, and now I'm just trying to find out if there's anything in the API that will return item usage for a given customer so I can extend Mousetrap to represent those too. I haven't seen anything in the request dictionary that shed any light on this one, but maybe I missed something.

  1. Support Staff 1 Posted by Marc Guyer on 11 Jun, 2010 03:41 PM

    Marc Guyer's Avatar

    Dan -- You're exactly correct on your usage of the tracked items.

    We'll check into your Mousetrap question. There are many forks that have extended functionality. You might choose to merge one into your fork to take advantage of their work. I'll see if one of the authors can comment.

  2. 2 Posted by Dan on 11 Jun, 2010 03:46 PM

    Dan's Avatar

    Cool, thanks!

    I just curled and looked at the xml output, and saw that item usage seems to be included as part of the subscription. So I can use this to keep busy in the meantime, haha.

  3. Dean closed this discussion on 16 Jan, 2013 02:57 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM