PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Any way to update user role on payment?

  1. Currently there's a way to update user role on unsubscription... does non-payment trigger the same action? And are there any plans to include the option of updating a user role on payment?

    E.g., right now our client's site creates an account with the user registration plugin (with the role set to Inactive) and when users log in they are forced to a payment page (powered by the paypal plugin). We'd like the role to be changed to Subscriber when a paypal payment is received and set to Inactive when a payment is missed or the subscription is cancelled.

    Posted 11 years ago on Monday February 14, 2011 | Permalink
  2. With the User Registration Add-On when using it with PayPal the user is only created once payment is received. So the user is never created until payment is received. So there is no reason non-payment should trigger a role update because the user isn't created until the payment triggers the user creation. IF you configure it to do so.

    There is no way to trigger anything on non-payment anyway because something has to trigger the action. A payment triggers an action. Non-payment does not because PayPal doesn't tell us if there was a non-payment. It only communicates with the code when a payment is made OR via IPN when there is a problem with the payment.

    Currently the User Registration Add-On is designed to be used for user creation. It isn't designed to be used to interact with existing users.

    If you want to accept a payment and then change a users role for an existing user you would have to write that customization yourself and use available PayPal Add-On API hooks to update the user once payment is received.

    There is a hook the PayPal Add-On that is triggered when a successful payment is received. That hook is: gform_paypal_fulfillment

    Posted 11 years ago on Monday February 14, 2011 | Permalink
  3. Thanks Carl. I was just reading through the code and that's what I'm going to go with (the gform_paypal_fulfillment hook). Thanks sir.

    By non-payment, I was referring to some sort of payment failure (txn_type = subscr_failed).

    Users are being created immediately on our test servers... not sure if that's a bug. Our client has an application review process before expecting payment, so it's what we were expecting:

    1. User fills out a user registration form
    2. Account created (role = inactive), user/password sent to the user and notice sent to site admin
    3. Admin reviews application and sets role to Accepted (or Rejected)
    4. User logs in to access the payment form (if they were accepted)
    5. User makes a payment and role is changed to subscriber

    Working on the hooks for #5 right now, of course.

    Posted 11 years ago on Monday February 14, 2011 | Permalink
  4. There is an option on the PayPal Setting screen to only create the user after payment has been received, that has to be checked and active in order for it to work.

    Posted 11 years ago on Monday February 14, 2011 | Permalink
  5. Ah yea. That makes sense haha.

    Thanks. I'll try to post my code here in a little bit for anyone that needs to something similar with role modification in the future.

    Posted 11 years ago on Monday February 14, 2011 | Permalink
  6. Hi Carl,

    I don't see this option on the paypal settng screen. The only thing I see there is a checkbox to show you have the IPN settings configured correctly. In the paypal feed for the form I've made I see Paypal Condition, but this is to send user to paypay payment page, correct?

    Don't see anything that says that the user is only created after payment... I tried it yesterday as well and user is created even without payment.... HEEEELP

    Posted 11 years ago on Sunday March 20, 2011 | Permalink
  7. @rubencio This only shows up if you have both the User Registration Add-On and the PayPal Add-On activated *AND* both of them configured for that form. You would have to configure the User Registration Add-On for that form first and then configure the PayPal settings for that form.

    Posted 11 years ago on Monday March 21, 2011 | Permalink
  8. hazu

    @Edwin I would be very interested in the code for updating the role of the users upon receiving a Paypal payment. That is exactly what I have been looking for. It would be great if you can make the code available here.

    Posted 10 years ago on Thursday December 29, 2011 | Permalink
  9. @hazu So you are aware, we will be updating the User Registration Add-On to support updating existing users and not just creating new users. We have a large number of exciting enhancements we will be making to the User Registration Add-On. 2012 is going to be a great year for Gravity Forms users!

    Posted 10 years ago on Thursday December 29, 2011 | Permalink
  10. hazu

    That is great news. Thank you Carl!

    Posted 10 years ago on Friday December 30, 2011 | Permalink

This topic has been resolved and has been closed to new replies.