Stripe withdrawal action in rails marketplace app -
i'm new rails. i'm trying create rails marketplace sellers can cash out acquired funds sales on site.
i'm confused how configure withdrawal form , orders controller.
when go localhost:3000/withdrawal, stripe recipient name created on stripe dashboard without completing form. form nonexistent because i've tried form_for generates error.
i want user input info , choose submit it, not create recipient when "cash out" (which leads withdrawal path) clicked.
the stripe documentation helpful, i'm not sure how create form.
here withdrawal action in orders controller. i'm wondering if need new action within withdrawal? not sure if that's possible?
def withdrawal stripe.api_key = env["stripe_api_key"] token = params[:stripetoken] recipient = stripe::recipient.create( :name => current_user.full_name, :type => "individual", :bank_account => token ) transfer = stripe::transfer.create( :amount => (@funds).floor, :currency => "usd", :recipient => @seller.recipient ) end and withdrawal.html.erb. know missing form tag , submit, i've tried processes error. don't know form_for call. i've tried "order" results in error.
<div class="text-center"> <h1>bank account information</h1> <div class="form-group"> <%= label_tag :name %> <%= text_field_tag :name, nil, { :name => nil, :'data-stripe' => "name", class: "form-control" } %> </div> <div class="form-group"> <%= label_tag :withdrawal_amount %> <%= text_field_tag :withdrawal_amount, nil, { :name => nil, :'data-stripe' => "amount", class: "form-control" } %> </div> <div class="form-group"> <%= label_tag :routing_number %> <%= text_field_tag :routing_number, nil, { :name => nil, :'data-stripe' => "routingnumber", class: "form-control" } %> </div> <div class="form-group"> <%= label_tag :account_number %> <%= text_field_tag :account_number, nil, { :name => nil, :'data-stripe' => "accountnumber", class: "form-control" } %> </div> i'd appreciate guidance on how create "cash out" action. thanks.
form_for model objects. if you're not using model object, or don't want/need rails infer things model object, don't use form_for.
for simple forms, instead use 1 of:
form_tag- same syntaxform_forwithout model-related magic.- a plain old
<form>tag. erb templates are, after all, html ruby mixed in.
Comments
Post a Comment