Skip to content

Commit

Permalink
Add invoice items API
Browse files Browse the repository at this point in the history
(closes stripe#7)
  • Loading branch information
2sidedfigure committed Dec 2, 2011
1 parent 85effff commit d487c3d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -35,7 +35,7 @@ called with an error code (if any) and then the response.
* `.retrieve(charge_id)` - [retrieve a charge](https://stripe.com/docs/api#retrieve_charge) by charge id
* `.refund(charge_id, amount)` - [refund a given charge](https://stripe.com/docs/api#refund_charge), amount in cents
* `.list(data)` - [list charges](https://stripe.com/docs/api#list_charges)
* `stripe.customers` - create, retrieve, update and delete customers
* `stripe.customers` - create, retrieve, update, delete and list customers
* `.create(customer)` - [create a customer](https://stripe.com/docs/api#create_customer), takes the data as an object
* `.retrieve(customer_id)` - [retrieve a customer](https://stripe.com/docs/api#retrieve_customer) by customer id.
* `.update(customer_id, updates)` - [update a customer](https://stripe.com/docs/api#update_customer); `updates` is an object with new parameters
Expand All @@ -47,6 +47,12 @@ called with an error code (if any) and then the response.
* `.retrieve(invoice_id)` - [retrieve an existing invoice](https://stripe.com/docs/api?lang=curl#retrieve_invoice)
* `.upcoming(customer_id)` - [retrieve the upcoming invoice for a customer](https://stripe.com/docs/api?lang=curl#retrieve_customer_invoice)
* `.list(parameters)` - [list invoices](https://stripe.com/docs/api#list_customer_invoices)
* `stripe.invoice_items` - create, retrieve, update, delete and list invoice items
* `.create(invoice_item)` - [create a invoice item](https://stripe.com/docs/api#create_invoiceitem), takes the data as an object
* `.retrieve(invoice_item_id)` - [retrieve a invoice item](https://stripe.com/docs/api#retrieve_invoiceitem) by invoice item id.
* `.update(invoice_item_id, updates)` - [update a invoice item](https://stripe.com/docs/api#update_invoiceitem); `updates` is an object with new parameters
* `.del(invoice_item_id)` - [delete a invoice item](https://stripe.com/docs/api#delete_invoiceitem)
* `.list(customer_id, count, offset)` - [list invoice items](https://stripe.com/docs/api#list_invoiceitems); all parameters are optional
* `stripe.token` - [Tokens API](https://stripe.com/docs/api#tokens)
* `.create(card_data)` - [create a token](https://stripe.com/docs/api#create_token)
* `.retrieve(token_id)` - [retrieve a card token](https://stripe.com/docs/api#retrieve_token)
Expand Down
20 changes: 20 additions & 0 deletions lib/main.js
Expand Up @@ -155,6 +155,26 @@ module.exports = function (api_key, options) {
get("/v1/invoices/upcoming", { customer: customer_id }, cb);
},
},
invoice_items: {
create: function(data, cb) {
post("/v1/invoiceitems", data, cb);
},
retrieve: function(invoice_item_id, cb) {
if (!(invoice_item_id && typeof invoice_item_id === 'string')) {
cb("invoice_item_id required");
}
get("/v1/invoiceitems/" + invoice_item_id, {}, cb);
},
update: function(invoice_item_id, data, cb) {
post("/v1/invoiceitems/" + invoice_item_id, data, cb);
},
del: function(invoice_item_id, cb) {
del("/v1/invoiceitems/" + invoice_item_id, {}, cb);
},
list: function(customer_id, count, offset, cb) {
get("/v1/invoiceitems", { customer: customer_id, count: count, offset: offset}, cb );
}
},
token: {
create: function (data, cb) {
post("/v1/tokens", data, cb)
Expand Down

0 comments on commit d487c3d

Please sign in to comment.