Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add invoice items API

(closes #7)
  • Loading branch information...
commit d487c3d526685a4307727227c513df6c66268836 1 parent 85effff
@2sidedfigure 2sidedfigure authored
Showing with 27 additions and 1 deletion.
  1. +7 −1 README.md
  2. +20 −0 lib/main.js
View
8 README.md
@@ -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
@@ -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)
View
20 lib/main.js
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.