Skip to content

Commit

Permalink
Add Tokens API
Browse files Browse the repository at this point in the history
closes stripe#2
  • Loading branch information
abh committed Sep 28, 2011
1 parent 407ed51 commit f6423b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ the response.
* `.retrieve(customer_id)` - retrieve a customer by customer id
* `.update(customer_id, updates)` - update a customer; `updates` is an object with new parameters
* `.del(customer_id)` - mark the customer deleted
* `stripe.tokens` - [Tokens API](https://stripe.com/api/docs#tokens)
* `.create(card_data)` - [create a token](https://stripe.com/api/docs#create_token)
* `.retrieve(token_id)` - [retrieve a card token](https://stripe.com/api/docs#retrieve_token)

## TODO

Expand Down
14 changes: 10 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports = function (api_key, options) {
req.write(request_data);
req.end();
}

function post(path, data, callback) {
_request('POST', path, data, callback);
}
Expand All @@ -103,8 +103,14 @@ module.exports = function (api_key, options) {
del: function(customer_id, cb) {
del("/v1/customers/" + customer_id, {}, cb);
}
}


},
token: {
create: function (data, cb) {
post("/v1/tokens", data, cb)
},
retrieve: function (token_id, cb) {
get("/v1/tokens/" + token_id, cb)
}
},
};
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Ask Bjørn Hansen <[email protected]> (http:https://www.askask.com/)",
"name": "stripe",
"description": "Stripe API wrapper",
"version": "0.0.1",
"version": "0.0.2",
"homepage": "https://github.com/abh/node-stripe",
"repository": {
"type": "git",
Expand Down

0 comments on commit f6423b2

Please sign in to comment.