Comparing version 1.3.0 to 2.0.0
{ | ||
"author": "Ask Bjørn Hansen <ask@develooper.com> (http://www.askask.com/)", | ||
"name": "stripe", | ||
"version": "2.0.0", | ||
"description": "Stripe API wrapper", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/abh/node-stripe", | ||
"homepage": "https://github.com/stripe/stripe-node", | ||
"author": "Stripe <james@stripe.com> (https://stripe.com/)", | ||
"contributors": [ | ||
"Ask Bjørn Hansen <ask@develooper.com> (http://www.askask.com/)", | ||
"Michelle Bu <michelle@stripe.com>", | ||
"Alex Sexton <alex@stripe.com", | ||
"James Padolsey <james@stripe.com" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/abh/node-stripe.git" | ||
"url": "git://github.com/stripe/stripe-node.git" | ||
}, | ||
"bugs:": "https://github.com/stripe/stripe-node/issues", | ||
"engines": { | ||
"node": ">= v0.4.0" | ||
"node": ">= v0.8.0" | ||
}, | ||
"main": "lib/main.js", | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
"main": "lib/stripe.js", | ||
"devDependencies": { | ||
"mocha": "~1.13.0", | ||
"chai": "~1.8.0", | ||
"chai-as-promised": "~4.0.0", | ||
"mocha-as-promised": "~1.4.0" | ||
}, | ||
"dependencies": { | ||
"when": "~2.4.0" | ||
} | ||
} |
213
README.md
@@ -1,6 +0,3 @@ | ||
# node-stripe | ||
# Stripe node.js bindings | ||
Access to the [Stripe](https://stripe.com/) [API](https://stripe.com/docs/api). | ||
## Installation | ||
@@ -10,100 +7,142 @@ | ||
## Usage overview | ||
## Documentation | ||
**Documentation is forthcoming** and will eventually be available at https://stripe.com/docs/api/node. | ||
var api_key = 'abc'; // secret stripe API key | ||
var stripe = require('stripe')(api_key); | ||
## API Overview | ||
stripe.customers.create( | ||
{ email: 'foobar@example.org' }, | ||
function(err, customer) { | ||
if (err) { | ||
console.log(err.message); | ||
return; | ||
} | ||
console.log("customer id", customer.id); | ||
} | ||
); | ||
Every resource is accessed via your `stripe` instance: | ||
```js | ||
var stripe = require('stripe')(' your stripe API key '); | ||
// stripe.{ RESOURCE_NAME }.{ METHOD_NAME } | ||
``` | ||
## API | ||
Every resource method accepts an optional callback as the last argument: | ||
All methods takes a callback as their last parameter. The callback is | ||
called with a Javascript `Error` (if any) and then the response. | ||
```js | ||
stripe.customers.create( | ||
{ email: 'customer@example.com' }, | ||
function(err, customer) { | ||
err; // null if no error occurred | ||
customer; // the created customer object | ||
} | ||
); | ||
``` | ||
* `stripe.charges` - create, retrieve, refund and list charges | ||
* `.create(charge)` - [create a charge](https://stripe.com/docs/api#create_charge) | ||
* `.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, 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 | ||
* `.del(customer_id)` - [delete a customer](https://stripe.com/docs/api#delete_customer) | ||
* `.list(count, offset)` - [list customers](https://stripe.com/docs/api#list_customers) | ||
* `.update_subscription(customer_id, data)` - [update subscription](https://stripe.com/docs/api#update_subscription) | ||
* `.cancel_subscription(customer_id, at_period_end)` - [cancel subscription](https://stripe.com/docs/api#cancel_subscription) | ||
* `stripe.plans` - create, retrieve, delete and list subscription plans | ||
* `.create(plan)` - [create a plan](https://stripe.com/docs/api#create_plan), takes the data as an object | ||
* `.retrieve(plan_id)` - [retrieve a plan](https://stripe.com/docs/api#retrieve_plan) by plan id. | ||
* `.update(plan_id, data)` - [update plan](https://stripe.com/docs/api#update_plan) | ||
* `.del(plan_id)` - [delete a plan](https://stripe.com/docs/api#delete_plan) | ||
* `.list(count, offset)` - [list plans](https://stripe.com/docs/api#list_plans) | ||
* `stripe.invoices` - [Invoices API](https://stripe.com/docs/api#invoices) | ||
* `.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.coupons` - create, retrieve, delete and list coupons | ||
* `.create(coupon)` - [create a coupon](https://stripe.com/docs/api#create_coupon), takes the data as an object | ||
* `.retrieve(coupon_id)` - [retrieve a coupon](https://stripe.com/docs/api#retrieve_coupon) by coupon id. | ||
* `.del(coupon_id)` - [delete a coupon](https://stripe.com/docs/api#delete_coupon) | ||
* `.list(count, offset)` - [list coupons](https://stripe.com/docs/api#list_coupons) | ||
* `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) | ||
* `stripe.events` - retrieve and list events | ||
* `.retrieve(id)` - [retrieve an event](https://stripe.com/docs/api#retrieve_event) | ||
* `.list()` - [list all events](https://stripe.com/docs/api#list_events) | ||
Additionally, every resource method returns a promise, so you don't have to use the regular callback. E.g. | ||
## TODO | ||
```js | ||
// Create a new customer and then a new charge for that customer: | ||
stripe.customers.create({ | ||
email: 'foo-customer@example.com' | ||
}).then(function(customer) { | ||
return stripe.charges.create({ | ||
amount: 1600, | ||
currency: 'usd', | ||
customer: customer.id | ||
}); | ||
}).then(function(charge) { | ||
// New charge created on a new customer | ||
}, function(err) { | ||
// Deal with an error | ||
}); | ||
``` | ||
See the [issue tracker](http://github.com/abh/node-stripe). | ||
### Available resources & methods | ||
## Tests | ||
*Where you see `params` it is a plain JavaScript object, e.g. `{ email: 'foo@example.com' }`* | ||
To run the tests, install vows with `npm install vows` and then run | ||
* account | ||
* `retrieve()` | ||
* balance | ||
* `retrieve()` | ||
* `listTransactions()` | ||
* `retrieveTransaction(transactionId)` | ||
* charges | ||
* `create(params)` | ||
* `list()` | ||
* `retrieve(chargeId)` | ||
* `capture(chargeId)` | ||
* `refund(chargeId)` | ||
* `updateDispute(chargeId[, params])` | ||
* `closeDispute(chargeId[, params])` | ||
* `setMetadata(chargeId[, params])` | ||
* `getMetadata(chargeId[, params])` | ||
* coupons | ||
* `create(params)` | ||
* `list()` | ||
* `retrieve(chargeId)` | ||
* `del(chargeId)` | ||
* customers | ||
* `create(params)` | ||
* `list()` | ||
* `update(customerId[, params])` | ||
* `retrieve(customerId)` | ||
* `del(customerId)` | ||
* `setMetadata(customerId[, params])` | ||
* `getMetadata(customerId[, params])` | ||
* `updateSubscription(customerId[, params])` | ||
* `cancelSubscription(customerId)` | ||
* `createCard(customerId[, params])` | ||
* `listCards(customerId)` | ||
* `retrieveCard(customerId, cardId)` | ||
* `updateCard(customerId, cardId[, params])` | ||
* `deleteCard(customerId, cardId)` | ||
* `deleteDiscount(customerId, discountId)` | ||
* events | ||
* `list()` | ||
* `retrieve(eventId)` | ||
* invoiceItems | ||
* `create(params)` | ||
* `list()` | ||
* `update(invoiceItemId[, params])` | ||
* `retrieve(invoiceItemId)` | ||
* `del(invoiceItemId)` | ||
* invoices | ||
* `create(params)` | ||
* `list()` | ||
* `update(invoiceId[, params])` | ||
* `retrieve(invoiceId)` | ||
* `retrieveLines(invoiceId)` | ||
* `retrieveUpcoming()` | ||
* `pay(invoiceId)` | ||
* plans | ||
* `create(params)` | ||
* `list()` | ||
* `update(planId[, params])` | ||
* `retrieve(planId)` | ||
* `del(planId)` | ||
* recipient | ||
* `create(params)` | ||
* `list()` | ||
* `update(recipientId[, params])` | ||
* `retrieve(recipientId)` | ||
* `del(recipientId)` | ||
* `setMetadata(recipientId[, params])` | ||
* `getMetadata(recipientId[, params])` | ||
* tokens | ||
* `create(params)` | ||
* `retrieve(tokenId)` | ||
* transfers | ||
* `create(params)` | ||
* `list()` | ||
* `retrieve(transferId)` | ||
* `cancel(transferId)` | ||
* `setMetadata(transferId[, params])` | ||
* `getMetadata(transferId[, params])` | ||
STRIPE_API=your-test-api-key vows test/* | ||
## Development | ||
## Author | ||
To run the tests you'll need a Stripe *Test* API key (from your [Stripe Dashboard](https://manage.stripe.com)): | ||
Ask Bjørn Hansen (ask@develooper.com). Development was sponsored by [YellowBot](http://www.yellowbot.com/). | ||
```bash | ||
$ npm install -g mocha | ||
$ npm install | ||
$ export STRIPE_TEST_API_KEY="sk_test_..." | ||
$ mocha | ||
``` | ||
## License | ||
## Author | ||
Copyright (C) 2011 Ask Bjørn Hansen | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
Originally by [Ask Bjørn Hansen](https://github.com/abh) (ask@develooper.com). Development was sponsored by YellowBot. Now officially maintained by Stripe. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
66741
44
1921
148
1
1
4
5
+ Addedwhen@~2.4.0
+ Addedwhen@2.4.0(transitive)