Pro Sites PayPal Trial Integration

I'm using Pro Sites to run my network. I had my sites set up to have a 2 week free trial at which point the payments should start. Today was the end of that 2 week period - however I found today that instead of having the payments processed instead the PayPal profile was set up to charge them $0 today to *start* their free trial, and then they will start being charged 2 weeks from now. I checked in my set up and it seems that I have things set up correctly in Pro Sites... how do I change things so that my 2 week free trial really only gives a 2 week trial instead of a 2x2 week trial? Help! I really need to start having revenues come in to justify the time and expenses of setting up this network!

I have another ticket in about not being able to cancel payments during the trial period, and I'm wondering if that was related to the trial period not actually having been started yet as far as PayPal was concerned?

  • Brittny
    • Site Builder, Child of Zeus

    I also submitted this issue to PayPal and this was their response -

    In review of the current recurring subscribers, it shows you are not charging any money when the trail period ends. When you created the button for your site, you most likely added two trial periods instead of one. You should create a new button to resolve this. When you see the option that says "Do you want to offer a second trial period?" make sure you leave that defaulted to No.

    Here's how to create a subscriptions button:

    Log in to your PayPal account.
    Click Profile.
    Click My Selling tools.
    Click Update beside 'PayPal buttons.'
    Choose your button type.
    Enter your button information and click 'Create Button.'
    Click 'Select Code' to select the HTML button code.
    Copy and Paste the HTML code in to your HTML code.
    The main differences between a subscription and recurring billing are:

    Recurring Payments integrate with PayPal via APIs. Subscriptions integrate with PayPal via HTML.
    Recurring Payments allow your customers to checkout at cart level with multiple items. Subscriptions allow your buyers to complete their purchase for one item or service at a time.
    Recurring Payments support merchant management, including limited modification, suspension / reactivation, and billing on outstanding amount.

  • Nithin
    • Support Wizard

    Hi Brittny,

    Hope you are doing good today. :slight_smile:

    I have another ticket in about not being able to cancel payments during the trial period, and I'm wondering if that was related to the trial period not actually having been started yet as far as PayPal was concerned?

    This may be related, but to be sure we still need to test this extensively. Is this issue limited to any particular pro sites, or is this now a common issue? Could you please point out the sites which is having this issues?

    I just checked one of your pro sites, I couldn't find a site expiring today, maybe I missed it. In the screenshot below, you'll notice that it should be expiring by 28th, and the subscription dates do look fine.

    Please advise if I had missed out anything, so that we could give a closer look. Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

  • Brittny
    • Site Builder, Child of Zeus

    Hi Nithin,

    Thanks for helping look into this for me. I have multiple sites which were created on 8/11 which expired today - Site IDs 17-26 are all expired (I manually extended one of them), but they were supposed to have their payments processed today for their first payments. However the payment profiles on PayPal today processed a $0 fee for a 2 week free trial (which they've already completed). I was going to just live with the hundreds of dollars of lost revenue and maybe just change my trial length in the system to be 7 days, so that when it was doubled it would give the intended 2 weeks, but since it just cancels their access to their sites... that clearly isn't going to be a workable solution. This problem extends to all of the sites in my system. The payment profiles are all set up incorrectly :slight_frown:

  • Rupok
    • Support Ninja

    Hi Brittny, thanks for asking.

    Double trial issue is already reported to our developer and he is already working with this. Now regarding your cancellation issue, I'm asking my colleagues to check and investigate this and follow up on this one. I believe, we will reach to a solution very soon.

    Have a nice day. Cheers!
    Rupok

  • Brittny
    • Site Builder, Child of Zeus

    So I'm no expert on PayPal integration code, but I believe I've found the issue. I'm assuming that if I set up my account with non-recurring payments the trial period is given by not starting the payment profile until the end of the trial. However *with* recurring payments that profile date needs to start immediately as the free trial is included via PayPal's API (which is what is causing the double trial). The offending code seems to be in /wp-content/plugins/pro-sites/pro-sites-files/gateways/gateway-paypal-files/class-paypal-api-helper.php on lines 347-359

    if ( $has_trial ) {
    
    				$nvpstr .= "&PROFILESTARTDATE=" . ( is_pro_trial( $blog_id ) ? urlencode( gmdate( 'Y-m-d\TH:i:s.00\Z', $psts->get_expire( $blog_id ) ) ) : self::startDate( $trial_days, 'days', $has_trial ) );
    
    			} else {
    
    				$profile_start_date = ( ( $modify ) ? self::modStartDate( $modify ) : self::startDate( $frequency, 'month', $has_trial ) );
    
    				$nvpstr .= "&PROFILESTARTDATE=" . $profile_start_date;
    
    			}

    I think (I haven't been able to test this as I'm still working on putting together my dev environment), that if the PROFILESTARTDATE was just set to be gmdate( 'Y-m-d\TH:i:s.00\Z', strtotime('now') ); instead of going through the startDate helper this issue would be resolved.

    How quickly can I expect a resolution to this? I'm trying not to be too antsy but I'm holding on promoting my service while I'm waiting for this, and it's obviously causing some serious issues for my existing customers and is having a pretty major impact on my business. Is there a workaround that will at least not cancel my existing user's accounts? I thought I'd seen a setting somewhere that said not to turn off an account until a certain number of failed payments had occurred, but now I can't find it.

  • Nithin
    • Support Wizard

    Hi Brittny,

    Hope you are doing good today. :slight_smile:

    I was going to just live with the hundreds of dollars of lost revenue and maybe just change my trial length in the system to be 7 days, so that when it was doubled it would give the intended 2 weeks, but since it just cancels their access to their sites... that clearly isn't going to be a workable solution. This problem extends to all of the sites in my system. The payment profiles are all set up incorrectly

    I checked this issue in my system, and it seems that the pro levels get's cancelled in this case, so there isn't any workaround for this at the moment, other than getting this bug fixed.

    The offending code seems to be in /wp-content/plugins/pro-sites/pro-sites-files/gateways/gateway-paypal-files/class-paypal-api-helper.php on lines 347-359

    Glad to know that you have figured out the issue, and thank you for sharing your observation. I'll definitely pass these to the developer.

    How quickly can I expect a resolution to this? Is there a workaround that will at least not cancel my existing user's accounts? I thought I'd seen a setting somewhere that said not to turn off an account until a certain number of failed payments had occurred, but now I can't find it.

    I'm afraid, I don't have an exact ETA on when a fix would be issued regarding this fix. The developers are aware of this issue, and are working on providing a fix asap. Will keep you updated once a fix has been issued. When it comes to trial period, I'm afraid there isn't a workaround to not cancel the existing account, I do understand that it's causing issues with your business, and I'll ping the developer, and will ask to give a look whether there is any quick workaround that we could work upon.

    Will keep you updated, please let us know if you still need any further assistance.

    Kind Regards,
    Nithin

  • Debbie
    • Webb Weaver

    Hello,
    I have also been experiencing the issue with free trial length being doubled as well as the PayPal payment not being processed on the same date that is set for the payment for the site in Pro Sites.
    I'm relieved it's a bug in Pro Sites (as I have been researching and trying different things to fix it for some time now). And I am eager for it to be resolved! Right now I have to manually extend the Pro Site, however ideally this process works automatically.
    Thanks for your help & looking forward to an update on this!
    Debbie

  • Nithin
    • Support Wizard

    Hi Brittny,

    I'm afraid, I still don't have an exact ETA on when a patch regarding this issue will be released. I have pinged the developer, asking an update regrading this issue. Will definitely keep you updated, once we have a fix for this issue. We truly appreciate your patience regarding this.

    Kind Regards,
    Nithin

  • Debbie
    • Webb Weaver

    Thank you Nithin. I appreciate the developer is busy & that resolving bugs takes time.
    That said, my subscribers currently get double the intended trial period, and I have to extend their subscription manually, then it does not update in pro sites when the payment processes which necessitates another manual extension. It appeares that will be the case for all those subscribe until this bug is fixed, which adversely affects how the pro sites powered sites are functioning. I'm hoping sharing this helps this project get moved up in priority.
    Thank you!
    Debbie

  • Brittny
    • Site Builder, Child of Zeus

    Debbie - So I'm just getting to the point where my subscribers have actually made their first payments and I'm noticing that I have to manually extend their profiles now too. Do you know if at least once I make this final extension if things kick into place and start working again - or do you have to manually extend forever?

    I put this in another ticket but I'm just going to add here, if I don't see that these issues have some fairly immediate resolution I'm going to be cancelling my WPMU account - with all of the problems I've found with payment processing this plugin is for all intents and purposes completely broken and I've seen nothing done to address it in 3 weeks and it's really hurting my business and credibility with my clients.

  • Debbie
    • Webb Weaver

    Kasha - thank you for trying to help this fix get done quickly.

    Brittny - yes, I'm having to manually extend the subscription. I set up a couple test subscriptions to see if the time period will extend when it renews the second month, I can let you know if it does.

  • Debbie
    • Webb Weaver

    Kasia (sorry for misspelling your name above, typos happen more when I respond on my phone!)

    I am having the same issues as Brittny regarding Pro Sites: the trial period being doubled in PayPal, so I have to manually extend the Pro Site subscription to the date that the charge will go through in PayPal. And so far it looks like when that charge does go thru in PayPal, it does not automatically update in Pro Sites. Getting the email notification about the PayPal payment prompts me to manually extend the Pro Sites subscription another month. However, the settings in Pro Sites and the PayPal subscription do not seem to be communicating correctly.

    Will the fix be done to the Pro Sites plugin & sent out as an update? Or do I need to submit a separate support ticket so it can be fixed specifically on my site?

    Thanks for your help!
    Debbie

  • Kasia Swiderska
    • Support nomad

    Hello Debbie,

    Thanks for additional information on this matter - I'm passing that to developer - hopefully we will get hot fix or beta version that will be published in thread, so it will be quicker than new release (however new version is also possible). Either way we will keep you posted in threads.

    kind regards,
    Kasia

  • Brittny
    • Site Builder, Child of Zeus

    Debbie - I haven't solved *all* of the problems, however I have at least figured out how to fix the doubled trials. This is the solution that I had proposed on 8/29 and I've finally been able to test it and it works :slight_smile: I don't know how comfortable you are editing code but if you go in to \wp-content\plugins\pro-sites\pro-sites-files\gateways\gateway-paypal-files\class-paypal-api-helper.php and change line 349 to read:

    $nvpstr .= "&PROFILESTARTDATE=" . gmdate( 'Y-m-d\TH:i:s.00\Z', strtotime('now') );

    That will stop your initial sign up trial lengths from doubling. I'm going to keep working through this tonight and see if I can figure out how to get the accounts to stop cancelling when they're paid for, but at least this is one thing!

  • Brittny
    • Site Builder, Child of Zeus

    So I'm doing some more investigation - I'm noticing as I go into these sites in the database that their payment gateway is set to "trial" or "manual", even though most of my users have PayPal profiles, I only have 1 single site that has the gateway set to Paypal - it seems like the pro_sites table isn't updated to register the paypal profile when the profile is set up which is what is causing the need for manual extensions on these sites that already have payment profiles set up and associated with them. I'll keep this thread updated if I find more clues to what's going on.

  • Debbie
    • Webb Weaver

    Hi Brittny - thank you for sharing your fix! I'm excited to update the file, that will be a huge help until the developer releases an update! Have you had time to do a test signup with your solution & see if the account stays a Pro Site after the payment goes through?

  • Debbie
    • Webb Weaver

    Brittny line 349 is as follows:
    public static function GetRecurringPaymentsProfileDetails( $profile_id ) {
    I have Pro Sites version 3.5.4 installed - to make sure we're using the same version :slight_smile:
    I see &PROFILESTARTDATE in the //handle free trials sections that start on lines 160 and 213
    What is the original code that you changed to what you pasted above? Thanks!

  • Brittny
    • Site Builder, Child of Zeus

    Debbie - I'm not sure where I'd gotten those line numbers from... the code I'd posted in my original post seems to be in the area that you'd mentioned. So here's how my current lines 174- 180 read

    if ( $has_trial ) {
    				$nvpstr .= "&PROFILESTARTDATE=" . gmdate( 'Y-m-d\TH:i:s.00\Z', strtotime('now') );
    			} else {
    				$profile_start_date = ( ( $modify ) ? self::modStartDate( $modify ) : self::startDate( $frequency, 'month', $has_trial ) );
    
    				$nvpstr .= "&PROFILESTARTDATE=" . $profile_start_date;
    			}

    Previously they read as referenced in my first post with some code. I think my code editor is possibly changing the line numbers by double spacing or single spacing the code which is what might be causing the discrepancy in line numbers.

  • Debbie
    • Webb Weaver

    Brittny - Thank you, now I see exactly where you made the changes. You removed quite a bit from the first line, although you found that's what fixes the problem so I'm giving it a go! I've just signed up a test account & from what I can tell the trial period is the same in PayPal as I have it set in Pro Sites. Yay! :slight_smile: Thank you again for finding this fix & posting it. I have the trial period set for a week so I'll post again after it renews.

  • Nithin
    • Support Wizard

    Hi Debbie,

    Sorry to keep this thread long. At the moment, I'm afraid, this issue is still being worked on. I have directly messaged the developer, regrading the status of this issue, and will definitely update this thread, once we have a hot fix regarding this bug. We truly appreciate your patience, and working along with us on this issue.

    Have a nice weekend. :slight_smile:

    Kind Regards,
    Nithin

  • Brittny
    • Site Builder, Child of Zeus

    Debbie - Sorry I've been eyeball deep in getting the transition done over here. Yes that's what I switched to. I had to purchase their premium subscription to get all of the features I needed for multisite but it's been going great so far. A couple minor problems (mostly on my end) but their support has been responsive and helpful. I've been happy with the switch.

  • Rupok
    • Support Ninja

    Hi Debbie,

    I really do apologize for the delay here. Our developer is still working on this I've personally sent him a message requesting to facilitate the process. I believe, he will come up with a patch of fix very soon regarding this. I'll update you here as soon as I get something from him.

    Have a nice day. Cheers!
    Rupok

  • Nithin
    • Support Wizard

    Hi Debbie,

    Pro Sites had a recent update v 3.5.5. Please do update the plugin to the latest version, and see whether it helps. I'm checking this with the developer to see whether the patch has been made into the latest version, or not. Will keep you posted once I get an update from the developer asap. Have a nice weekend ahead. :slight_smile:

    Best Regards,
    Nithin

  • Debbie
    • Webb Weaver

    Hi Nithin ,

    Thank you. I had updated to the latest version, but didn't think to set up a test subscription right away.
    I'll post once I know whether the charge goes through properly after the trial period & hopefully the subscription will also update automatically. Fingers crossed!

  • Debbie
    • Webb Weaver

    Hi Nithin ,

    I signed up a test site on May 11, 2017, it had a 7 day free trial so the payment should have processed on May 18. I see in PayPal that a transaction for $0.00 process on May 18 and that the $39.00 payment is to process on May 25. In Pro Sites I see that privileges expired on May 18, 2017. So it seems that the problem of the trial period being doubled in PayPal was not resolved in the latest version of Pro Sites.

    I have now added the code supplied by Brittny in the post above (https://premium.wpmudev.org/forums/topic/pro-sites-paypal-trial-integration#post-1145464) to the updated version of Pro Sites & am testing another signup. From what I see in the notification from PayPal, it looks like the 7 day trial period started May 19, 2017 and the payment will process on May 26, 2017, which is what it is supposed to do.

    I also noticed that before the latest update to Pro Sites, I had to manually extend the time period for a user that had signed up. I had Brittny's fix in place, so that payments processed in PayPal as set up, but the site did not update in Pro Sites.

    Hopefully now in the latest version of Pro Sites and with Brittny's fix, the payment will process correctly AND the site permissions will be updated automatically. Fingers crossed :slight_smile: I'll post again with an update.

  • Debbie
    • Webb Weaver

    Hi Nithin ,

    After I added the code as referenced in my post on Fri May 19 2017, the payment processed properly, on May 26 2017 for one month, however the time period did not automatically update in Pro Sites, I had to manually extend the subscription.
    So it seems both the issues remain unresolved. Hopefully they'll be fixed soon?!

  • Kasia Swiderska
    • Support nomad

    Hello Debbie,

    I'm terribly sorry for the delay here - I'm checking with developer what happen to fixes to those issues. I see in system they are completed, but you are reporting something different :slight_frown:
    I have to investigate this and will be back to you with update.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.