-
Notifications
You must be signed in to change notification settings - Fork 22
Configuration
All Braintree::Configuration can be set through BraintreeRails::Configuration. Those are just simple delegate.
So the following two are exactly the same. Those delegations are provided for your convenience. Feel free to use either one.
BraintreeRails::Configuration.environment = :sandbox
BraintreeRails::Configuration.logger = Logger.new('log/braintree.log')
BraintreeRails::Configuration.merchant_id = ENV['MERCHANT_ID']
BraintreeRails::Configuration.public_key = ENV['PUBLIC_KEY']
BraintreeRails::Configuration.private_key = ENV['PRIVATE_KEY']
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.logger = Logger.new('log/braintree.log')
Braintree::Configuration.merchant_id = ENV['MERCHANT_ID']
Braintree::Configuration.public_key = ENV['PUBLIC_KEY']
Braintree::Configuration.private_key = ENV['PRIVATE_KEY']
In addition to those delegations, there are also some BraintreeRails specific configurations you might want to set.
BraintreeRails::Configuration.mode = BraintreeRails::Configuration::Mode::JS
BraintreeRails::Configuration.require_postal_code = true
BraintreeRails::Configuration.require_street_address = true
-
BraintreeRails::Configuration::Mode::JS
(default)This is the default mode. Assumes Braintree.js is used on the client side. This mode will not peek into the format of the encrypted data, for example
number
andcvv
inBraintreeRails::CreditCard
andBraintreeRails::Transaction
. And, encrypted data will be cleared after eachcreate
orupdate
. -
BraintreeRails::Configuration::Mode::S2S
Unless you have a very rock solid reason to get unencrypted credit card info, you should not use this mode. In this mode, additional validations will be turned on for CreditCard number and cvv, etc. And those sensitive data wont be automatically cleared after API calls.
-
BraintreeRails::Configuration::Mode::TR
This mode is similar to JS mode, but does not clear sensitive data. You shouldn't have sensitive data in the first place if you implemented TR correctly.
-
This is true by default.
You should require AVS check whenever possible to reduce fraud risk. If set to false,
BraintreeRails::Address
validation will not requirepostal_code
to be present.
-
This is true by default.
You should require AVS check whenever possible to reduce fraud risk. If set to false,
BraintreeRails::Address
validation will not requirestreet_address
to be present.