Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: RFD on January 12, 2018, 07:04:17 PM

Title: Core Feature - "Paid Subscriptions"
Post by: RFD on January 12, 2018, 07:04:17 PM
my forum is SMF 2.0.13 and i just set up the paid subscriptions feature and ran a test.  paypal got the money and completed the transaction, but SMF still shows the user's status as "Pending Payment".  i have made no changes to my paypal business account money matters settings.  also, the duration of this subscription is 14 days and SMF shows no end date.  please see attached images.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 12, 2018, 09:20:37 PM
Anything in your error log?  Are you using https?
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 13, 2018, 07:31:06 AM
not using https, zero errors in the SMF error log ...
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 13, 2018, 08:07:54 AM
interestingly, i set up paid subsrciptions in another SMF 2.0.13 forum that used the same paypal from account, but a different paypal receive account and it worked perfectly ... and unlike the other paypal receive account, this one that worked is not a business account.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 13, 2018, 02:41:09 PM
If you use a PayPal business or premier account, you have to have your primary PayPal email address in Paid Subs settings.  PP is in the process of updating their security, validation postback will no longer be accepted from http, only https, but afaik, the change hasn't been implemented.

Try uploading the attached Subscriptions-PayPal.php (save your original), it contains additional error handling that's not in core version.  Do a test sub, check your error log.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 13, 2018, 04:46:39 PM
primary PP address is in the PS settings.  did you also mean to change 'Subscriptions-PayPal.php' to 'subscriptions.php'?  if so, it did that and got same results as before and nothing in the error log.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 13, 2018, 05:01:51 PM
No, subscriptions.php is in forum root, don't touch that.  The attached Subscriptions-PayPal.php replaces the existing file in /Sources, same file with some additional error handling.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 13, 2018, 05:29:42 PM
failed again but this time i got an error log hit ....
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 13, 2018, 10:23:26 PM
Won't be back on my computer til late tomorrow, but contact PayPal support, tell them ipn verification is failing, they should be able to trace it from their end.  It may be because you're using http, not https.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Aleksi "Lex" Kilpinen on January 14, 2018, 04:14:59 AM
Quote from: RFD on January 13, 2018, 05:29:42 PM
failed again but this time i got an error log hit ....
Do you have Instant Payment Notification (IPN) configured in Paypal?
I've used the Paid subscriptions with paypal for years, and haven't seen any issues ( even though I started with a personal account, and have since upgraded to Business. )
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 14, 2018, 07:33:39 AM
i have two other SMF 2.0.13 forums, on http domains.  i just set each of those up with Paid Subscriptions going to a non-business paypal account.  i did nothing to the paypal account and IPN is not setup at all.  they both work perfectly, with subscriptions going 'active' as soon as the payment is completed at the paypal side.

what's failing is this one paypal business account that''s not updating the forum.

i spoke with paypal website tech support last week and got conflicting answers.  the first tech said i'd need to buy 'paypal pro' for $30/month.  clearly, setting up my other two non-business paypal forums for paid subscriptions and having them work perfectly makes that tech's info nonsense. 

the other tech support person said that two things needed to be set in paypal ... 'my selling tools' 'Website preferences' turn 'auto return' on and enter a return URL ... also in 'my selling tools' 'Instant payment notifications' needs to be turned on, and i did (see attachment).  none of this worked at all, no paid subscription went 'active' (though i could manually make the subscriptions active). 

i don't know if both SMF and paypal are set up correctly, because at this point i haven't a clue as to what the problem is, other than seeing the SMF error log tell me there's an IPN failure.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 14, 2018, 09:34:24 PM
•  It is not necessary to enable IPN in your PayPal account; if you do, the forum will receive payment notifications for all payments made to your account, and this will generate Paid Subscriptions errors for payments that are not subscription related.

This is the current info being posted by PayPal regarding security upgrades -

Merchants and partners use Instant Payment Notification (IPN) to receive notifications of events related to PayPal transactions. The IPN message service requires that you acknowledge receipt of these messages and validate them. This process includes posting the messages back to PayPal for verification. In the past, PayPal has allowed the use of HTTP for these postbacks. For increased security going forward, only HTTPS will be allowed for postbacks to PayPal. At this time, there is no requirement for HTTPS on the outbound IPN call from PayPal to the merchant's IPN listener.

To avoid any disruption of service, you must verify that your systems
are ready for this change by June 2018.

UPDATE
PayPal is committed to providing the highest level of security to protect customer and transactional data, and we work closely with our merchant community to do the same. In response to feedback from several merchants, PayPal did not strictly enforce some of these vital security upgrades prior to the June 2017 deadline. However, in order to provide the most secure experience for all of our customers, PayPal must proceed with implementing these upgrades in the first half of 2018. In early 2018, we will conduct brief rounds of testing which will emulate the upgraded security experience so that merchants can understand the areas of their integration that still require work. Dates for these tests and full deployment will be published on this site at least two weeks prior to implementation.


AFAIK, verification postbacks should still work from http addresses, but it's possible they've implemented the security upgrade on business accounts.  PayPal's merchant support used to be very good, but last time I used it it had apparently been moved offshore, and it sucked.  No way you should have to pay for an upgrade to get a business account to work.  You will eventually have to convert to https to continue using paid subs, may as well do it now and see if it fixes the problem.

https://www.simplemachines.org/community/index.php?topic=555034.msg3934593#msg3934593
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 14, 2018, 09:54:29 PM
good to know the coming 6/18 PP https requirement for paid subscriptions and IPNs.

dealing with PP tech support hasn't been the answer for me, particularly judging from the completely different answers i get.

however, if it (SMF paid subscriptions) works perfectly my two non-business PP accounts, it should work just as well with a PP business account.  unless there is an issue on the PP side ... or SMF side. 

hmm.

the only thing i can think of to do now, is to create a new SMF 2.0.13 test forum, kick off paid subscriptions, and link it to my PP business forum, and test out paid subscriptions.  if it fails, chances are the problem is on the PP side, if it succeeds, i've probably got an SMF issue with my live SMF forum that's failing for paid subscriptions.
 
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 14, 2018, 10:12:28 PM
IIRC, the ipn verification error occurs after payment is successful and PayPal has posted ipn to subscriptions.php.  IPN contains a verification code, which forum posts back to PP, which then posts verification to forum.  Subscription does not activate until verification is received.  This is the part that will fail when PP security upgrade requiring https goes into effect.  IPN post data is included when forum posts 'invalid transaction type' error.  If you want to confirm that ipn is received, and view post data, you can diddle the code in subscriptions.php and force it to log all transactions.  Let's see if I can remember how to do it .......


Ok, in subscriptions.php find this -



if (empty($txnType))
generateSubscriptionError($txt['paid_unknown_transaction_type']);



Do this -



///if (empty($txnType))
generateSubscriptionError($txt['paid_unknown_transaction_type']);



Find this -



// Then just log and die.
log_error($text);

exit;



Do this -



// Then just log and die.
log_error($text);

/// exit;



Do a test subscription, it should log an error that lists ipn post data.

You also should upgrade your forum to 2.0.15, I believe there was an update to accommodate PayPal's new security protocols.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 15, 2018, 06:08:45 PM
i believe that 2.0.14-15 require php 5.5 - don't have that ..... yet .... in the process of upgrading.

accomplished the above and here's the resulting error log ...
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Arantor on January 15, 2018, 06:29:30 PM
They require 5.4 or higher.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 15, 2018, 06:33:33 PM
i'm on 5.3 ... just a silly point away.  :o  8)
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 15, 2018, 09:11:57 PM
Payment is successful, PayPal is posting ipn to subscriptions.php, nothing amiss in post data.  Verification is failing, PP is either not receiving postback from forum, or not posting verification back to forum.  Replace your business account with personal account, do a test sub, see if it activates.  If it does, problem is on PayPal's end, paid subs doesn't care which type of account you use, it handles transaction exactly the same.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 07:12:18 AM
all paid subscription tests from the tradmla SMF 2.0.13 forum to both business (tradmla) and personal (bpgang) paypal accounts fail to go active.

all paid subscription tests from the bpgang SMF 2.0.13 forum to both business (tradmla) and personal (bpgang) paypal accounts work perfectly and upon immediate paypal completion go active,



Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 07:38:07 AM
using a totally different personal paypal account, and the bpgang SMF 2.0.13 forum, with the tweaked subscriptions.php script (to show errors), a subscriptions test completed to active and below is the error log for that transaction.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 16, 2018, 04:58:29 PM
If subscription worked correctly using personal account on same install where business account failed, then problem is on PayPal's end.  Forum is sending postback for verification, PP is not returning verification.  Subscription will show as pending. 

In early 2018, we will conduct brief rounds of testing which will emulate the upgraded security experience so that merchants can understand the areas of their integration that still require work.

It's possible they've implemented security upgrades on business accounts, not on personal.  In better days, PP had merchant support which was separate from general support, and was quite good.  They were able (and willing) to trace individual transactions and determine why they failed.  You could give them txn_id from ipn dump, and they'd use that for trace.  The link I have still works, you can give it a try -

PayPal Merchant Technical Support - http://www.paypal.com/mts
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 05:55:11 PM
SOL, i do appreciate yer time and efforts in assisting with this issue, that's become more of a conundrum at least for me.  as i previously posted ...

Quote... all paid subscription tests from the bpgang SMF 2.0.13 forum to both business (tradmla) and personal (bpgang) paypal accounts work perfectly and upon immediate paypal completion go active ...

at this point, i don't have a clue what's screwing up, let alone why.  but i will take it up with PP at their MTS support - much obliged for the link, Sir (OL).   8)

 
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 16, 2018, 06:02:56 PM
Is the same business account working on one forum and failing on another?
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 06:05:18 PM
Quote from: Sir Osis of Liver on January 16, 2018, 06:02:56 PM
Is the same business account working on one forum and failing on another?

yes.  works on bpgang, fails on tradmla.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 16, 2018, 06:11:05 PM
That's different.  Both installs are 2.0.13?  Personal account works on both, business account works on one, fails on other?  Both http?  On same host?
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 06:27:22 PM
Quote from: Sir Osis of Liver on January 16, 2018, 06:11:05 PM
That's different.  Both installs are 2.0.13?  Personal account works on both, business account works on one, fails on other?  Both http?  On same host?

verified - yes to all.  to prove it, i'll do another test tomorrow early morn and grab the screenshots.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 16, 2018, 06:35:25 PM
Post the ipn dumps as text, my eyes are shot and can't see the screenshots very well.

Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 16, 2018, 06:48:38 PM
will do.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 17, 2018, 07:41:15 AM
this is beginning to make even less sense ....
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 17, 2018, 12:28:16 PM
Just did a subscription from clean 2.0.15 http test install to your PP account [email protected], sub activated without error.  Only discrepancy is start date is Dec 2015, end date is correct.  Going offline, will be back on tonight.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 17, 2018, 05:57:57 PM
so ... you used an SMF 2.0.15 forum, with paid subscriptions enabled, set tradmla as the paypal recipient, enabled a subscription that was completed by the tradmla paypal that issued the IPN to set the subscription in your forum to "active". 

if 2.0.15 is the fix, i'm at 5.3 right now and awaiting the move to a mysql server with 5.5, maybe by next week.  then i can upgrade SMF and see how it goes.

concerned over yer subscription's 2015 start date - weird and not expected.

much obliged,
r.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 17, 2018, 09:02:39 PM
Should work in earlier SMF versions.  IPN is not the problem, you're receiving that, but verification is failing.  Transaction makes two round trips to/from PayPal.  Forum posts transaction to PayPal, PP posts ipn to forum, forum posts verification code back to PP, PP posts verification to forum.  There were some changes made to paid subs in 2.1.14 or .15 to comply with PP's new security protocols, bad start date indicates something was broken, but subscription works normally on one of your forums and my test install, that would indicate the problem is in the forum where it doesn't work, not on PP's end.  Will look through the code soon as I get a chance and see what's been changed, but subscription should activate on all of your forums.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 18, 2018, 06:12:40 AM
man, i really need paid subscriptions to work, it's one big reason i recommended the TMA org go with SMF for their forum software ... whatever it takes, and whatever i can do to help make it happen.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 18, 2018, 03:48:34 PM
There are at least a couple of glitches in play here, but your PayPal business account seems to be handling paid subs transactions correctly.  There were a few code updates in subscriptions.php and Subscriptions-PayPal.php from 2.0.10 -> .15, none from 2.0.13 -> .15, and afaik, there aren't any mods that touch either of those files (there shouldn't be).  The tweaked files I gave you are 2.0.15, and subs activate normally on my .15 test install using those files.  The business account is working on one of your forums, so something's not right with the install that's having the problem.  If you can pm admin and ftp access to both forums, I'll have a look.  Don't believe the start date problem is related to the activation fails, will see if I can replicate it on sandbox account and track it down.  I may be doing additional test subs to your PP account, don't bother refunding the $.10 (a dime's not worth ****** anymore :P).
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 18, 2018, 04:09:38 PM
Quote from: Sir Osis of Liver on January 18, 2018, 03:48:34 PM
There are at least a couple of glitches in play here, but your PayPal business account seems to be handling paid subs transactions correctly.  There were a few code updates in subscriptions.php and Subscriptions-PayPal.php from 2.0.10 -> .15, none from 2.0.13 -> .15, and afaik, there aren't any mods that touch either of those files (there shouldn't be).  The tweaked files I gave you are 2.0.15, and subs activate normally on my .15 test install using those files.  The business account is working on one of your forums, so something's not right with the install that's having the problem.  If you can pm admin and ftp access to both forums, I'll have a look.  Don't believe the start date problem is related to the activation fails, will see if I can replicate it on sandbox account and track it down.  I may be doing additional test subs to your PP account, don't bother refunding the $.10 (a dime's not worth ****** anymore :P).

pm sent to ya ....
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 06:11:34 AM
Any updates on this? Have you been able to find out what was causing this?
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on January 25, 2018, 06:17:18 AM
extensive testing done and all failed with SMF 2.0.13 - need testing with SMF 2.0.15 and that requires moving my domain to a php 5.5 server, which is in the process of happening ...........
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 06:17:48 AM
OK, thanks for the update :)
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on January 25, 2018, 06:51:44 PM
Best guess is it's a php 5.2 problem.  Both his business and personal PayPal accounts work fine on 2.0.15 test install in php 5.6.33, and on OP's other 2.0.13 forum in php 5.3.29.  Problem is with 2.0.13 forum running in php 5.2.17.  Payment is successful, ipn is received, but verification fails.  Waiting for php upgrade.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on February 12, 2018, 06:22:01 PM
ok, took quite awhile but the domain is now on a new php 5.5 server as of this afternoon.  tomorrow i'll do the 2.0.13 to 2.0.15 upgrade, then test out the paid subscriptions.  it appears that the upgrade will require all the hack packages to be reinstalled, too.  i hope the upgrade won't change any of the SMF configuration settings i had set for the board.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on February 12, 2018, 09:31:43 PM
If you patch from 2.0.13 to 2.0.15 using package manager, shouldn't affect your mods or customizations.  If you upload the 2.0.15 large upgrade package to clean up your install, all mods will be removed.  Settings are in your database and shouldn't be affected.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on February 12, 2018, 09:58:12 PM
the package manager suggests updating from 2.0.13 to 2.0.14 and offers a link to fetch it, which when i do sez there are errors ... or should i have the package manager download the 2.0.15 release and have it install that?
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on February 12, 2018, 10:10:30 PM
Having a look.

Ok, upgraded to 2.0.15, test subscription worked.  Problem was php 5.2.  Give it a shot.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: RFD on February 13, 2018, 06:19:48 AM
works like a charm now!  that was the ticket - php 5.5 and smf 2.0.15

THANK YOU sir osis! 
Title: Re: Core Feature - "Paid Subscriptions"
Post by: horisize on May 24, 2019, 02:10:30 AM
I had two subscriptions last night. Both showed error log(one had two similar error messages: Unknown Paid Subscriptions transaction type. One enrolled, the other did not! Im on the latest SMF, but had the same problem with the last version too. Not sure how to update Paid Subs without screwing anything up. Never tried.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Sir Osis of Liver on May 24, 2019, 02:38:41 AM
You should start a new topic.  There were very few changes in Paid Subs in 2.0 branch, but PayPal has been a mess recently.  Are you at 2.0.15?  Did you change anything?  Php version?  Http or https?  Post the errors from your log.
Title: Re: Core Feature - "Paid Subscriptions"
Post by: Irisado on May 26, 2019, 06:21:45 AM
Please refrain from raising old support topics which have been marked as solved.  If you need assistance with this issue please start a new topic as requested.  Topic locked.