An example Braintree integration for Ruby on Rails. An example Braintree integration using a JavaScript client and Ruby on Rails server.
- Install bundler:
gem install bundler
- Bundle:
bundle
-
Next, you will need your Braintree API credentials. Credentials can be found by navigating to Account > My User > View Authorizations in the Braintree Control Panel. Full instructions can be found on support site.
-
The
gem 'figaro'
has already been added and bundled. To create aconfig/application.yml
file and have it added to the .gitignore run:
bundle exec figaro install
- In your config/application.yml file add the following, with your Braintree API credentials.
# Braintree API Keys
MERCHANT_ID: <use_your_merchant_id>
PUBLIC_KEY: <use_your_public_key>
PRIVATE_KEY: <use_your_private_key>
- Start rails:
rails server
Then open http://localhost:3000/
in your browser.