ActiveMerchant获取Braintree ClientToken

时间:2015-04-01 16:12:25

标签: ruby-on-rails ruby braintree activemerchant

我正在尝试将ActiveMerchant与Braintree Dropin UI一起使用,我无法找到正确的方法来创建客户端令牌以传递给JavaScript SDK。我目前的设置是:

# config/environments/development.rb
# ActiveMerchant configuration.
ActiveMerchant::Billing::Base.mode = :test
config.gateway = ActiveMerchant::Billing::BraintreeGateway.new(
  merchant_id: '',
  public_key: '',
  private_key: ''
)

我有一个控制器需要作为API请求的一部分发回客户端令牌:

# app/controllers/v1/orders_controller.rb
def token
  @client_token = ...GENERATE CLIENT TOKEN...
  respond_with @client_token
end

我只是不知道如何通过ActiveMerchant API生成此令牌。

1 个答案:

答案 0 :(得分:1)

我在Braintree工作。如果您有更多问题,建议您email our support team

ActiveMerchant目前与v.zero不兼容。要使用Drop-In UI或任何其他v.zero功能,您需要直接使用Braintree ruby​​客户端库。有关说明,请参阅Braintree "Getting Started" Guide