/meteor-saas-braintree

A subscription-based app (SaaS) example made with MeteorJS + Braintree.

Primary LanguageJavaScript

MeteorJS + Braintree = SaaS

A subscription-based app (SaaS) example that shows one way of integrating Braintree into your meteor application. Try it here!

Disclaimer

This is basically a refractored version of The Meteor Chef's saas-stripe app. It uses Braintree instead of Stripe.

Initial setup

  1. Install Meteor
  2. Clone this repo git clone https://github.com/michaltakac/meteor-saas-braintree.git
  3. Create a sandbox account
  4. Login to the braintree sandbox
  5. Retrieve your api keys (navigate to: My User > Api Keys)
  6. Insert the keys into settings.json
  7. Inside Braintree sandbox, navigate to Plans from left menu under Reccuring Billing
  8. Create 2 plans with id's "pro" and "standard" respectively (lowercase for Plan ID, Plan Name's should be "Pro and "Standard")
  9. Fill other inputs with information from settings.json (Price: 9.99 for Pro, 5.99 for Standard, do not include Trial Period, Billing Cycle Every 1 Month(s), First Bill Date - Immediately, End Date - Never)*, now hit Create button

*You can create whatever plans you want, but "Plan ID" from Braintree must be equal to "name" from settings.json and "Price" from Braintree must be equal to "price" from settings.json. You can play with it.

Start

$ npm install
$ npm run start-app

Invoices

Invoices only works if you deploy your app on the web, because they are generated using Braintree's webhooks. You can test it on Heroku for free:

  1. Deploy your app to Heroku servers by following this article - http://justmeteor.com/blog/deploy-to-production-on-heroku/ - IMPORTANT! Since this is Meteor 1.3, you need to use different buildpack, you can use mine: https://github.com/michaltakac/meteor-buildpack-horse
  2. Inside Braintree sandbox, navigate to Settings > Webhooks (inside top menu)
  3. Click on New webhook, insert https://your-deployed-app.herokuapp.com/webhooks/braintree URL into "Destination", check "Subscription canceled" and "Subscription charged successfully" and click Create Webhook
  4. It should be added now and after you create new subscription inside your app at my-saas-app.meteor.com, it will generate new invoice

Issues?

For issues related to this repo, please submit an issue on github. Any braintree related problems should be directed to Braintree Support or #braintree on StackOverflow.