【问题标题】:How to send money to the particular stripe account?如何汇款到特定的条带帐户?
【发布时间】:2014-04-02 09:01:49
【问题描述】:

我有一个要求,我有产品列表,每个产品属于不同的卖家,现在用户可以登录应用程序并购买产品,金额将转移到相应的卖家条纹账户。我正在努力解决这个问题。

到目前为止,我已允许卖家注册并连接他的stripe 帐户,如果他已经注册或注册并将代码返回到应用程序,但我也想知道如何通过发布access token在 Rails 中收到的代码,我想知道用户如何通过卡将钱汇给相应的卖家。

请帮帮我

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 stripe-payments


    【解决方案1】:

    这是推测性的(我不知道您是否可以使用当前的 Stripe API 做到这一点):

    您不能将卖家的条带访问令牌分配给 Stripe 实例吗?

    Stripe 凭据似乎是set in an initializer,这通常意味着它们无法更改;虽然我敢猜测你可以通过调用Stripe 对象的新实例或dynamically setting the seller details 来做到这一点:

    def create
      # Amount in cents
      @amount = 500
    
      seller = User.find_by id: params[:product_id]
      Stripe.api_key =  seller.stripe_api
    
      customer = Stripe::Customer.create(
        :email => 'example@stripe.com',
        :card  => params[:stripeToken]
      )
    
      charge = Stripe::Charge.create(
        :customer    => customer.id,
        :amount      => @amount,
        :description => 'Rails Stripe customer',
        :currency    => 'usd'
      )
    
    rescue Stripe::CardError => e
      flash[:error] = e.message
      redirect_to charges_path
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-01
      • 1970-01-01
      相关资源
      最近更新 更多