views:

318

answers:

1

Hi!

I have situation like this:

  • user submits form with action='/pay'
  • in '/pay' I have to add some additional parameters and send post request to www.paymentprovider.com/new_payment

The problem is that I want to post and redirect (at the same time) user to this new website www.paymentprovider.com/new_payment. Currently I am using

Net::HTTP.post_form 

Do you know any ways to achieve this?

+2  A: 

You cannot do a post and redirect without breaking the internet. :)

If you want to use this workflow, you will need to proxy the request.

As an example:

  1. User submits to /pay
  2. You grab those paramaters and make a request to /new_payment
  3. You can grab the results from /new_payment and send them back to the request in /pay

Since this is all happening locally, the option above would seem to be a waste. If /pay is simply missing some parameters and info could you simply supply them in your view? This way you could have both /pay and /new_payment postback to the same location and use two separate views to handle the initial get request.

Scott Watermasysk