Goals and Status
This module will simplify the process of integrating Cheddar into your existing node.js apps.
getAllPricingPlans()
getPricingPlan(planCode)
getAllCustomers([searchParams])
getCustomer(customerCode)
createCustomer(customerData)
editCustomerAndSubscription(customerData)
orupdateCustomerAndSubscription(customerData)
editCustomer(customerCode, customerData)
orupdateCustomer(customerCode, customerData)
editSubscription(customerCode, customerData)
orupdateSubscription(customerCode, customerData)
deleteCustomer(customerCode)
cancelSubscription(customerCode)
addItem(customerCode, itemCode, [amount])
removeItem(customerCode, itemCode, [amount])
setItemQuantity(customerCode, itemCode, amount)
addCustomCharge(customerCode, chargeCode, quantity, amount, description)
deleteCustomCharge(customerCode, chargeId)
resendInvoiceEmail(idOrNumber)
oneTimeInvoice(customerCode, {data})
All methods return a promise with the requested data.
Callbacks are available for backwards compatibility and are called with error
and results
parameters.
Not all API calls have been fully tested yet.
Install
npm install cg
Usage
var Cheddar = ; var cheddar = "email@example.com" "passwordExample" "ProductCode"; cheddar;
Proxy
You might want to set up a proxy to communicate with Cheddar. Cheddar blocks most of the Heroku servers (a range of AWS IPs):
Recently, a large block of IPs on the Heroku platform were listed by DenyHosts due to a spike in SSH brute force attacks coming from the Heroku platform. In short, you need to be coming from an IP that isn't listed.
A proxy host is easily set with the CHEDDAR_HOST
environment variable:
CHEDDAR_HOST=example.com node your-server.js
Tests
First add a config file (config.json
) with all your CheddarGetter credentials:
"email": "EMAIL" "pass": "PASSWORD" "productCode": "PRODUCTCODE" "planCode": "PLANCODE" "itemCode": "ITEMCODE"
npm test
Credits
Original work was done by Kevin Smith.