A subscription-based app (SaaS) example that shows one way of integration 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.
$ meteor --settings settings.json
Invoices only works if you deploy your app on the web, because they are generated using Braintree's webhooks. There is a easy way to make it work:
- Deploy your app to Meteor servers, for example:
meteor deploy my-saas-app.meteor.com --settings settings.json
- Inside Braintree sandbox, navigate to Settings > Webhooks (inside top menu)
- Click on
New webhook
, insertmy-saas-app.meteor.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.