Permalink
Browse files

Add Tokens API

closes #2
  • Loading branch information...
abh committed Sep 28, 2011
1 parent 407ed51 commit f6423b2a0b089306ada23a5f85c6f31fade0df85
Showing with 14 additions and 5 deletions.
  1. +3 −0 README.md
  2. +10 −4 lib/main.js
  3. +1 −1 package.json
View
@@ -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
View
@@ -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);
}
@@ -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)
+ }
+ },
};
}
View
@@ -2,7 +2,7 @@
"author": "Ask Bjørn Hansen <ask@develooper.com> (http://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",

0 comments on commit f6423b2

Please sign in to comment.