Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: RFD on August 06, 2013, 06:26:29 PM

Title: Subscriptions ....
Post by: RFD on August 06, 2013, 06:26:29 PM
... what's the deal with this smf subscription service, will it ever actually work correctly? 

i've got both premier and business pp accounts and if the "recurring payment" is clicked the transaction fails. 

why not just remove it until the smf and/or pp code actually works? 

i REALLY need a well functioning smf forum ......
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 06:19:47 AM
well, as a band-aid of sorts i edited the subscriptions php code (Sources sub-dir) and removed the offending "recurring payment" code. 

it's attached if anyone finds it useful.

could we get some kinda official response on smf subscriptions bug fixing, please?

Title: Re: Subscriptions ....
Post by: telcy on August 08, 2013, 08:49:04 AM
Why not disabling "Allow user to auto-renew this subscription" in your subscription plan?

It's easier then removing code.
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 08:56:27 AM
Quote from: telcy on August 08, 2013, 08:49:04 AM
Why not disabling "Allow user to auto-renew this subscription" in your subscription plan?

It's easier then removing code.

because that would be too easy.  8)
Title: Re: Subscriptions ....
Post by: emanuele on August 08, 2013, 09:05:28 AM
Last time I've seen a problem with recurring payments was because of the currency (http://www.simplemachines.org/community/index.php?topic=477461.msg3488078#msg3488078) (see last paragraph).
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 09:13:36 AM
don't see currency as an issue, i think it's something else ... ?

with the recurring payment option turned off, or the code for it commented out, it all works just fine.
Title: Re: Subscriptions ....
Post by: telcy on August 08, 2013, 09:19:41 AM
Quote from: RFD on August 08, 2013, 08:56:27 AM
Quote from: telcy on August 08, 2013, 08:49:04 AM
Why not disabling "Allow user to auto-renew this subscription" in your subscription plan?

It's easier then removing code.

because that would be too easy.  8)

:D that's right.

I've also noticed same problems with recurring payments.

With other words,..
If I enable recurring for users they can't buy a subscription. It's a long time ago where I disabled it.

So I will test it again on a seperated smf installation and try to fix the problem.
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 09:40:21 AM
Quote from: telcy on August 08, 2013, 09:19:41 AM
Quote from: RFD on August 08, 2013, 08:56:27 AM
Quote from: telcy on August 08, 2013, 08:49:04 AM
Why not disabling "Allow user to auto-renew this subscription" in your subscription plan?

It's easier then removing code.

because that would be too easy.  8)

:D that's right.

I've also noticed same problems with recurring payments.

With other words,..
If I enable recurring for users they can't buy a subscription. It's a long time ago where I disabled it.

So I will test it again on a seperated smf installation and try to fix the problem.

that would be Awesome - much obliged for at least looking into this long standing problem.
Title: Re: Subscriptions ....
Post by: emanuele on August 08, 2013, 10:29:44 AM
Quote from: RFD on August 08, 2013, 09:13:36 AM
don't see currency as an issue, i think it's something else ... ?
So you have the paypal (in paypal I mean, not in SMF) setting set as I suggested in the other topic?
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 10:39:04 AM
Quote from: emanuele on August 08, 2013, 10:29:44 AM
Quote from: RFD on August 08, 2013, 09:13:36 AM
don't see currency as an issue, i think it's something else ... ?
So you have the paypal (in paypal I mean, not in SMF) setting set as I suggested in the other topic?

it's a pp business account, set up in USD - all payments are in USD as well, no other currencies or currency translations required.
Title: Re: Subscriptions ....
Post by: emanuele on August 08, 2013, 10:46:08 AM
That's already a better answer.

Did you set up the return URL (IPN?) in paypal?
Some reports says that not setting it solves some issues.
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 11:11:21 AM
Quote from: emanuele on August 08, 2013, 10:46:08 AM
That's already a better answer.

Did you set up the return URL (IPN?) in paypal?
Some reports says that not setting it solves some issues.

yep, done and tested with a real pp dollar transfer.
Title: Re: Subscriptions ....
Post by: emanuele on August 08, 2013, 02:46:02 PM
And?... It didn't work?

Give a clear answer is much more effective and make life easier to both me and you. ;)
At the moment without further clarification I can't be sure if it worked or not, I can *assume* it didn't work because you didn't write something like "YAY! IT WORKED!!" but this is not very useful...
Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 02:53:14 PM
Quote from: emanuele on August 08, 2013, 02:46:02 PM
And?... It didn't work?

Give a clear answer is much more effective and make life easier to both me and you. ;)
At the moment without further clarification I can't be sure if it worked or not, I can *assume* it didn't work because you didn't write something like "YAY! IT WORKED!!" but this is not very useful...

parameters -

+ installed current smf version
+ have pp business account
+ pp account setup for subscription service
+ test subscription registration fails when "recurring subscription" is checked
+ test subscription registration is successful when "recurring subscription" is NOT checked

you want access to my forum for a hand's on?


Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 08, 2013, 03:02:23 PM

What is the error (in your error log) when recurring payment fails?

Is the transaction completed in your PayPal account?

Title: Re: Subscriptions ....
Post by: RFD on August 08, 2013, 07:34:00 PM
Quote from: Krash. on August 08, 2013, 03:02:23 PM

What is the error (in your error log) when recurring payment fails?



Is the transaction completed in your PayPal account?

no.

with the recurring subscription option removed, it works perfectly ...



Title: Re: Subscriptions ....
Post by: emanuele on August 09, 2013, 08:19:49 AM
How is the *subscription* set up? (A screen of the settings would be nice.)
Title: Re: Subscriptions ....
Post by: RFD on August 09, 2013, 01:39:11 PM


Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 09, 2013, 02:26:25 PM

That's really odd.  It's a PayPal error, the payment never completes and the IPN isn't sent.

Try changing 'Length of Subscription' to '1 Years'.



Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 09, 2013, 02:31:00 PM

PP is getting an invalid value from this -



// All the standard bits.
$return_data['hidden']['business'] = $modSettings['paypal_email'];
$return_data['hidden']['item_name'] = $sub_data['name'] . ' ' . $txt['subscription'];
$return_data['hidden']['item_number'] = $unique_id;
$return_data['hidden']['currency_code'] = strtoupper($modSettings['paid_currency_code']);
$return_data['hidden']['no_shipping'] = 1;
$return_data['hidden']['no_note'] = 1;
$return_data['hidden']['amount'] = $value;
$return_data['hidden']['cmd'] = !$sub_data['repeatable'] ? '_xclick' : '_xclick-subscriptions';
$return_data['hidden']['return'] = $return_url;
$return_data['hidden']['a3'] = $value;
$return_data['hidden']['src'] = 1;
$return_data['hidden']['notify_url'] = $boardurl . '/subscriptions.php';

// Now stuff dependant on what we're doing.
if ($sub_data['flexible'])
{
$return_data['hidden']['p3'] = 1;
$return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1));
}
else
{
preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match);
$unit = $match[1];
$period = $match[2];

$return_data['hidden']['p3'] = $unit;
$return_data['hidden']['t3'] = $period;
}



Title: Re: Subscriptions ....
Post by: emanuele on August 09, 2013, 05:09:45 PM
Can you check your database in the smf_subscriptions table and see if there is just the subscription you have set up?
I have the feeling something wrong happened somewhere at some point...
And while you are at it, check that the field "length" is "365D".

Also:
http://i.imgur.com/aXMTSX0.png
You are sending an email with as text (or subject, not sure) an email address to your members when the subscription is successful. ;)
Title: Re: Subscriptions ....
Post by: RFD on August 09, 2013, 06:03:45 PM
Quote from: emanuele on August 09, 2013, 05:09:45 PM
....  Also:
http://i.imgur.com/aXMTSX0.png
You are sending an email with as text (or subject, not sure) an email address to your members when the subscription is successful. ;)

hah!  how dumb of me ... all fixed.
Title: Re: Subscriptions ....
Post by: emanuele on August 12, 2013, 08:24:46 AM
"all fixed" you mean the email or also the issue?
Title: Re: Subscriptions ....
Post by: RFD on August 12, 2013, 08:30:54 AM
the email - the pp "recurring subscription" is still a bug.
Title: Re: Subscriptions ....
Post by: emanuele on August 12, 2013, 08:33:54 AM
Considering it is working here (even too well since from time to time people ask to interrupt the subscription) it may or may not be a bug.

Can you ask the other question I posted?
Title: Re: Subscriptions ....
Post by: RFD on August 12, 2013, 08:54:04 AM
if you mean this ...

"Can you check your database in the smf_subscriptions table and see if there is just the subscription you have set up?
I have the feeling something wrong happened somewhere at some point...
And while you are at it, check that the field "length" is "365D"."

i have no clue what yer talking about, sorry.

Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 12, 2013, 02:47:26 PM

Did you try changing subscription length to 1 year?

Title: Re: Subscriptions ....
Post by: RFD on August 12, 2013, 02:52:38 PM
Quote from: Krash. on August 12, 2013, 02:47:26 PM

Did you try changing subscription length to 1 year?

yes.  same problem. 
Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 12, 2013, 03:02:56 PM
Leave the existing subscription and set up a new one with same settings and try that.  Ema is suggesting that something may be wrong with the existing settings in the database.  If that doesn't work, delete all subs and set up a new one.  That may clear a db glitch. 

You can access your db with phpmyadmin via your host control panel, and see what's actually in smf_subscriptions, which is what ema suggested. 

You can also edit Subscriptions-PayPal.php to echo the values it's posting to PP for $return_data['hidden']['a3'], $return_data['hidden']['p3'], and $return_data['hidden']['t3'].  One of them is not being accepted by PP.

Title: Re: Subscriptions ....
Post by: emanuele on August 12, 2013, 03:45:32 PM
More than echo'ing it may be better to use log_error and have them in the error log. :P

If you need any help "on-site" let me know. ;)
Title: Re: Subscriptions ....
Post by: Sir Osis of Liver on August 12, 2013, 11:04:35 PM
Quote from: emanuele on August 12, 2013, 03:45:32 PM
More than echo'ing it may be better to use log_error and have them in the error log. :P

Don't think that will work, as the error is on the PayPal end.  Paid Subs doesn't usually log an error until it receives an IPN, and that's not happening here.  SMF thinks everything is fine when it posts the info, but  IPN is not sent because transaction fails at PP. 

Title: Re: Subscriptions ....
Post by: RFD on August 13, 2013, 05:58:41 AM
the subs works fine as long as i keep the 'recurring subs' switch off.  i installed smf per the smf install instructions.  i've done smf installs many many times in the past, all worked fine without a hitch.  as before, this latest version installation went perfectly, with no issues or errors.  i dunno what the deal is with the 'recurring subs', where the problem lies, but i just don't have much more time to spend on this.  it works as is (with the switch off) and that's all i need to get this thing rolling.  thanx for all yer help, folks.  much obliged.

Title: Re: Subscriptions ....
Post by: Arantor on January 24, 2014, 12:49:01 PM
Well, the original problem is actually that you'd misconfigured it. PayPal does not accept 365 days as a subscription length. As per https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI00JQU

It's complaining about an invalid a3/p3/t3 and that's correct:

QuoteD – for days; allowable range for p3 is 1 to 90
W – for weeks; allowable range for p3 is 1 to 52
M – for months; allowable range for p3 is 1 to 24
Y – for years; allowable range for p3 is 1 to 5

So yeah, 365 days won't be valid. I'm thinking we should probably restrict these values in SMF because even though there's other payment processors, the same restrictions probably apply.


EDIT: Tracked as https://github.com/SimpleMachines/SMF2.1/issues/1274 so moving this to resolved so we can focus on what needs resolution.