Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: paq on March 25, 2015, 12:18:51 PM

Title: no paid subscriptions possible in SMF?
Post by: paq on March 25, 2015, 12:18:51 PM
We've tried many many times now to set up 0,01 paid subscriptions in 2.1. All seems to be working fine, payments arrive, the users is being redirected back to the board, but the profile is not automatically updated.
Even when I make a complete fresh install, on a new database, it will have the exact same outcome.

What could be failing here?
Title: Re: no paid subscriptions possible in SMF?
Post by: Kindred on March 25, 2015, 04:56:53 PM
lots of things could be failing -- you don't really provide enough information to debug....
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 25, 2015, 05:12:44 PM
On the 2.1 install I 'manage' to get error e-mails back from the forum stating an unknown transaction type was used.On the subscriptions admin panel however, it claims it has a few fulfilled subscriptions, but when I click the subscription, there are no subscribers. Payments are processed by paypal though.

on 2.0 this all works pretty much the same, only here subscriptions are handled as expected, and subscribers automatically are transferred to the given group, and an overview of the transaction with the purchased subscription is emailed to the admin.

Then I tried an updated version 2.0 > 2.1... same issue

we've double checked the paypal settings a million times, but can't figure out what it is that might go wrong here.
Title: Re: no paid subscriptions possible in SMF?
Post by: lc62003 on March 25, 2015, 05:15:23 PM
Here is a second on that issue.   ;)
Title: Re: no paid subscriptions possible in SMF?
Post by: Deaks on March 25, 2015, 06:38:15 PM
any errors in the logs?
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 25, 2015, 06:47:15 PM
yes
all related to subscription.php

Fouttype: Errors resulting from paid subscriptions, which can include notification of payment failures.
Onbekend tranactietype.
transaction_subject:
txn_type: web_accept
payment_date: 08:12:46 Mar 25, 2015 PDT
last_name: xxxxx
residence_country: NL
pending_reason: unilateral
item_name: test Abonnement
payment_gross:
mc_currency: EUR
business: xxxxxx
payment_type: instant
protection_eligibility: Ineligible
verify_sign: AFQ83kqt8xk0yYDtaN-N-.t9hFpjANEJVZE3YUmZ83PRaUa5h.77scA9
payer_status: verified
tax: 0.00
payer_email: xxxxxxx
txn_id: 9VB014800S5819906
quantity: 1
receiver_email: xxxxxx
first_name: xxx
payer_id: E2BTTQVGRQJ38
item_number: 2+1615
handling_amount: 0.00
payment_status: Pending
shipping: 0.00
mc_gross: 0.01
custom:
charset: windows-1252
notify_version: 3.8
ipn_track_id: xxxxxxxx
Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 25, 2015, 07:51:24 PM
Can you pm the complete (unedited) error log?  payment_status should not be 'Pending', that may be something on PayPal's end.  Will be back on later, and have a closer look.

Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 25, 2015, 11:29:52 PM
Subscription will fail if payment_status is 'Pending', it must be 'Completed' for subscription to activate, as per this -

Subscriptions-PayPal.php



public function isPayment()
{
if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept')
return true;
else
return false;
}



Same in 2.0 and 2.1.  For reasons unknown, PayPal is returning payment_status as 'Pending', which indicates the payment wasn't completed successfully on their end.  Paid Subs is doing what it's supposed to do, it does not activate the subscription and errors out.

Also see payment_gross is blank, and mc_gross: 0.01.  If this is a test subscription, PayPal has a minimum transaction of $0.10USD.  You may have configured it below the minimum.
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 26, 2015, 03:16:27 AM
OK Thanks

I will look that up.
I didn't set this up as being an (admin) test payment/subscription, we did, however, made it 1 cent transactions. Which succeed perfectly on 2.0.

I will send you the PM later.


Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 26, 2015, 04:27:39 AM
right...
1. I set it up to a 0,15 transaction.
2. payment is verified, however the same error occurs.
3. Directly after having the payment made, instead of automatically linking back to the board, paypal shows a link stating "go back to [[email protected] account]"
4. If I click this, the transaction seems to finish and I get an automated link back to the board on the actual next page.
5. Then the error follows by e-mail again (same as in this log, but just stating unknown blbala).

In the IPN log on paypal, the transaction is visible though.

To me it seems that step 3 is the issue. How come paypal is trying to send me back to the receivers paypal address?

d65aea696fc7f0c877edbb0aacb01659
Fouttype: Errors resulting from paid subscriptions, which can include notification of payment failures.
Onbekend transactietype.
transaction_subject:
payment_date: 01:14:36 Mar 26, 2015 PDT
txn_type: web_accept
last_name: xxxxxx
residence_country: NL
item_name: test
payment_gross:
mc_currency: EUR
business: paypal@xxxxxx
payment_type: instant
protection_eligibility: Ineligible
verify_sign: Acp9sEM7MAdfBbGez1P6Ikf8i3dJABwhmYZPD-uLm1boYM38zLuAp0K7
payer_status: verified
tax: 0.00
payer_email: [email protected]
txn_id: 08X83027VW2697046
quantity: 1
receiver_email: paypal@xxxxxx
first_name: xxx
payer_id: E2BTTQVGRQJ38
receiver_id: T84SU8JD5MMVJ
item_number: 1+1614
handling_amount: 0.00
payment_status: Completed
payment_fee:
mc_fee: 0.15
shipping: 0.00
mc_gross: 0.15
custom:
charset: windows-1252
notify_version: 3.8
ipn_track_id: ec742ba0517fb
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 26, 2015, 08:43:22 AM
OK update :)

I now uploaded the 2.0.9 versions of Subscriptions.php and Subs_Paypal.php to 2.1
All though the paypal interface shows (in my opinion) not completely correct information, it seems to suffice in the process sending the IPN back to the board.
The user is "upgraded" to the desired members group.

There is no error log.
The user received the correct (new) id_group
The subscription log in the database went to pending 0, status 1

BUT
Despite the admin panel showing an active subscriber, the actual subscribers list remains empty.



Title: Re: no paid subscriptions possible in SMF?
Post by: margarett on March 26, 2015, 08:59:45 AM
Quote from: paq on March 26, 2015, 08:43:22 AM
I now uploaded the 2.0.9 versions of Subscriptions.php and Subs_Paypal.php to 2.1
That is really a bad idea :P There were code changes from 2.0.x to 2.1 which should cause some problems...

We need to further investigate the current status of paid subs in 2.1...
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 26, 2015, 10:18:55 AM
I understand, but it might give us some idea of where the problem might lay.
and.. it kinda works now ;) Whereas with the out of the box 2.1 files, it doesn't  (at least not on my board)



edit:
I narrowed it down to the paypal file only.
The fresh install /subscriptions.php file works.
For now it is just the older /sources/Subscriptions-paypal.php  (version 2.0.3) that is being used.

Still not showing any subscribers in my list though. (/sources/ManagePaid.php?)
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 26, 2015, 12:50:03 PM
Well, I copied the arrays from the 2.0.9 /Sources/ManagePaid.php (version 2.0.3) to show subscribed users, and this solves my problem  8)

Not sure whether I should mark this topic as being solved, for this took quite some hours of searching, and -clearly- using unintended code in order to get it up and running.
Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 26, 2015, 03:19:57 PM
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Ffp.gif&hash=d0889cee6120d0a650f84d729e497abcf6c7e975) What a mess.  Plugged your PP account into my 2.1 test install.  Payment is successful, subscription fails with error, don't know why.

Here's the problem in ManagePaid.php -



'items_per_page' => $modSettings['defaultMaxListItems'],   



$modSettings is not globalized in function ViewSubscribedUsers().  Have to add it here -



function ViewSubscribedUsers()
{
global $context, $txt, $scripturl, $smcFunc, $sourcedir, $modSettings;



That's not causing sub to fail.  Will work on that.
Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 26, 2015, 04:01:49 PM
Confirmed subscription activates in 2.1 with 2.0.9 Subscriptions-PayPal.php, not with 2.1 file.
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 27, 2015, 06:37:18 AM
Quote from: Krash on March 26, 2015, 03:19:57 PM
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Ffp.gif&hash=d0889cee6120d0a650f84d729e497abcf6c7e975) What a mess.  Plugged your PP account into my 2.1 test install.  Payment is successful, subscription fails with error, don't know why.

Here's the problem in ManagePaid.php -



'items_per_page' => $modSettings['defaultMaxListItems'],   



$modSettings is not globalized in function ViewSubscribedUsers().  Have to add it here -



function ViewSubscribedUsers()
{
global $context, $txt, $scripturl, $smcFunc, $sourcedir, $modSettings;



That's not causing sub to fail.  Will work on that.
aaaah right... the Sourcedir.
Added that > works  ;D


Quote from: Krash on March 26, 2015, 04:01:49 PM
Confirmed subscription activates in 2.1 with 2.0.9 Subscriptions-PayPal.php, not with 2.1 file.

8)
Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 27, 2015, 01:44:23 PM
I know where the problem is in Subscriptions-PayPal.php, just haven't picked it out.  Will have another go tonight.

paq, am using your PP account for test purposes, have to pay with credit card if I use my own.  Buy yourself something nice. ;)
Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 27, 2015, 04:20:44 PM
gheghege thanks :D

the thing is... subscriptions are 1 cent, paypal costs are 35 cents  :laugh:
So I end up with 0,00
Title: Re: no paid subscriptions possible in SMF?
Post by: Sir Osis of Liver on March 27, 2015, 11:35:09 PM
Ok, here's the fix -

Subscriptions-PayPal.php



public function isValid()
{
global $modSettings;

// Has the user set up an email address?

if (empty($modSettings['paypal_email']))

// if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || empty($modSettings['paypal_sandbox_email']))

return false;


Title: Re: no paid subscriptions possible in SMF?
Post by: paq on March 28, 2015, 06:00:56 AM
thanks!  will try this shortly.


edit:
works!  8)