title: Sending POST request in Rails
body: <p>How would I go about sending an HTTP POST request in the following format in a Rails setup:</p>
  
  <pre><code>curl https://api.venmo.com/v1/payments -d access_token=4e4sw1111111111t8an8dektggtcbb45 -d     email="someemail@gmail.com" -d amount=5 -d note="Delivery."
  </code></pre>
  
  <p>I'd like to have users input the email/amount/note parameters into a form on a webpage, then pass that data (when the user clicks the submit button) into a Controller where the access_token parameter is stored to then fire off the POST request.</p>
  
  <p>So far I've tried setting up the Controller with this method (and calling it from the view html.erb):</p>
  
  <pre><code>def make_payment
    if !params[:access_token].nil?
  
      form_data = {
          "email" =&gt; @email_to,
          "amount" =&gt; @amount_to,
          "note" =&gt; @note_to,
          "access_token" =&gt; :access_token
      }
      url = "https://api.venmo.com/v1/payments"
      request = Net::HTTP::Post.new(url, form_data)
  
      response = http.request(request)
  
     end
  end
  </code></pre>
  
  <p>Here's my current view setup:</p>
  
  <pre><code>  &lt;div class="box box-warning"&gt;
                          &lt;div class="box-header"&gt;
                            &lt;h3 class="box-title"&gt;Pay Bill using Venmo Account&lt;/h3&gt;
                              &lt;div id="payment_note_input"&gt;
                              &lt;input id="payment_note" type="text" class="form-control" required placeholder="add a note to your payment"&gt;
                              &lt;/div&gt;
                              &lt;div id="payment_target_input" &gt;
                              &lt;input id="payment_target" type="text" class="form-control" required placeholder="pay an email address"&gt;
                              &lt;/div&gt;
                              &lt;div id="payment_amount_input"&gt;
                              &lt;input id="payment_amount" type="text" class="form-control" required placeholder="enter the payment amount! "&gt;
                              &lt;/div&gt;
                              &lt;/br&gt;
                          &lt;button class="btn btn-danger" type="button" onClick= &lt;%=make_payment%&gt; &gt; Make payment&lt;/button&gt;
                      &lt;/div&gt;
  </code></pre>
  
  <p>I feel like I'm close to a solution here...</p>