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.

S2Member Hack for changing IPN data

Home Forums Community Forum S2Member Hack for changing IPN data

Tagged: , ,

This topic contains 13 replies, has 2 voices. Last updated by  Ryan Carter 3 years, 5 months ago.

Topic Author Topic
Posted: Sunday Aug 4th, 2013 at 8:26 pm #55167

Hi Guys, Following on from my other question – I’d like to get to the bottom of this one.

I’m using code from this post – http://www.s2member.com/forums/topic/pre-existing-paypal-accounts-custom-value/
to change the ‘custom value’ of what the IPN sends when it communicates through paypal. I’m using Zapier as I can’t get the multiple IPN config working correctly (I don’t see anything in the log when i’ve resent from paypal IPN history, so i use Zapier as then I know it’s not getting lost on the way.)

Anyway, the code I’m using is

Would this be correct to change any custom value I have comign from paypal to mynewurl.net as it doesn’t work. I get this error:

http://db.tt/rrwZRBcp

Any help on the above would be great

Cheers!

List Of Topic Replies

Viewing 13 replies - 1 through 13 (of 13 total)
Author Replies
Author Replies
Posted: Sunday Aug 4th, 2013 at 11:50 pm #55188
Moderator

In your WordPress® General Settings panel where you have the URL of your site listed, what domain is listed there, and does it have the www. prefix or no?

s2Member® needs to see a custom value with a domain that matches your WordPress® installation precisely. If you use the www. prefix, please include that. If you don’t, please exclude that.

Posted: Sunday Aug 4th, 2013 at 11:53 pm #55190
Moderator

Would this be correct to change any custom value I have comign from paypal to mynewurl.net as it doesn’t work.

As long as all of the IPN data coming in contains a Proxy Key, yes; this is fine.
See: Dashboard -› s2Member® -› PayPal® Options -› PayPal® IPN Integration
Look for the section that provides details on the Proxy Key here.

WARNING: If some of your IPN data comes straight from PayPal (which is normally the case); then you can’t get away with this because s2Member® actually does a post back to PayPal and PayPal verifies that it did indeed send the exact data s2Member® is looking at.

If PayPal® didn’t send this custom value through; and you have no Proxy for s2Member® to verify either, we have to go with what PayPal says. In this case, PayPal would say it’s unverifiable because the custom value is being modified between the time PayPal sent it to s2Member® and when s2Member® actually processes this value and looks for verification.

To reiterate, if you pass a Proxy Key through the IPN, this is a non-issue.

Posted: Monday Aug 5th, 2013 at 2:22 am #55210

Hi Mike, It doesn’t have the prefix of www. just http://mydoma.in

I pass it through a proxy key as well, it looks to verify correctly.

Here’s a full log entry

LOG ENTRY: Fri Aug 2nd, 2013 @ precisely 3:42 pm UTC
PHP v5.4.17 :: WordPress® v3.6 :: s2Member® v130802
Memory 12.25 MB :: Real Memory 12.50 MB :: Peak Memory 12.26 MB :: Real Peak Memory 12.50 MB
newdomain.net/?s2member_paypal_notify=1&s2member_paypal_proxy=[proxy-gateway]&s2member_paypal_proxy_verification=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User-Agent: Zapier
array (
  'last_name' => 'TaXXXXXX',
  'receiver_email' => 'XXXXXXX@rocketmail.com',
  'mc_amount3' => '9.95',
  'residence_country' => 'GB',
  'option_name1' => 'Originating Domain',
  'subscr_date' => '11:23:29 Jul 31, 2013 PDT',
  'invoice' => '5XXXXXXXX025~31.81.165.211',
  'option_name2' => 'Customer IP Address',
  'payer_status' => 'verified',
  'txn_type' => 'subscr_cancel',
  'verify_sign' => 'A--XXXXvN8L.-MHjxC9uypXXXXXXXXXXXXX2OelAfd',
  'first_name' => 'Mark',
  'item_name' => 'Product 4.',
  'charset' => 'windows-1252',
  'custom' => 'olddomain.co.uk',
  'notify_version' => '3.7',
  'recurring' => '1',
  'item_number' => '4',
  'option_selection1' => 'olddomain.co.uk',
  'business' => 'XXXXX@rocketmail.com',
  'option_selection2' => '31.81.165.211',
  'payer_id' => '7QXXXXXM26',
  'period3' => '1 M',
  'period1' => '1 W',
  'item_names' => 'Product 4.',
  'subscr_id' => 'I-9R4AXXXXXXXX',
  'resend' => 'True',
  'querystring' => 'cid',
  'mc_currency' => 'GBP',
  'mc_amount1' => '0.0',
  'payer_email' => 'XXX@hotmail.co.uk',
  'ipn_track_id' => 'XXXXXXXX5668',
  'reattempt' => '1',
  'proxy_verified' => '[proxy-gateway]',
  's2member_log' => 
  array (
    0 => 'IPN received on: Fri Aug 2, 2013 3:42:56 pm UTC',
    1 => 's2Member POST vars verified with a Proxy Key',
    2 => 'Unable to verify `$_SERVER["HTTP_HOST"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.',
  ),
  'subscr_gateway' => '[proxy-gateway]',
  's2member_paypal_proxy' => '[proxy-gateway]',
  's2member_paypal_proxy_verification' => '6721aXXXXXXX35efc1c5cd4XXX39',
)
Posted: Tuesday Aug 6th, 2013 at 5:07 am #55275
Moderator

I’m not sure if this is real or fake; but just in case it indicates the problem, I noticed the IPN came in on newdomain.net; but the custom value is olddomain.co.uk. Those two need to match up perfectly.

Posted: Tuesday Aug 6th, 2013 at 10:17 am #55289

Hi Mike, I think you’re misunderstanding.

I’m aware they need to match, that’s what I’m trying to achieve with the hack.

Posted: Tuesday Aug 6th, 2013 at 1:45 pm #55298
Moderator

Thanks for the reply Ryan! :-) Sorry for the misunderstanding.

So let’s go back to your original post for a moment and just double check some things before we go any further. In the code snippet you posted previously, and based on the log entry you posted later, I would make the following observation.

You posted this…

<?php
add_filter('ws_plugin__s2member_paypal_postvars', 'my_postvars_filter');
function my_postvars_filter($postvars = array())
	{
		if(!empty($postvars['custom']) && $postvars['custom'] == 'mynewurl.net')
			$postvars['custom'] = $_SERVER['HTTP_HOST'];
		
		return $postvars;
	}
?>

and later you posted this log entry…

'item_name' => 'Product 4.',
  'charset' => 'windows-1252',
  'custom' => 'olddomain.co.uk',

Please correct me again if I’m still not getting this right, but it looks to me like your code snippet needs to have the following instead of newdomain.net. Have you tried this to see if works properly under this scenario?

<?php
add_filter('ws_plugin__s2member_paypal_postvars', 'my_postvars_filter');
function my_postvars_filter($postvars = array())
	{
		if(!empty($postvars['custom']) && $postvars['custom'] == 'olddomain.co.uk')
			$postvars['custom'] = $_SERVER['HTTP_HOST'];
		
		return $postvars;
	}
?>
Posted: Tuesday Aug 6th, 2013 at 1:54 pm #55299

Hi Mike,

Thanks for the reply,

I’ll give you a brief overview of what I’m hoping to achieve and we can make sure I’m doing the correct thing.

I had 2 s2member sites that offered 2 different services, I’ve now created one which houses both services and have moved all of my members

I believe I need to force s2member to change the custom value to the new domain so that the members IPN can be processed if they cancel their payment.

Am I correct in presuming this? As from forum posts I’ve viewed this needs to be done?

Posted: Tuesday Aug 6th, 2013 at 2:02 pm #55302
Moderator

On these previous domains where your services were separated, were you using PayPal Buttons exclusively? Or was there a mixture of both Buttons and Pro Forms also?

Posted: Tuesday Aug 6th, 2013 at 2:11 pm #55305

Buttons only, I didn’t have s2member pro on the old domains

Posted: Tuesday Aug 6th, 2013 at 2:14 pm #55306
Moderator

Thank you.

With Buttons, the IPN URL is (was) defined on a per-Button basis; and unfortunately, PayPal makes it pretty much impossible to alter this later if you move the site. So the following assumption that you are asking me to confirm is absolutely correct, this IS what you will need to do.

I believe I need to force s2member to change the custom value to the new domain so that the members IPN can be processed if they cancel their payment.

Am I correct in presuming this? As from forum posts I’ve viewed this needs to be done?

Posted: Wednesday Aug 7th, 2013 at 2:13 am #55341

Hi Mike, Thanks for the reply.

I see you’ve said “PayPal makes it pretty much impossible to change this value”

Does this mean that it’s 100% impossible? Just the words ‘pretty much’ gives me a glimmer of hope.

Posted: Wednesday Aug 7th, 2013 at 5:12 am #55345
Moderator

:-) I should have said it’s not possible. However, I can’t really say that because you just never know. We don’t control PayPal of course, and they have their rules over there :-)

So I’ll say it like this. It MIGHT be possible, but good luck getting PayPal to actually do this for you). If you want to give it a shot, I would suggest writing to PayPal and explaining what you want to do (e.g. you need to have the IPN URLs updated across all members that joined up with Buttons). If they say no, at least you tried, and hopefully they’ll come around at some point and make this easier on folks.

What they usually say is that it’s up to you to build an IPN handler that can accept data from the old accounts and point it to the new ones. This is exactly the path you’re on here already, so it’s a good backup if they say no.

Posted: Wednesday Aug 7th, 2013 at 2:17 pm #55362

Ah nightmare, I guess i’m going to have to work out a way of getting an email to myself when someone from my old domains cancel their subscription. That way I could fill in the EOT myself. a bit of a thankless task but essential when I can’t do much more!

Viewing 13 replies - 1 through 13 (of 13 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.