Permalink
Browse files

Added Invoices and minor fixes to Charges

- Nomenclature. "charge"  is now "charges"
- Refund now correctly uses POST instead of GET
- Added initial Invoices API implementation
  • Loading branch information...
Chris
Chris committed Oct 4, 2011
1 parent 8f9f0c4 commit 69ccce025faa604191473c093df98c46e682f2ba
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/main.js
View
@@ -90,7 +90,7 @@ module.exports = function (api_key, options) {
}
return {
- charge: {
+ charges: {
create: function (data, cb) {
post("/v1/charge", data, cb);
},
@@ -104,7 +104,7 @@ module.exports = function (api_key, options) {
if(!(charge_id && typeof charge_id === 'string')) {
cb("charge_id required");
}
- get("/v1/charges/" + charge_id + "/refund", { amount: amount }, cb);
+ post("/v1/charges/" + charge_id + "/refund", { amount: amount }, cb);
},
list: function(count, offset, customer, cb) {
get("/v1/charges", { count: count, offset: offset, customer: customer}, cb);
@@ -130,6 +130,17 @@ module.exports = function (api_key, options) {
get("/v1/customers", { count: count, offset: offset}, cb );
}
},
+ invoices: {
+ retrieve: function(invoice_id, cb) {
+ get("/v1/invoices/" + invoice_id, {}, cb);
+ },
+ list: function(customer_id, id, offset, cb) {
+ get("/v1/invoices", { customer: customer_id, id: id, offset: offset }, cb);
+ },
+ upcoming: function(customer_id, cb) {
+ get("/v1/invoices/upcoming", { customer: customer_id }, cb);
+ },
+ },
token: {
create: function (data, cb) {
post("/v1/tokens", data, cb)

2 comments on commit 69ccce0

abh replied Oct 4, 2011

Looks good. No tests or docs though! :-)

Owner

mrcwinn replied Oct 4, 2011

Please sign in to comment.