ruby rails 上的 braintree 重复付款方式失败

ruby on rails braintree fail on duplicate payment method

我正在尝试将 braintree 支付实施到 ruby 应用程序中,一切似乎都运行良好,但是当我将 fail_on_duplicate_payment_method_card 作为选项传递时,我得到了无效的密钥:选项[fail_on_duplicate_payment_method_card]

result = Braintree::PaymentMethod.create(
        :customer_id => current_user.customer_cim_id,
        :payment_method_nonce => 'fake-valid-amex-nonce',
        :cardholder_name => "#{current_user.first_name} #{current_user.last_name}",
        :options => {
            :make_default => true,
            :fail_on_duplicate_payment_method_card => true
        }
    )
    if result.success?
      customer = Braintree::Customer.find(current_user.customer_cim_id)
      puts customer.id
      puts customer.payment_methods[0].token
    else
      p result.errors
    end

完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系我们的 support 团队。

fail_on_duplicate_payment_method_card 应该是 fail_on_duplicate_payment_method.

result = Braintree::PaymentMethod.create(
        :customer_id => current_user.customer_cim_id,
        :payment_method_nonce => 'fake-valid-amex-nonce',
        :cardholder_name => "#{current_user.first_name} #{current_user.last_name}",
        :options => {
            :make_default => true,
            :fail_on_duplicate_payment_method => true
        }
    )