After the user registration page, web clients will come to this page, which contains only a proceed button. But I want to skip this page and proceed to the payment page. Is there any way to do this action completely in the controller?
<form method="post" action="https://www.ccavenue.com/shopzone/cc_details.jsp">
<input type=hidden name=Merchant_Id value="<%= @Merchant_id %>">
<input type=hidden name=Amount value="<%= @Amount %>">
<input type=hidden name=Order_Id value="<%= @user_id %>">
<input type=hidden name=Redirect_Url value="<%= @redirect_url %>">
<input type=hidden name=Checksum value="<%= @checksum %>">
<input type="submit" class="Register_button" value="Proceed to payment">
</form>
No, not the way you're wanting.
As others have said, you can POST from within your controller, and receive the response, but if you want to have the browser post to the remote page, it has to be through a form. A common solution is to submit the form on load via javascript. e.g.
You should do POST request from controller.
You can use httparty gem to do post request.
There's no reason you couldn't post from a controller using uri and net/http in the Ruby standard library and handle the response from the server there.
Some good examples for using net/http can be found here. https://github.com/augustl/net-http-cheat-sheet/blob/master/post_form.rb
Still that's probably not the best way to handle this.