ios - Braintree 保险库不存储付款方式

标签 ios ruby payment-gateway payment braintree

我的沙盒帐户不会在客户的保险库中存储客户的付款方式。我正在使用以下方法创建客户对象:

def create_customer
  result = Braintree::Customer.create(
    :first_name => params[:first_name],
    :last_name => params[:last_name],
    :email => params[:email],
    :phone => params[:phone]
    )
  if result.success?
    render :json => {'result' => result.customer.id}
  else
    render :json => {'errors' => result.errors}, :status => 400
  end
end

然后将 customer_id 存储在我的数据库中供以后使用。

创建 client_token 时,我将相同的 customer_id 发送到 API。下面是创建 client_token 的代码:

def client_token
  token = Braintree::ClientToken.generate(
    :customer_id => params[:customer_id]
    )
  render :json => {"token" => token}
end

最佳答案

我在布伦特里工作。如果您对集成有更多疑问,可以随时 get in touch with our support team

您需要create a payment method使用您从客户那里收到的随机数:

result = Braintree::PaymentMethod.create(
  :customer_id => "131866",
  :payment_method_nonce => nonce_from_the_client
)

关于ios - Braintree 保险库不存储付款方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31121348/

相关文章:

ruby-on-rails - 如何将应向用户显示哪些答案的逻辑移动到新类(class)?

payment-gateway - 关于在网络上传输 Google Pay 支付 token 的安全问题

ios - 按下 UIButton 时更改 JSON 数据链接

ios - 像 UIView 这样的 Twitter 上的建议

ios - 如何检查 UILabel 的当前字体大小?

android - Android 中的 KNET 支付网关集成

c# - 我应该使用 CreditCardAttribute 来验证信用卡号吗?

ios - 在此方法 : 中使用 NSNotification 是好事还是坏事

ruby-on-rails - rails,如何合并两个 ActiveRecord 查询结果

ruby - 根据时间从 block 中突破