Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:08:38+00:00 2026-06-08T14:08:38+00:00

I want to integrate Paypal within the Devise user registration process. What I want

  • 0

I want to integrate Paypal within the Devise user registration process. What I want is to have a standard rails form based on the devise resource, that also has custom fields belonging to the user’s model.

When a user fills in those fields and clicks on signup, it will be redirected to Paypal, when he clears from paypal and returns to our site then the user data must be created.

For the scenario where the user fill’s out the paypal form but doesn’t come back to our site, we have to keep record of user before redirecting to Paypal.

For this we can create a flag in user model and use Paypal IPN and when the user transaction notified, set that flag.

But in the case when the user is redirected to Paypal but doesn’t complete the transaction, if the user returns to registration and signup again, our model should not throw error saying that the email entered already exists in the table.

How can we handle all these scenarios, is there any gem or plugin available to work with?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:08:40+00:00Added an answer on June 8, 2026 at 2:08 pm

    Here i am posting the detail code for performing the whole process.

    registration_controller.rb

    module Auth
      class RegistrationController < Devise::RegistrationsController
        include Auth::RegistrationHelper
    
        def create
          @user = User.new params[:user]
          if @user.valid?
            redirect_to get_subscribe_url(@user, request)
          else
            super
          end
        end
      end
    end
    

    registration_helper.rb

    module Auth::RegistrationHelper
      def get_subscribe_url(user, request)
        url = Rails.env == "production" ? "https://www.paypal.com/cgi-bin/webscr/?" : "https://www.sandbox.paypal.com/cgi-bin/webscr/?"
        url + {
            :ip => request.remote_ip,
            :cmd => '_s-xclick',
            :hosted_button_id => (Rails.env == "production" ? "ID_FOR_BUTTON" : "ID_FOR_BUTTON"),
            :return_url => root_url,
            :cancel_return_url => root_url,
            :notify_url => payment_notifications_create_url,
            :allow_note => true,
            :custom => Base64.encode64("#{user.email}|#{user.organization_type_id}|#{user.password}")
        }.to_query
      end
    end
    

    payment_notification_controller.rb

    class PaymentNotificationsController < ApplicationController
      protect_from_forgery :except => [:create]
      layout "single_column", :only => :show
    
      def create
        @notification = PaymentNotification.new
        @notification.transaction_id = params[:ipn_track_id]
        @notification.params = params
        @notification.status = "paid"
        @custom = Base64.decode64(params[:custom])
        @custom = @custom.split("|")
        @user = User.new
        @user.email = @custom[0]
        @user.organization_type_id = @custom[1].to_i
        @user.password = @custom[2]
        if @user.valid?
          @user.save
          @notification.user = @user
          @notification.save
          @user.send_confirmation_instructions
        end
        render :nothing => true
      end
    
      def show
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to integrate Facebook with my Blackberry app. For that I have downloaded
I have successfully integrated PayPal. All is working fine. But I want my form
I have developed my own shopping cart and now I want to integrate Paypal
I want to integrate MarkerCluster with my database driven Google map and have been
I want to integrate the zxing barcode scanner into my app. I have followed
I want to integrate paypal in my web application. I am using RESTEasy API
I want to integrate mutiple LDAP (AD, OpenDS, OpenLDAP etc) user data into one
I want to integrate the Mobclix in my App. I have included all the
I need guidelines to integrate paypal payment gatway. Here is my requirement User would
I want to know if i can integrate the paypal without using paypal library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.