WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Donate Plus] Recurring Payments not correctly implemented (7 posts)

  1. mercuryjones
    Member
    Posted 4 years ago #

    Firstly I am using WP v2.9.1 and Donate Plus v1.6.
    All is generally working well and I have not had any problem with the Paypal HTTPS redirect that others have had (Im still using Port 80).

    However, after examining the code I don't think you have correctly implemented recurring payments. What you have done is implemented a one-off subscription payment. The Paypal documentation for website payments describes the 'src', 'srt', and 'sra' values which are required to implement recurring payments. These are not used at all in the code. I think you have correctly set 'a3', 'p3' and 't3' values for subscriptions. You also need to set 'src' to indicate that a recurring payment should be initiated and the 'srt' value to the number of times the payment should recur. The 'sra' value is optional and determines whether Paypal should reattempt a failed recurring payment.

    http://wordpress.org/extend/plugins/donate-plus/

  2. mercuryjones
    Member
    Posted 4 years ago #

    In fact if you look at the sample code on page 178 of the Paypal "Website Payments Standard Integration Guide" you can see the value 'src' must be set to '1' to enable a recurring payment. Otherwise only one payment will occur. See also page 180 for an example with a limited number of recurrences.

  3. kentopolis
    Member
    Posted 4 years ago #

    did you figure out how to implement this? It's killing me, I have people who have signed up for recurring and nothing happens past their first payment...

  4. kentopolis
    Member
    Posted 4 years ago #

    It seems as though 't3' has been confused with 'srt' and that 'src' is defaulting to '0' which is "no recur"

  5. kentopolis
    Member
    Posted 4 years ago #

    Ok, took me a bit, but I have corrected this issue and fixed it to where it now works like a charm!!!

    Here is the code that you need to fix in the "donate-plus.php" file

    around line 478 you need to update the code to:

    function displayVals() {
          var t3 = jQuery("#t3").val();
          var amount = jQuery("#amount").val();
          if(t3 != 0){
    	    jQuery('#a3').val(amount);
    	    jQuery('#p3').val(1);
    		  jQuery('#src').val(1);
    		   jQuery('#srt').val(2);
    		jQuery('#cmd').val('_xclick-subscriptions')
    	  }else{
    	  	jQuery('#a3').val(0);
    	  	jQuery('#p3').val(0);
    		jQuery('#src').val(0);
    		jQuery('#srt').val(0);
    	  	jQuery('#cmd').val('_donations');
    	  }
    	  if( !t3 ) jQuery('#cmd').val('_donations');
    
    }

    Note: we have added "jQuery('#src'.val.()" in both the if and else statement, this allows us use the built in jquery to change some of our settings dynamically when your user chooses recurring donations.

    The second piece of code you need to update is found on line 409

    <input type="hidden" name="p3" id="p3" value="'.$dplus['duration'].'" >
    <input type="hidden" name="src" id="src" value="'.$dplus['duration'].'">
    <input name="srt" id="srt" value="'.$dplus['duration'].'" type="text" style="width:20px;" > times <small>(set to "0" to specify no end date)</small>
    <input type="hidden" name="sra" value="1">
    </p>';

    Note: we have changed the ability of the user to designate how many weeks the user wants to donate (ie. every 5 weeks for 6 times) and have assumed that daily, weekly, monthly suffices and have simply added the ability to choose how many times they want this payment to recur. Note that the number of times must either be set to 0 or 2 and above for it to work. Paypal does not recognize 1 - it assumes you made a mistake and meant you did not want a recurring.

    Hope this helps some of you out there, I know I needed it!

  6. shalzers
    Member
    Posted 3 years ago #

    Looking at the changelog.

    Jan 25, 2009 - v1.5.2

    * Fixed PayPal error when not using recurring donations

    Seems the author fixed this issue in later releases using your code.
    However the 0 for indefinite donations was a nice touch that didn't make the code.

  7. shalzers
    Member
    Posted 3 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic