我正在尝试将braintree付款实施到ruby应用程序中,一切似乎都运行良好,但当我通过fail_on_duplicate_payment_method_card作为选项时,我收到无效密钥:options [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
答案 0 :(得分:2)
完全披露:我在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
}
)