latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Pre-existing paypal accounts 'custom' value

Home Forums Community Forum Pre-existing paypal accounts 'custom' value

This topic contains 4 replies, has 3 voices. Last updated by  Jason (Lead Developer) 3 years, 10 months ago.

Topic Author Topic
Posted: Sunday Feb 17th, 2013 at 11:03 am #42027
Scott Newby
Username: snewby

I just migrated my pre-existing custom coded site to word-press / s2member and here is the gotcha…

In the previous site, I used paypal buttons and set the custom value equal to the id of the subscriber so I could quickly update the user subscription when it came back from paypal.

Now it turns out that I am getting this in the IPN return…

0 => ‘IPN received on: Sun Feb 17, 2013 3:39:31 pm UTC’,
1 => ‘s2Member POST vars verified through a POST back to PayPal®.’,
2 => ‘Unable to verify `$_SERVER[“HTTP_HOST”]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.’,

now my custom value is ‘custom’ => ‘7648’, in the ipn return. New subscription are working just fine through the site, but I have several hundred recurring subscriptions

I modified my stored paypal button code to the domain name, but of course the custom value is stored in paypal with the profile, and I can’t modify it.

How do I get around this? Do I need to ask paypal to modify all of the recurring subscriptions to have their custom value updated to the domain name?

I guess I don’t know the reasoning behind this specific code and why this is an expectation of s2member.

Thanks,

Scott

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Monday Feb 18th, 2013 at 7:21 pm #42369
Bruce
Username: Bruce
Staff Member

Thank you for reporting this important issue.

now my custom value is ‘custom’ => ’7648′, in the ipn return. New subscription are working just fine through the site, but I have several hundred recurring subscriptions

I modified my stored paypal button code to the domain name, but of course the custom value is stored in paypal with the profile, and I can’t modify it.

How do I get around this? Do I need to ask paypal to modify all of the recurring subscriptions to have their custom value updated to the domain name?

I’m unsure of how you could update this. I’ll notify Jason of this, but I believe you should contact PayPal and see if there’s any way to mass edit your Users’ Recurring Profiles to reflect these changes.

Posted: Monday Feb 18th, 2013 at 7:46 pm #42372
Staff Member

Thanks for the heads up on this thread :-)

Probably the easiest way to deal with this, is to simply filter the value as it comes through to s2Member®.

Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
(NOTE: these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins)
(See also: http://www.s2member.com/kb/hacking-s2member/)

Posted: Monday Feb 18th, 2013 at 8:36 pm #42381
Scott Newby
Username: snewby

Hey guys – thanks for the replies…

Yesterday I put in a technical support request with Paypal to request a mass update – still nothing from them, which doesn’t surprise me.

I just put in the directory/page/filter.

In my previous site I sent the unique user id for each account, so the number will be different on each accont – so I modified your code slightly:

<?php
add_filter('ws_plugin__s2member_paypal_postvars', 'my_postvars_filter');
function my_postvars_filter($postvars = array())
	{
		if(!empty($postvars['custom']) && $postvars['custom'] != 'mydomain.com')
			$postvars['custom'] = $_SERVER['HTTP_HOST'];
		
		return $postvars;
	}
?>
Posted: Monday Feb 18th, 2013 at 8:47 pm #42384
Staff Member

Looks good. Thanks for the follow-up.

Just be careful with this line:

$postvars['custom'] != 'mydomain.com'

You don’t want to process IPNs for just any site that might post them. s2Member has some redundant checks to prevent this; but it’s still a good idea to limit this further by asking for a specific value (or a specific set of different values) that your IPN handler will accept.

So translating this number (7648) into your domain is one thing, but translating anything that is not your domain, into your domain; could create a security issue for you that you would not expect.

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.