diff --git a/README.md b/README.md index 1ab406dcdb..6bbb812198 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,13 @@ app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRe
+ +- [Sign up](http://stripe.com) or log into your your [dashboard](https://manage.stripe.com) +- Click on your profile and click on Account Settings +- Then click on [API Keys](https://manage.stripe.com/account/apikeys) +- Copy the **Secret Key**. and add this into `config/secrets.js` +
+ - Visit [PayPal Developer](https://developer.paypal.com/) - Log in to your PayPal account diff --git a/app.js b/app.js index eb12a53710..c24e91ffe2 100755 --- a/app.js +++ b/app.js @@ -126,14 +126,11 @@ app.get('/api/paypal', apiController.getPayPal); app.get('/api/paypal/success', apiController.getPayPalSuccess); app.get('/api/paypal/cancel', apiController.getPayPalCancel); app.get('/api/steam', apiController.getSteam); - app.get('/api/stripe', apiController.getStripe); app.get('/api/stripe/onetime', apiController.getStripeOnetime); app.post('/api/stripe/onetime', apiController.postStripeOnetime); app.get('/api/stripe/newsubscriber', apiController.getStripeNewSubscriber); app.post('/api/stripe/newsubscriber', apiController.postStripeNewSubscriber); -app.get('/api/stripe/customers', apiController.getStripeCustomers); - app.get('/api/scraping', apiController.getScraping); app.get('/api/twilio', apiController.getTwilio); app.post('/api/twilio', apiController.postTwilio); diff --git a/controllers/api.js b/controllers/api.js index de5ae378e3..d4529122bd 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -385,6 +385,12 @@ exports.getSteam = function(req, res, next) { }); }); }; + +/** + * GET /api/stripe + * Stripe API example. + */ + exports.getStripe = function(req, res, next) { //Create a token for the CC res.render('api/stripe/index', { @@ -392,6 +398,10 @@ exports.getStripe = function(req, res, next) { }); }; +/** + * GET /api/onetime + * Stripe One Time Charge API example. + */ exports.getStripeOnetime = function(req, res, next) { //Create a token for the CC res.render('api/stripe/onetime', { @@ -399,6 +409,18 @@ exports.getStripeOnetime = function(req, res, next) { }); }; +/** + * POST /api/stripe/onetime + * @param ccNumber + * @param expMonth + * @param expYear + * @param ccNumber + * @param expMonth + * @param expYear + * @param customerName + * @param email + * @param chargeAmount + */ exports.postStripeOnetime = function(req, res, next) { stripe.tokens.create({ card: { @@ -440,7 +462,10 @@ exports.postStripeOnetime = function(req, res, next) { }); }; - +/** + * GET /api/newsubscriber + * Stripe Subscription API example. + */ exports.getStripeNewSubscriber = function(req, res, next) { stripe.plans.list(function(err, plans) { res.render('api/stripe/newsubscriber', { @@ -450,6 +475,18 @@ exports.getStripeNewSubscriber = function(req, res, next) { }); }; +/** + * POST /api/stripe/newsubscriber + * @param ccNumber + * @param expMonth + * @param expYear + * @param ccNumber + * @param expMonth + * @param expYear + * @param customerName + * @param email + * @param plantype + */ exports.postStripeNewSubscriber = function(req, res, next) { console.log(req.body.plantype); @@ -496,15 +533,6 @@ exports.postStripeNewSubscriber = function(req, res, next) { }); }; -exports.getStripeCustomers = function(req, res, next) { - stripe.customers.list(function(err, customers) { - customersList = JSON.stringify(customers.data); - res.render('api/stripe/customers', { - title: 'Stripe API', - customers: customersList - }); - }); -}; /** * GET /api/twilio diff --git a/views/api/stripe/customers.jade b/views/api/stripe/customers.jade deleted file mode 100644 index 25f6961139..0000000000 --- a/views/api/stripe/customers.jade +++ /dev/null @@ -1,30 +0,0 @@ -extends ../../layout - -block content - .page-header - h2 - i.fa.fa-dollar - | Stripe API - - .btn-group.btn-group-justified - a.btn.btn-primary(href='/api/stripe') - i.fa.fa-home - | All API Calls - a.btn.btn-primary(href='https://stripe.com/docs/api', target='_blank') - i.fa.fa-code - | API Reference - a.btn.btn-primary(href='https://manage.stripe.com/account/apikeys', target='_blank') - i.fa.fa-gear - | API Keys - br - .row - .col-sm-12 - if customers - h2 Customers - pre - |!{JSON.stringify(customer)} - h2 Payment - pre - |!{JSON.stringify(charge)} - else - h2 No Customers API \ No newline at end of file diff --git a/views/api/stripe/index.jade b/views/api/stripe/index.jade index aac8975e7d..27e8737b15 100644 --- a/views/api/stripe/index.jade +++ b/views/api/stripe/index.jade @@ -8,6 +8,3 @@ block content a(href='/api/stripe/onetime') One Time Charges li a(href='/api/stripe/newsubscriber') New Subscriber - li - a(href='/api/stripe/customers') List All Customers -