# Paypal on Rails Question

**URL:** <https://www.ruby-forum.com/t/paypal-on-rails-question/85726>\
**Category:** Rails\
**Created:** [February 15, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/paypal-on-rails-question/85726 "2007-02-15T21:28:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sideshow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@sideshow](https://www.ruby-forum.com/u/sideshow)\
**Post date:** [February 15, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/paypal-on-rails-question/85726/1 "2007-02-15T21:28:22Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![sideshow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@sideshow](https://www.ruby-forum.com/u/sideshow)\
**Post date:** [February 16, 2007, 5:16am UTC](https://www.ruby-forum.com/t/paypal-on-rails-question/85726/2 "2007-02-16T05:16:47Z")

</div>

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](http://www.agilewebdevelopment.com/rails-ecommerce)

Meet up at RailsConf:  
[http://railsconf2007.conferencemeetup.com/](http://railsconf2007.conferencemeetup.com/)
