Braintree Hosted Fields Example

An example Braintree integration for Ruby on Rails. An example Braintree integration using a JavaScript client and Ruby on Rails server.

Setup Instructions

  1. Install bundler:
gem install bundler
  1. Bundle:
bundle
  1. 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.

  2. The gem 'figaro' has already been added and bundled. To create a config/application.yml file and have it added to the .gitignore run:

bundle exec figaro install
  1. 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>
  1. Start rails:
rails server

Then open http://localhost:3000/ in your browser.