[ABD] Membership Management with Paypal IPN

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
Alfadaveuk
Registered User
Posts: 18
Joined: Sun Jul 29, 2012 3:49 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Alfadaveuk »

doug how your site looks https://dl.dropbox.com/u/27609913/supporter_main.pngthats how i want mine to look i had registered user due to the fact i had not made the groups up yet but my question was you cant see the price for each the levels in the second picture i had posted

Image


this is my acp setting
Image
otherside lol its cut it off on this forum
Image

Qwertyip
Registered User
Posts: 30
Joined: Sat Aug 04, 2012 6:47 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Qwertyip »

Hi Doug,

These are my settings for payment:
Image

Yet, im still not getting any portal, subscriber, txn.
Could you tell me what these figures should be? and where they are set? I will try to debug the problem.

Thanks.

*EDIT* I found a new table:
'phpbb_ipn_log' .. It is also empty.

@ Alfadaveuk,
Thats my site subscriber page.
If you have some understanding of HTML / CSS, To change the look of the subscriber page, you can edit this page:

Code: Select all

styles/<name>/template/subsription.html
Becareful not alter the "Form" that displayes the Radio Fields and submit buttons else you may break it.

Also, before you do that, If you havent modified any files, try redownloading the package from the first page of this thread and uploading all the files.
Ashuming Doug has updated the package, it should fix your current issues.
Last edited by Qwertyip on Sun Aug 19, 2012 3:05 pm, edited 1 time in total.

Alfadaveuk
Registered User
Posts: 18
Joined: Sun Jul 29, 2012 3:49 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Alfadaveuk »

have done the suggestion of uninstalling it then re installing it. i get this error come up http://world-chatter.com/Forum/umil/fil ... processing this is a link it has created and said to send to mod creator :) sorry doug lol. this is from the createPayment.php dont know if this will help but i went to uninstall on the createpayment.php and it said this { [phpBB Debug] PHP Warning: in file [ROOT]/createPayment.php on line 161: Invalid argument supplied for foreach() }
really hate to delay you from your other project of multiple forums boards on 1 domain :) :mrgreen:

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Qwertyip wrote:Hi Doug,

These are my settings for payment:
Image

Yet, im still not getting any portal, subscriber, txn.
Could you tell me what these figures should be? and where they are set? I will try to debug the problem.

Thanks.

*EDIT* I found a new table:
'phpbb_ipn_log' .. It is also empty.
It's working on my site so I've got to think it's something with your changes.

You could try forcing it to subscription by changing application.php

Code: Select all

$subscribing			= request_var('rb_subscription',FALSE);
to

Code: Select all

$subscribing			= TRUE;
But what exactly happens when you click the Paypal button on your website? Could you tell me what the address and arguments are being passed?
There's also a file created in root called .results.log which may shed a little more light.

Regards
Doug

Qwertyip
Registered User
Posts: 30
Joined: Sat Aug 04, 2012 6:47 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Qwertyip »

Hiya.

This is the log file:
============

Sun, 19 Aug 2012 15:42:09 +0100 0 = 'SetExpressCheckout process request returned = Success'


============

Sun, 19 Aug 2012 15:42:48 +0100 0 = 'GetExpressCheckoutDetails process request returned = Success'


============

Sun, 19 Aug 2012 15:42:54 +0100 0 = 'CreateRecurringPaymentsProfile process request returned = Success'


============

Sun, 19 Aug 2012 15:47:00 +0100 0 = 'SetExpressCheckout process request returned = Success'


============

Sun, 19 Aug 2012 15:47:52 +0100 0 = 'GetExpressCheckoutDetails process request returned = Success'


============

Sun, 19 Aug 2012 15:47:58 +0100 0 = 'CreateRecurringPaymentsProfile process request returned = Success'


============
Three Success per attempt.

I select my payment: ($10) and click 'Purchase Membership'
Takes me to...

Code: Select all

http://www.DOMAIN.co.uk/shopping.php?ref=0
On this page, i click 'PAYPAL' to pay:
Takes me to...

Code: Select all

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-6CP93325JP817901W
Sign in to sandbox:

Code: Select all

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-6CP93325JP817901W#pageState=EConsentAgreement&pageDispatch=5885d80a13c0db1f8e263663d3faee8da6a0e86558d6153d8812cd76bf2fd83f&pageSession=vd1ZgO8JGvcKCR4s42I4IsQDW0JfQxezILp_5tsnxCCZB__mSef9I2N44Eu
"Premium Membership for 1 Day Subscription" Click [Accept and Pay]
takes me back to:

Code: Select all

http://www.DOMAIN.co.uk/application.php?&mode=paid&status=0&i=59&billing=2&subscribing=1&return=application&r=0
"Thank you for your payment. As soon as your chosen payment method has been received your membership status will be updated.
Welcome to the club" Click 'Continue'
Back to index.

My group is changed.
In Sandbox, there is a recurring payment every day.

But still no ipn_log ect.
:(

Alfadaveuk
Registered User
Posts: 18
Joined: Sun Jul 29, 2012 3:49 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Alfadaveuk »

sorry for missing pictures in my posts i had a huge error which i have had to reset the whole forum as i dont have the skills to locate the problems and fix them. all seems to have installed a bit better now tho apart from this doug
Payment Processing
PHP Version: 5.3.14
DBMS: MySQL(i) 5.1.63-0+squeeze1
phpBB3 Version: 3.0.10

Adding new config variable: membership_gc
ERROR: Config variable membership_gc already exists.

Adding new config variable: membership_last_gc
ERROR: Config variable membership_last_gc already exists.

Custom Profile Fields
SQL ERROR Duplicate column name 'shopping_basket'

Adding a new database table: phpbb_ipn_log
ERROR: Database table phpbb_ipn_log already exists.

Adding new permission option: a_mark_paid
ERROR: Permission option a_mark_paid already exists.

Adding a new column named txn_type to table phpbb_ipn_log
ERROR: The column txn_type already exists on table phpbb_ipn_log.
thats what i had come up when i went to install the createPayment.php file

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Alfadaveuk wrote:sorry for missing pictures in my posts i had a huge error which i have had to reset the whole forum as i dont have the skills to locate the problems and fix them. all seems to have installed a bit better now tho apart from this doug
Payment Processing
PHP Version: 5.3.14
DBMS: MySQL(i) 5.1.63-0+squeeze1
phpBB3 Version: 3.0.10

Adding new config variable: membership_gc
ERROR: Config variable membership_gc already exists.

Adding new config variable: membership_last_gc
ERROR: Config variable membership_last_gc already exists.

Custom Profile Fields
SQL ERROR Duplicate column name 'shopping_basket'

Adding a new database table: phpbb_ipn_log
ERROR: Database table phpbb_ipn_log already exists.

Adding new permission option: a_mark_paid
ERROR: Permission option a_mark_paid already exists.

Adding a new column named txn_type to table phpbb_ipn_log
ERROR: The column txn_type already exists on table phpbb_ipn_log.
thats what i had come up when i went to install the createPayment.php file
That's fine. If they already exist in the database then it just tells you that. It's only a problem if they're used by another mod. In this case, they aren't so you can safely ignore them.

Regards
Doug

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Qwertyip wrote:Hiya.

This is the log file:
============

Sun, 19 Aug 2012 15:42:09 +0100 0 = 'SetExpressCheckout process request returned = Success'


============

Sun, 19 Aug 2012 15:42:48 +0100 0 = 'GetExpressCheckoutDetails process request returned = Success'


============

Sun, 19 Aug 2012 15:42:54 +0100 0 = 'CreateRecurringPaymentsProfile process request returned = Success'


============

Sun, 19 Aug 2012 15:47:00 +0100 0 = 'SetExpressCheckout process request returned = Success'


============

Sun, 19 Aug 2012 15:47:52 +0100 0 = 'GetExpressCheckoutDetails process request returned = Success'


============

Sun, 19 Aug 2012 15:47:58 +0100 0 = 'CreateRecurringPaymentsProfile process request returned = Success'


============
Three Success per attempt.
Good, so it's setting everything up properly.
qwertytip wrote: I select my payment: ($10) and click 'Purchase Membership'
Takes me to...

Code: Select all

http://www.DOMAIN.co.uk/shopping.php?ref=0
On this page, i click 'PAYPAL' to pay:
Takes me to...

Code: Select all

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-6CP93325JP817901W
Sign in to sandbox:

Code: Select all

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-6CP93325JP817901W#pageState=EConsentAgreement&pageDispatch=5885d80a13c0db1f8e263663d3faee8da6a0e86558d6153d8812cd76bf2fd83f&pageSession=vd1ZgO8JGvcKCR4s42I4IsQDW0JfQxezILp_5tsnxCCZB__mSef9I2N44Eu
"Premium Membership for 1 Day Subscription" Click [Accept and Pay]
takes me back to:

Code: Select all

http://www.DOMAIN.co.uk/application.php?&mode=paid&status=0&i=59&billing=2&subscribing=1&return=application&r=0
"Thank you for your payment. As soon as your chosen payment method has been received your membership status will be updated.
Welcome to the club" Click 'Continue'
Back to index.

My group is changed.
In Sandbox, there is a recurring payment every day.

But still no ipn_log ect.
:(
It sounds as though you've missed the return address in Paypal.
For the seller account it’s necessary to configure IPN. Click on Profile, Under Selling Preferences, click Instant Payment Notification Preferences. Enter the URL of the listener (domain.com/ipnlistener.php) and enable receipt of IPN Messages
Regards
Doug

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Alfadaveuk wrote:doug how your site looks https://dl.dropbox.com/u/27609913/supporter_main.pngthats how i want mine to look i had registered user due to the fact i had not made the groups up yet but my question was you cant see the price for each the levels in the second picture i had posted

Image


this is my acp setting
Image
otherside lol its cut it off on this forum
Image
Yay! I've found the stupid error that messed up the display of the duration. You can download either download just functions_membership.php or the whole package again.

Regards
Doug
p.s. the package also fixes the error with createPayment uninstalling.

DaSpamer
Registered User
Posts: 5
Joined: Thu Aug 09, 2012 8:05 am

Re: [BETA] Membership Management with Paypal IPN

Post by DaSpamer »

Today morning someone did SQL injection on my forum, everything got deleted, backups were deleted too (I was saving them in the host..stupid me :( )
Anyway, the stupid hacker is 15-16 years olds, which showing off too much that he can sql injection with backtrack5...
He said there was security holes, and it happened only after I've decide to switch to bussiness account in paypal and get the mod working.
And that I'm letting too much stuff to do my work...

I'm just saying this, so you might want to check it and prevent/fix/updated some codes...
and if you can, I'd love to have only the members thing, where u can set when the member is getting kicked from the membership, that was the main thing I only needed D:
Goodluck,
Wishing you best.
DaSpamer

Qwertyip
Registered User
Posts: 30
Joined: Sat Aug 04, 2012 6:47 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Qwertyip »

Hi..

Im beginning to lose my mind over this! it's driving me crazy.
I felt like an idiot when u said i hadnt input the IPNListen directory in paypal, Because u were right, i hadnt. Cant believe i missed it in the guide. I thought, omg it's finnaly going to work. But.. no, It didnt :(

I re-downloaded the package and uploaded all the new files.
(By the way, You seem to have deleted the "period_text()" function, instead of fixing it)

My settings are all the same.
API Username, Password, Signature are correct (Just checked).
My IPNListen.php directory is correct. (tested it)
Automated Payment Capable?: (Still Yes)

https://dl.dropbox.com/u/27609913/paypalipn.png

The error 503, is saying it's not getting a correct responce.

Is there anything else i could have missed?

Okay, I've added a line that writes to a file on most lines to debug where the problem is.

IPNListen.php:

Code: Select all

 	 $p->write_results($p->fields['txn_type']);
  
	// IPN has been received and is verified.  
	
	switch (strtoupper($p->fields['txn_type']))
	{
		// Check for new recurring payment profile

		case 'RECURRING_PAYMENT_PROFILE_CREATED':
			// Should already be set up as subscriber
			// but set subscriber field
			$p->write_results("1");
			
			$vars_array = array(
				'portal'			=> 'paypal', 
				'subscriber_id'		=> $p->subscriber_id,
			);
			list($groupid, $userid) = explode('-',$p->fields['rp_invoice_id']);
$p->write_results("2");
			if ((!empty($p->fields['period1']) && empty($p->fields['amount1'])) || (!empty($p->fields['period2']) && empty($p->fields['amount2'])))
			{
			$p->write_results("3");
				$cleared = true; // Free trial period so effectively cleared
				$vars_array['renewal_date'] = strtotime($p->fields['next_payment_date']);
				$p->write_results("4");
			}
			else
			{
			$p->write_results("5");
				$cleared = false; // no trial period specified or chargeable trial period
				$vars_array['renewal_date'] = time(); 
				$p->write_results("6");
			}
			$p->write_results("7");
			process_payment($userid, $cleared);
			$p->write_results("8");
			update_membership($userid, $vars_array);
			$p->write_results("9");

		break;
Text Files:

Code: Select all

recurring_payment_profile_created
1
2
5
6
7
I think problem is with $userid 'process_payment'.

As you can see in the picture above,
rp_invoice_id=59

Where as the lane line in INPListen.php:

Code: Select all

list($groupid, $userid) = explode('-',$p->fields['rp_invoice_id']);
This suggests rp_invoice_id should equal 10-59 (groupid-userid) ?

There is also no 'subscriber_id' in the IPN either.

*EDIT*
Okay i fixed the above problem by: (application.php)
BELOW: $p->add_subscription_item(
CHANGED: $userid,
TO: $config['ms_billing_cycle'.$billing.'_group'] . '-' . $userid,

rp_invoice_id now returns groupid-userid in the IPN.



Line 158, paypal_class.php

Code: Select all

				$this->subscriber_id = $this->EC_data['PROFILEID'];
If i have no subscriber_id (which i dont) .. then nothing really works.

:( I hope you can help.
Last edited by Qwertyip on Mon Aug 20, 2012 2:34 pm, edited 1 time in total.

Alfadaveuk
Registered User
Posts: 18
Joined: Sun Jul 29, 2012 3:49 pm

Re: [BETA] Membership Management with Paypal IPN

Post by Alfadaveuk »

doug so your saying uninstall it all then re install or just copy the files out the root folder in your download then redo the functions membership.php

or do you mean just download the functions membership php then run that?????

can u be very clear to me as im a noob at this and i dont want to have to restart the website again lol if i keep uninstalling and installing the website it goes bad and cant find files then i cant uninstall the mods fully.

using automod

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

DaSpamer wrote:Today morning someone did SQL injection on my forum, everything got deleted, backups were deleted too (I was saving them in the host..stupid me :( )
Anyway, the stupid hacker is 15-16 years olds, which showing off too much that he can sql injection with backtrack5...
He said there was security holes, and it happened only after I've decide to switch to bussiness account in paypal and get the mod working.
And that I'm letting too much stuff to do my work...

I'm just saying this, so you might want to check it and prevent/fix/updated some codes...
and if you can, I'd love to have only the members thing, where u can set when the member is getting kicked from the membership, that was the main thing I only needed D:
Goodluck,
Wishing you best.
DaSpamer
I'm really sorry to hear that. If you just want the management part then simply turn the payment mod off in the ACP.

Regards
Doug

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Qwertyip wrote:Hi..

Im beginning to lose my mind over this! it's driving me crazy.
I felt like an idiot when u said i hadnt input the IPNListen directory in paypal, Because u were right, i hadnt. Cant believe i missed it in the guide. I thought, omg it's finnaly going to work. But.. no, It didnt :(

I re-downloaded the package and uploaded all the new files.
(By the way, You seem to have deleted the "period_text()" function, instead of fixing it)

My settings are all the same.
API Username, Password, Signature are correct (Just checked).
My IPNListen.php directory is correct. (tested it)
Automated Payment Capable?: (Still Yes)

https://dl.dropbox.com/u/27609913/paypalipn.png

The error 503, is saying it's not getting a correct responce.

Is there anything else i could have missed?

Okay, I've added a line that writes to a file on most lines to debug where the problem is.

IPNListen.php:

Code: Select all

 	 $p->write_results($p->fields['txn_type']);
  
	// IPN has been received and is verified.  
	
	switch (strtoupper($p->fields['txn_type']))
	{
		// Check for new recurring payment profile

		case 'RECURRING_PAYMENT_PROFILE_CREATED':
			// Should already be set up as subscriber
			// but set subscriber field
			$p->write_results("1");
			
			$vars_array = array(
				'portal'			=> 'paypal', 
				'subscriber_id'		=> $p->subscriber_id,
			);
			list($groupid, $userid) = explode('-',$p->fields['rp_invoice_id']);
$p->write_results("2");
			if ((!empty($p->fields['period1']) && empty($p->fields['amount1'])) || (!empty($p->fields['period2']) && empty($p->fields['amount2'])))
			{
			$p->write_results("3");
				$cleared = true; // Free trial period so effectively cleared
				$vars_array['renewal_date'] = strtotime($p->fields['next_payment_date']);
				$p->write_results("4");
			}
			else
			{
			$p->write_results("5");
				$cleared = false; // no trial period specified or chargeable trial period
				$vars_array['renewal_date'] = time(); 
				$p->write_results("6");
			}
			$p->write_results("7");
			process_payment($userid, $cleared);
			$p->write_results("8");
			update_membership($userid, $vars_array);
			$p->write_results("9");

		break;
Text Files:

Code: Select all

recurring_payment_profile_created
1
2
5
6
7
I think problem is with $userid 'process_payment'.

As you can see in the picture above,
rp_invoice_id=59

Where as the lane line in INPListen.php:

Code: Select all

list($groupid, $userid) = explode('-',$p->fields['rp_invoice_id']);
This suggests rp_invoice_id should equal 10-59 (groupid-userid) ?

There is also no 'subscriber_id' in the IPN either.

*EDIT*
Okay i fixed the above problem by: (application.php)
BELOW: $p->add_subscription_item(
CHANGED: $userid,
TO: $config['ms_billing_cycle'.$billing.'_group'] . '-' . $userid,

rp_invoice_id now returns groupid-userid in the IPN.



Line 158, paypal_class.php

Code: Select all

				$this->subscriber_id = $this->EC_data['PROFILEID'];
If i have no subscriber_id (which i dont) .. then nothing really works.

:( I hope you can help.
Hi,
Thank you for the assistance. You were right..almost. I stopped using the group and everything else is set up to use just the userid. I changed the code you quoted ages ago but somehow I messed up the package. I'll check the code and put a new version up ASAP.

Regards
Doug

the pips
Registered User
Posts: 511
Joined: Sat Mar 21, 2009 5:33 pm

Re: [BETA] Membership Management with Paypal IPN

Post by the pips »

Alfadaveuk wrote:doug so your saying uninstall it all then re install or just copy the files out the root folder in your download then redo the functions membership.php

or do you mean just download the functions membership php then run that?????

can u be very clear to me as im a noob at this and i dont want to have to restart the website again lol if i keep uninstalling and installing the website it goes bad and cant find files then i cant uninstall the mods fully.

using automod
I'd just copy the files out of root and that should fix this issue.

Regards
Doug

Locked

Return to “[3.0.x] Abandoned MODs”