A subscription-based app (SaaS) example that shows one way of integrating Braintree into your meteor application. Try it here!
This is basically a refractored version of The Meteor Chef's saas-stripe app. It uses Braintree instead of Stripe.
- Install Meteor
- Clone this repo
git clone https://github.com/michaltakac/meteor-saas-braintree.git
- Create a sandbox account
- Login to the braintree sandbox
- Retrieve your api keys (navigate to: My User > Api Keys)
- Insert the keys into
settings.json
- Inside Braintree sandbox, navigate to Plans from left menu under
Reccuring Billing
- Create 2 plans with id's "pro" and "standard" respectively (lowercase for Plan ID, Plan Name's should be "Pro and "Standard")
- 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 hitCreate
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.
$ npm install
$ npm run start-app
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:
- 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
- Inside Braintree sandbox, navigate to Settings > Webhooks (inside top menu)
- Click on
New webhook
, inserthttps://your-deployed-app.herokuapp.com/webhooks/braintree
URL into "Destination", check "Subscription canceled" and "Subscription charged successfully" and clickCreate Webhook
- 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
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.