1. Hugh is now back at work, more or less full time, after a slower than expected recovery from his neck surgery early this month. Obviously we have a backlog of support to clear, and are working as hard as we can to take care of it. If you have an unanswered thread more than 3 days old, please post one (and only one) "bump" on it, to move it in to our "last 3 days" list. If you have an unanswered issue in a forum you no longer have access to due to subscriptions timing out, please use the Contact Us form, and provide us with the URL to the thread.

PayPal Plugin

Discussion in 'Standard Support' started by smahaf, Nov 1, 2009.

  1. smahaf New Member

    Level: Community
    I have the PayPal plugin integrated in my user registration form.

    the first submission plugin is PayPal and the second plugin is the "create joomla user" plugin.

    The problem is when the user fills in the registration form correctly they are re-directed to the PayPal payment page, but the activation email has already been sent and the account has been added in Joomla and activated.

    How can I nake sure the PayPal payment has been made before the account activation email has been sent or set the account to blocked until the payment has been made?

    Thanks
  2. smahaf New Member

    Level: Community
    bump please.. Thanks
  3. cheesegrits Support Gopher

    Level: Community
    I'm afraid I really can't think of a way of doing that with those plugins as they are. It's an interesting idea, and would obviously be a very useful feature, but at the moment - not possible. We'd have to add options and code to both plugins to be able to do the "block the account until paid" thing.

    -- hugh
  4. smahaf New Member

    Level: Community
    Thanks for your reply... going on from this what I decided to do was disable the New Registration / Activation email sent to the user and add an additional hidden filed to my form named block with a value of "1" which is associated to the Jumla users table block field.

    With this in place the new user is created but blocked.. what I then wanted to do then is add an additional submisson plugin "email" to my form which would send an email to the Administrator advising that a new user had registered.. allowing him to check if the PayPal payment had been made and if so send a pre formatted Registration email to the user and manually activate the account.

    The proble is as previously advised I have the Paypal and the add joomla user pluggin already added to the form..when I add the email pluggin when a user registers they are no longer redirected to the PayPal payment page.. as soon as they enter the details the Registration form resets to a blank form the user is added in joomla (blocked as I wanted) and the new user email is triggered to the Admin... But the user has no chance to complete the payment??

    If I remove the email pluggin everything works ok.. once the form is completed the PayPal page is shown..
  5. cheesegrits Support Gopher

    Level: Community
    I'll see if I can replicate that.

    -- hugh
  6. smahaf New Member

    Level: Community
    little bump..Thanks
  7. smahaf New Member

    Level: Community
    bump bump... Please;)
  8. cheesegrits Support Gopher

    Level: Community
    I currently still clueless as to why the PayPal plugin is not redirecting. It should be running after the email plugin, on the 'onLastProcess' hook, which happens AFTER the 'onAfterProcess' which the email plugin runs on.

    I'm still trying to track that down. Meanwhile ...

    I'm trying to think of the better way of achieving this.

    I think the best approach might be to add a "Eval PHP" option to the PayPal plugin settings, which gets executed after a successful IPN 'completed' transaction. It seems like people may want to do some custom processing on completion of the IPN, rather like you want to enable a user account.

    In your case you'd have to include the newly created userid in {table___element} placeholder format in your custom IPN string, so PayPal sends it back to us, parse it back out in the Eval PHP on IPN completion, and just poke the unblock into that row in the jos_users table.

    I'm also thinking that the PayPal plugin needs an email template to send on succesful IPN. At the moment, we just send a simple pre-formatted (hard coded!) 'paypal success' email to the payer_email (i.e. their PayPal email account).

    -- hugh
  9. peamak Moderator

    Level: Community
    I'm jumping here ;)

    Hugh: I started making some changes on the paypal plugin, as you know. I was thinking having the possibility the select different PHP files for different Paypal IPN status and making some basic ones like "IPN_SUCCESS_send_email.php", "IPN_FAILED_send_email.php",etc. that people could modify and also add some code in each or make their own... I'll have to get back to this very soon so I keep you (Hugh and all) informed :)
  10. cheesegrits Support Gopher

    Level: Community
    OK, just got your Skype, we can do some testing today.

    --hugh
  11. smahaf New Member

    Level: Community
    That sounds great to me.. let me know when you have something to test..

    Thanks
  12. polarweb Member

    Level: Community
    Is it all possible to program into the paypal plugin itself to allow you to set which email address to send IPN messages to? Rather than obtaining those tidbits from paypal:
    payer_email, buyer_email, can we do something to send to wherever we want, including adding {tablename_elementname} capability?
  13. cheesegrits Support Gopher

    Level: Community
    Yes, although it's not entirely trivial. You can specify an IPN Custom Element, and add your email address(s) to the "IPN Custom Value", using literal text or placeholders.

    Then create your own "IPN PHP File", based on the example we give in the ./scripts folder in the plugin folder. Should be fairly obvious how this file works - it builds a class, with a method to be called for each IPN status, like payment_status_Completed(), payment_status_Pending(), etc.

    For each IPN status you want to customize the emails for, provide a method. You'll find your custom IPN values in the $set_list array arg to the method, indexed by whatever your IPN custom element is called (short form, I think), so if your IPN custom element is ipn_custom_data, it'd be in $set_list['ipn_custom_data'].

    There should be enough example code in our sample script to work out how to send your own emails, once you have the addresses.

    Note of course you can add your own 'private' methods to the example IPN class code, for instance you'd probably want to add a _sendIPNemail() (or whatever) method, which you can call from any of the other IPN status methods as $this->_sendIPNemail(), rather than duplicating your email code in every status method.

    -- hugh

Share This Page