views:

73

answers:

1

I am using a payment gateway in my rails application, how can i redirect to gateway from my controller and pass all the parameters required by the gateway. basically its a post request.

A: 

You probably want to do this not through the ActionController framework, but using a seperate HTTP Client library.

Net::HTTP is an example of such a library, but your payment gateway may provide a ruby gem for interacting with it (like TrustCommerce does) or perhaps some portion of ActiveMerchant will work with your gateway.

Either way, it's probably not best to actually redirect your users directly to your payment gateway (since the payment gateway probably returns xml, and the user would then see this); but rather make a seperate connection to the gateway on your server, then process that call and return the results to your users.

Tim Snowhite