Skip to content

Instantly share code, notes, and snippets.

@wjr1985
Created June 23, 2015 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjr1985/567445781a06e126a286 to your computer and use it in GitHub Desktop.
Save wjr1985/567445781a06e126a286 to your computer and use it in GitHub Desktop.
Braintree Ruby library - multiple merchant gateways
require "rubygems"
require "braintree"
transaction_attributes = {
:amount => "1000.00",
:credit_card => {
:number => "5105105105105100",
:expiration_date => "05/12"
}
}
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.merchant_id = "merchant_1"
Braintree::Configuration.public_key = "merchant_1_public_key"
Braintree::Configuration.private_key = "merchant_1_private_key"
merchant_1_gateway = Braintree::Configuration.gateway
merchant_1_gateway.transaction.sale(transaction_attributes)
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.merchant_id = "merchant_2"
Braintree::Configuration.public_key = "merchant_2_public_key"
Braintree::Configuration.private_key = "merchant_2_private_key"
merchant_2_gateway = Braintree::Configuration.gateway
merchant_2_gateway.transaction.sale(transaction_attributes)
@jurgenwerk
Copy link

Is this thread safe?

@arizz96
Copy link

arizz96 commented Aug 13, 2017

@wjr1985, is it thread safe? Thanks!

@geetfun
Copy link

geetfun commented Aug 16, 2017

Doesn't appear so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment