2016-05-02 13 views
0

私はrubyアプリケーションにbraintree支払いを実装しようとしていますが、すべてうまくいくようですが、fail_on_duplicate_payment_method_cardをオプションとして渡すと無効なキーが表示されます:options [fail_on_duplicate_payment_method_card]ruby​​ on rails braintreeが重複した支払い方法で失敗する

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 

答えて

2

全開示:私はブレーントリーで働いています。ご不明な点がございましたら、supportチームまでお気軽にお問い合わせください。

fail_on_duplicate_payment_method_cardfail_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 
     } 
    ) 
関連する問題