Paypal on Rails Question

Hey All,

I’m working on a small web service website which requires payment for
services via Credit Card and Paypal. I’ve managed to get credit card
processing working via a Bluepay lib floating around, now i’ve been
having some trouble with paypal.

Basically what i’m trying to accomplish is: when the user submits an
order, their details are saved, then redirected to paypal to complete
payment, then after thats completed, they are redirected back to my site
from papal (and IPN will take care of saving the invoice status
afterwards).

It seems like a rather simple function, but all the paypal gems I’ve
seen (such as Tobias Lutke’s paypal gem), have the form action to
directly send the user to paypal. When I require the form to submit to
to an action which saves their signup data first, then redirect them to
paypal.

I’ve done tons of searching through google and these forums, but haven’t
found a solution. Any suggestions would be much appreciated!

Thanks!

It’s fairly simple, even with using the paypal gem or
ActiveMerchant. Have the form action submit to your controller to do
what it needs to do, then have the result of that action be a render
of the paypal form that submits directly to paypal. Add a javascript
onload event to automatically submit the form, along with a “submit
to paypal” button for those who have javascript disabled, and you’re
good to go.


Building an e-commerce site with Rails?
http://www.agilewebdevelopment.com/rails-ecommerce

Meet up at RailsConf:
http://railsconf2007.conferencemeetup.com/