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.

S2 Member – Warrior Plus – Integration

Home Forums Community Forum S2 Member – Warrior Plus – Integration

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

Topic Author Topic
Posted: Wednesday Aug 8th, 2012 at 9:58 am #21509

Hey Guys,

I am trying to integrate s2 member with warrior plus.

I have followed all the instructions on this thread http://www.s2member.com/forums/topic/intergrating-s2members-with-wso-pro/

I have created a central file and uploaded it to my server (based on the code provided in the above thread), i.e. http://www.masterytutorials.com/warriorplus_ipn.php

The code for the file is as below:

<?php
/*
---- Configuration. -------------------------------------------------------------------------------------------------------*/

/* s2Member installation domain. */
$config["custom"] = "www.masterytutorials.com";

/* s2Member Membership Level# */
$config["item_number"] = "1";

/* s2Member Proxy IPN URL handler. - You'll get this from Dashboard: `s2Member -> PayPal Options -> IPN Integration -> Proxy IPN URL`. */

$config["proxy_ipn_handler_url"] = "http://www.masterytutorials.com/?s2member_paypal_notify=1&s2member_paypal_proxy=proxy&s2member_paypal_proxy_verification=12b122ba5812a0fcdfb1a1613727464d"; 

/* I have also tried with 
$config["proxy_ipn_handler_url"] = "http://www.masterytutorials.com/?s2member_paypal_notify=1;   */

/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
@ignore_user_abort(true);
header("HTTP/1.0 200 OK");
header("Content-Type: text/plain; charset=utf-8");
eval /* Clean buffers. */('while (@ob_end_clean ());');

if( /* No ``$_POST`` vars? */empty($_POST) || !is_array($_POST))
	exit /* Exit now. There is nothing to process. */();
	
$_p = (get_magic_quotes_gpc()) ? stripslashes_deep($_POST) : $_POST;
$_p = trim_deep /* Now trim this array deeply. */($_p);

$_paypal_ipn_server_ip = $_ip = /* Forge IP address to match the PayPal® IPN server here. */ "216.113.188.202";
/* See list of IPs here: <https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_golivechecklist>. */

$_p["custom"] = $config["custom"]; $_p["item_number"] = $config["item_number"];
echo (trim(curlpsr($config["proxy_ipn_handler_url"], http_build_query($_p, null, "&"), 20, 20, array("REMOTE_ADDR: ".$_ip, "HTTP_X_FORWARDED_FOR: ".$_ip))));

unset($_paypal_ipn_server_ip, $_ip);
/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
function trim_deep($value = FALSE)
	{
		return is_array($value) ? array_map("trim_deep", $value) : trim((string)$value);
	}
function stripslashes_deep($value = FALSE)
	{
		return is_array($value) ? array_map("stripslashes_deep", $value) : stripslashes((string)$value);
	}
function curlpsr($url = FALSE, $post_vars = array(), $max_con_secs = 20, $max_stream_secs = 20, $headers = array())
	{
		if(($url = trim($url)) && ($curl = curl_init()))
			{
				if /* Because cURL can't deal with complex arrays. */(is_array($post_vars))
					$post_vars = http_build_query($post_vars);
				$follow = (!ini_get("safe_mode") && !ini_get("open_basedir"));
				curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $post_vars, CURLOPT_FOLLOWLOCATION => $follow, CURLOPT_MAXREDIRS => (($follow) ? 5 : 0), CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
				$o = trim(curl_exec($curl));
				curl_close($curl);
			}
		return (!empty($o)) ? $o : false;
	}
?>

I have setup the return url on WSO Plus to – http://www.masterytutorials.com/?s2member_paypal_return=1 (i.e. the url the user is returned to after the purchase)

Now when I tested the above with a transaction. The payment is successful, I have checked the paypal ipn history, an IPN is sent to http://www.warriorplus.com/ipn.php, the same is being forwarded to http://www.masterytutorials.com/warriorplus_ipn.php where the above code is being executed.

After successful payment I am sent back to the Warrior Plus Thank You Page, which now points to http://www.masterytutorials.com/?s2member_paypal_return=1

When the user clicks on this link and comes to this page S2 Member gives a message:

“[ http://www.masterytutorials.com ] says…
Thank you! ( you MUST check your email before proceeding ).

* Note: It can take ( up to 15 minutes ) for Email Confirmation with important details. If you don’t receive email confirmation in the next 15 minutes, please contact Support.
Back To Home Page”

Which probably means its not received the IPN.

Please point in the above steps if I have done something in-correctly.

Thanks and Best Regards,
Santosh

List Of Topic Replies

Viewing 11 replies - 1 through 11 (of 11 total)
Author Replies
Author Replies
Posted: Saturday Aug 11th, 2012 at 7:13 am #21762

Hi Santosh.

I’m not familiar with the WSO integration, but I’ll try to help.

First: could you make sure you have logging enabled? And could you share your log entries for the test transaction? (x’ing out any private info.) [hilite path]Dashboard -› s2Member® -› PayPal® Options -› Account Details -› Logging[/hilite]

Thanks!

Posted: Sunday Aug 12th, 2012 at 5:59 am #21814

Hello Cristian,

Thanks for the support.

Please below the paypal-ipn.log and the paypal-rtn.log

Paypal-IPN.log



PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 43.02 MB :: Real Memory 43.25 MB :: Peak Memory 43.10 MB :: Real Peak Memory 43.25 MB
www.masterytutorials.com/?s2member_paypal_notify=1
User-Agent: 
array (
 's2member_log' => 
 array (
   0 => 'Unable to verify $_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.',
   1 => 'If you\'re absolutely SURE that your configuration is valid, you may want to run some tests on your server, just to be sure $_POST variables are populated, and that your server is able to connect/communicate with your Payment Gateway over an HTTPS connection.',
   2 => 's2Member uses the `WP_Http` class for remote connections; which will try to use `cURL` first, and then fall back on the `FOPEN` method when `cURL` is not available. On a Windows® server, you may have to disable your `cURL` extension; and instead, set `allow_url_fopen = yes` in your php.ini file. The `cURL` extension (usually) does NOT support SSL connections on a Windows® server.',
   3 => 'Please see this thread: `http://www.s2member.com/forums/topic/ideal-server-configuration-for-s2member/` for details regarding the ideal server configuration for s2Member.',
   4 => 'array (
 \'s2member_paypal_notify\' => \'1\',
 \'mc_gross\' => \'1.00\',
 \'invoice\' => \'5392880\',
 \'protection_eligibility\' => \'Ineligible\',
 \'payer_id\' => \'JZJE3GFFKQ7RS\',
 \'tax\' => \'0.00\',
 \'payment_date\' => \'02:50:20 Aug 12, 2012 PDT\',
 \'payment_status\' => \'Completed\',
 \'charset\' => \'windows-1252\',
 \'first_name\' => \'sudhir\',
 \'mc_fee\' => \'0.34\',
 \'notify_version\' => \'3.6\',
 \'custom\' => \'www.masterytutorials.com\',
 \'payer_status\' => \'verified\',
 \'business\' => \'abc@infinityonlinesolutions.com\',
 \'quantity\' => \'1\',
 \'verify_sign\' => \'Aani8wJF2FZAfiDSiSoZb3nFQRCLAT7r7lkrFOLmTw.lQjnWg6rvwQ80\',
 \'payer_email\' => \'xyz@gmail.com\',
 \'txn_id\' => \'1HF71752007096138\',
 \'payment_type\' => \'instant\',
 \'last_name\' => \'krishnan\',
 \'receiver_email\' => \'abc@infinityonlinesolutions.com\',
 \'payment_fee\' => \'0.34\',
 \'receiver_id\' => \'CSLAJAGCH2RJS\',
 \'txn_type\' => \'web_accept\',
 \'item_name\' => \'Quality Wordpress Websites - Video Tutorials Course\',
 \'mc_currency\' => \'USD\',
 \'item_number\' => \'1\',
 \'residence_country\' => \'US\',
 \'handling_amount\' => \'0.00\',
 \'transaction_subject\' => \'Quality Wordpress Websites - Video Tutorials Course\',
 \'payment_gross\' => \'1.00\',
 \'shipping\' => \'0.00\',
 \'ipn_track_id\' => \'704dbc7c87258\',
 \'saleid\' => \'2699611\',
)',
 ),
)

PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 43.02 MB :: Real Memory 43.25 MB :: Peak Memory 43.10 MB :: Real Peak Memory 43.50 MB
www.masterytutorials.com/?s2member_paypal_notify=1
User-Agent: 
array (
 's2member_log' => 
 array (
   0 => 'Unable to verify $_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.',
   1 => 'If you\'re absolutely SURE that your configuration is valid, you may want to run some tests on your server, just to be sure $_POST variables are populated, and that your server is able to connect/communicate with your Payment Gateway over an HTTPS connection.',
   2 => 's2Member uses the `WP_Http` class for remote connections; which will try to use `cURL` first, and then fall back on the `FOPEN` method when `cURL` is not available. On a Windows® server, you may have to disable your `cURL` extension; and instead, set `allow_url_fopen = yes` in your php.ini file. The `cURL` extension (usually) does NOT support SSL connections on a Windows® server.',
   3 => 'Please see this thread: `http://www.s2member.com/forums/topic/ideal-server-configuration-for-s2member/` for details regarding the ideal server configuration for s2Member.',
   4 => 'array (
 \'s2member_paypal_notify\' => \'1\',
 \'mc_gross\' => \'1.00\',
 \'invoice\' => \'5392880\',
 \'protection_eligibility\' => \'Ineligible\',
 \'payer_id\' => \'JZJE3GFFKQ7RS\',
 \'tax\' => \'0.00\',
 \'payment_date\' => \'02:50:20 Aug 12, 2012 PDT\',
 \'payment_status\' => \'Completed\',
 \'charset\' => \'windows-1252\',
 \'first_name\' => \'sudhir\',
 \'mc_fee\' => \'0.34\',
 \'notify_version\' => \'3.6\',
 \'custom\' => \'www.masterytutorials.com\',
 \'payer_status\' => \'verified\',
 \'business\' => \'abc@infinityonlinesolutions.com\',
 \'quantity\' => \'1\',
 \'verify_sign\' => \'Aani8wJF2FZAfiDSiSoZb3nFQRCLAT7r7lkrFOLmTw.lQjnWg6rvwQ80\',
 \'payer_email\' => \'xyz@gmail.com\',
 \'txn_id\' => \'1HF71752007096138\',
 \'payment_type\' => \'instant\',
 \'last_name\' => \'krishnan\',
 \'receiver_email\' => \'abc@infinityonlinesolutions.com\',
 \'payment_fee\' => \'0.34\',
 \'receiver_id\' => \'CSLAJAGCH2RJS\',
 \'txn_type\' => \'web_accept\',
 \'item_name\' => \'Quality Wordpress Websites - Video Tutorials Course\',
 \'mc_currency\' => \'USD\',
 \'item_number\' => \'1\',
 \'residence_country\' => \'US\',
 \'handling_amount\' => \'0.00\',
 \'transaction_subject\' => \'Quality Wordpress Websites - Video Tutorials Course\',
 \'payment_gross\' => \'1.00\',
 \'shipping\' => \'0.00\',
 \'ipn_track_id\' => \'704dbc7c87258\',
)',
 ),
)

Paypal-rtn.log

PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 39.99 MB :: Real Memory 40.25 MB :: Peak Memory 40.16 MB :: Real Peak Memory 40.25 MB
www.masterytutorials.com/?s2member_paypal_return=1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1 AlexaToolbar/alxf-2.15
array (
  'subscr_gateway' => 'paypal',
  's2member_log' => 
  array (
    0 => 'No Return-Data. Customer must wait for Email Confirmation.',
    1 => 'Redirecting Customer to the Home Page. Customer must wait for Email Confirmation.',
    2 => 'Note. This can sometimes happen when/if you are offering a free Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only ( i.e. behind-the-scene ), and the Customer must wait for Email Confirmation in these cases.',
    3 => 'array (
  \'s2member_paypal_return\' => \'1\',
)',
  ),
)

Thanks, Best Regards,
Santosh

Posted: Monday Aug 13th, 2012 at 8:04 pm #21929

I see this in the first log:

[hilite pre_code]
0 => 'Unable to verify $_POST vars. This is most likely related to an invalid configuration of s2Member, or a problem with server compatibility.',
[/hilite]

And this in the second one:

[hilite pre_code]
0 => 'No Return-Data. Customer must wait for Email Confirmation.',
[/hilite]

You seem to be losing the POST vars somewhere along the way, s2Member isn’t getting them.

Just in case it’s a server thing, could you try this script, please? http://www.s2member.com/r/server-check-tool/

Are you using the IPN script in the same site WordPress is installed in?

Posted: Friday Aug 17th, 2012 at 4:28 am #22304

Hi Chrisitan,

To check if I am receiving things fine at the server side, I changed the notification url to the standard S2 MEmber paypal notification i.e. http://www.wpskillset.com/?s2member_paypal_notify=1

After doing so, I checked the log again, I can see that the Post is fine, but unable to verify Server. Overall it looks like somethings not right in the conversion file to convert the message to S2Member required format.

Paypal_ipn.log

PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 44.79 MB :: Real Memory 45.00 MB :: Peak Memory 44.86 MB :: Real Peak Memory 45.00 MB
www.wpskillset.com/?s2member_paypal_notify=1
User-Agent: 
array (
  'mc_gross' => '1.00',
  'invoice' => '5421999',
  'protection_eligibility' => 'Ineligible',
  'payer_id' => 'JZJE3GFFKQ7RS',
  'tax' => '0.00',
  'payment_date' => '01:05:03 Aug 17, 2012 PDT',
  'payment_status' => 'Completed',
  'charset' => 'windows-1252',
  'first_name' => 'sudhir',
  'mc_fee' => '0.34',
  'notify_version' => '3.6',
  'custom' => '',
  'payer_status' => 'verified',
  'business' => '111@222.com',
  'quantity' => '1',
  'verify_sign' => 'AJ8AOnKio3Pt0.vQM31eNl-CpUrlA5xWtq2FATYdippjkz0cruqjq7w1',
  'payer_email' => 'sudhir2krishnan@gmail.com',
  'txn_id' => '76681356UX670160S',
  'payment_type' => 'instant',
  'last_name' => 'krishnan',
  'receiver_email' => '111@111.com',
  'payment_fee' => '0.34',
  'receiver_id' => 'CSLAJAGCH2RJS',
  'txn_type' => 'web_accept',
  'item_name' => 'Quality Wordpress Websites - Video Tutorials Course',
  'mc_currency' => 'USD',
  'item_number' => 'wso_mrchh5_5421999',
  'residence_country' => 'US',
  'handling_amount' => '0.00',
  'transaction_subject' => 'Quality Wordpress Websites - Video Tutorials Course',
  'payment_gross' => '1.00',
  'shipping' => '0.00',
  'ipn_track_id' => 'db80807d6d8a2',
  's2member_log' => 
  array (
    0 => 'IPN received on: Fri Aug 17, 2012 8:05:11 am 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.',
  ),
  'subscr_gateway' => 'paypal',
)

paypal_rtn.log

PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 41.76 MB :: Real Memory 42.00 MB :: Peak Memory 41.93 MB :: Real Peak Memory 42.00 MB
www.wpskillset.com/?s2member_paypal_return=1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1 AlexaToolbar/alxf-2.15
array (
  'subscr_gateway' => 'paypal',
  's2member_log' => 
  array (
    0 => 'No Return-Data. Customer must wait for Email Confirmation.',
    1 => 'Redirecting Customer to the Home Page. Customer must wait for Email Confirmation.',
    2 => 'Note. This can sometimes happen when/if you are offering a free Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only ( i.e. behind-the-scene ), and the Customer must wait for Email Confirmation in these cases.',
    3 => 'array (
  \'s2member_paypal_return\' => \'1\',
)',
  ),
)

The Ipn script I am using is on the same server, in the root folder. Warrior_Ipn.php, the same is pasted below.

<?php
/*
---- Configuration. -------------------------------------------------------------------------------------------------------*/

/* s2Member installation domain. */
$config["custom"] = "www.wpskillset.com";

/* s2Member Membership Level# */
$config["item_number"] = "1";

/* s2Member Proxy IPN URL handler. - You'll get this from Dashboard: `s2Member -> PayPal Options -> IPN Integration -> Proxy IPN URL`. */
$config["proxy_ipn_handler_url"] = "http://www.wpskillset.com/?s2member_paypal_notify=1";

/* Or use "http://www.wpskillset.com/?s2member_paypal_notify=1&s2member_paypal_proxy=proxy&s2member_paypal_proxy_verification=12b122ba5812a0fcdfb1a1613727464d";  */

/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
@ignore_user_abort(true);
header("HTTP/1.0 200 OK");
header("Content-Type: text/plain; charset=utf-8");
eval /* Clean buffers. */('while (@ob_end_clean ());');

if( /* No ``$_POST`` vars? */empty($_POST) || !is_array($_POST))
	exit /* Exit now. There is nothing to process. */();
	
$_p = (get_magic_quotes_gpc()) ? stripslashes_deep($_POST) : $_POST;
$_p = trim_deep /* Now trim this array deeply. */($_p);

$_paypal_ipn_server_ip = $_ip = /* Forge IP address to match the PayPal® IPN server here. */ "216.113.188.202";
/* See list of IPs here: <https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_golivechecklist>. */

$_p["custom"] = $config["custom"]; $_p["item_number"] = $config["item_number"];
echo (trim(curlpsr($config["proxy_ipn_handler_url"], http_build_query($_p, null, "&"), 20, 20, array("REMOTE_ADDR: ".$_ip, "HTTP_X_FORWARDED_FOR: ".$_ip))));

unset($_paypal_ipn_server_ip, $_ip);
/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
function trim_deep($value = FALSE)
	{
		return is_array($value) ? array_map("trim_deep", $value) : trim((string)$value);
	}
function stripslashes_deep($value = FALSE)
	{
		return is_array($value) ? array_map("stripslashes_deep", $value) : stripslashes((string)$value);
	}
function curlpsr($url = FALSE, $post_vars = array(), $max_con_secs = 20, $max_stream_secs = 20, $headers = array())
	{
		if(($url = trim($url)) && ($curl = curl_init()))
			{
				if /* Because cURL can't deal with complex arrays. */(is_array($post_vars))
					$post_vars = http_build_query($post_vars);
				$follow = (!ini_get("safe_mode") && !ini_get("open_basedir"));
				curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $post_vars, CURLOPT_FOLLOWLOCATION => $follow, CURLOPT_MAXREDIRS => (($follow) ? 5 : 0), CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
				$o = trim(curl_exec($curl));
				curl_close($curl);
			}
		return (!empty($o)) ? $o : false;
	}
?>

I am unable to use the server check tool, can you please provide some instructions on how to use the same?

Thanks, Best Regards,
Santosh

Posted: Saturday Aug 18th, 2012 at 6:50 am #22422

I am unable to use the server check tool, can you please provide some instructions on how to use the same?

Sure: just upload the PHP file to the directory where you have WordPress and the load it in your browser. For example: http://www.wpskillset.com/server-check-tool.php

Posted: Tuesday Aug 21st, 2012 at 10:42 am #22655

Hello Crisitan,

Following is the copy paste of the server check tool (all the tests passed):

———————————————————————————
Server Scan By: s2Member®
Test Email Functionality?
No issues. Your server configuration looks great!
Pass[PASS] PHP Version
You are currently running PHP 5.2.17. Minimum required version is: 5.2
Pass[PASS] WordPress® Version
You are currently running WordPress® 3.4.1. Minimum required version is: 3.2
Pass[PASS] Multibyte String Extension
The mbstring extension is installed. Your server supports UTF-8 character conversion.
Pass[PASS] ZLib Extension (GZIP)
The zlib extension is installed. Your server supports GZIP compression.
Pass[PASS] Default Hash Extension
The Hash extension is installed. Comes with every installation of PHP. Your server supports message digests.
Pass[PASS] Default XML Parser Extension
The XML Parser extension is installed. Comes with every installation of PHP. Your server supports XML parsing.
Pass[PASS] Default libXML Extension
The libXML extension is installed. Comes with every installation of PHP. Your server supports this important dependency.
Pass[PASS] Default Simple XML Extension
The Simple XML extension is installed. Comes with every installation of PHP. Your server can convert XML into PHP objects.
Pass[PASS] Default XML Reader Extension
The XML Reader extension is installed. Comes with every installation of PHP. Your server has the ability to read XML documents.
Pass[PASS] Default XML Writer Extension
The XML Writer extension is installed. Comes with every installation of PHP. Your server has the ability to write XML documents.
Pass[PASS] Default DOM Extension
The DOM extension is installed. Comes with every installation of PHP. Your server supports XML document traversal.
Pass[PASS] Default Sessions Extension
The Sessions extension is installed. Comes with every installation of PHP. Your server allows read/write access to session data.
Pass[PASS] MySQL Database Extension
The MySQL extension is installed. Your server supports MySQL database communication.
Pass[PASS] Mcrypt/Encryption Extension
The Mcrypt extension is installed. Your server supports advanced data encryption.
Pass[PASS] Default JSON Extension
The JSON extension is installed. Comes with every installation of PHP. Your server supports JavaScript object notation.
Pass[PASS] GD Image Extension (JPEG/PNG/FreeType)
The GD Image extension is installed. Your server supports dynamic image creation.
Pass[PASS] Default Fileinfo Extension
The Fileinfo extension is installed. Comes with every installation of PHP 5.3+. Your server supports MIME type detection.
Pass[PASS] Default Ctype Extension
The Ctype extension is installed. Comes with every installation of PHP. Your server supports character class detection.
Pass[PASS] PHP eval() Function
The eval() function is available.
Pass[PASS] PHP ini_get() Function
The ini_get() function is available.
Pass[PASS] cURL Extension With SSL Support
The cURL extension for remote communication via PHP is available (and the OpenSSL extension for PHP is enabled).
Pass[PASS] INI fopen() URL With SSL Support
The setting allow_url_fopen is on in your php.ini file (and the OpenSSL extension for PHP is enabled).
Pass[PASS] OpenSSL Extension With openssl_sign()
The OpenSSL extension is installed, and PHP function openssl_sign() is available.
Pass[PASS] Temporary Files Directory
A readable/writable temporary files directory was found here: /tmp
Pass[PASS] $_SERVER[‘DOCUMENT_ROOT’]
Your server reports this value: /home/wpskills/public_html
Pass[PASS] $_SERVER[‘HTTP_HOST’]
Your server reports this value: http://www.wpskillset.com
Pass[PASS] $_SERVER[‘REQUEST_URI’]
Your server reports this value: /s2member-server-check.php
Pass[PASS] $_SERVER[‘REMOTE_ADDR’]
Your server reports this value: 59.163.21.131
Pass[PASS] $_SERVER[‘HTTP_USER_AGENT’]
Your server reports this value: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1 AlexaToolbar/alxf-2.15
Pass[PASS] $_SERVER[‘SERVER_ADDR’]
Your server reports this value: 174.121.162.130
Pass[PASS] WordPress® Memory Limit
Your WordPress® memory limit (WP_MEMORY_LIMIT in /wp-config.php, or by default), is set to: 96M
Pass[PASS] WordPress® MAX Memory Limit
Your WordPress® MAX memory limit (WP_MAX_MEMORY_LIMIT in /wp-config.php, or by default), is set to: 256M
Pass[PASS] WordPress® External HTTP Requests
Your WordPress® External HTTP Requests (WP_HTTP_BLOCK_EXTERNAL in /wp-config.php, or by default), is set to: FALSE
Pass[PASS] WordPress® DB Charset
Your WordPress® database charset (DB_CHARSET in /wp-config.php, or by default), is set to: utf8
Pass[PASS] WordPress® DB Collation
Your WordPress® database collation (DB_COLLATE in /wp-config.php, or by default), is set to: an empty string
Pass[PASS] WordPress® Character Encoding
Your WordPress® installation is operating with UTF-8 encoding, under: WordPress -› Settings -› Reading -› Encoding.
Pass[PASS] WordPress® Home URL
Your WordPress® home URL is configured to run on: http://www.wpskillset.com, and that matches the current host name: http://www.wpskillset.com
Pass[PASS] WordPress Site URL
Your WordPress® site URL is configured to run on: http://www.wpskillset.com, and that matches the current host name: http://www.wpskillset.com
Pass[PASS] WordPress® Debugging Mode
Your WordPress® installation is NOT running in debugging mode (WP_DEBUG in /wp-config.php, or by default), is NOT set to TRUE.
———————————————————————————

Posted: Wednesday Aug 22nd, 2012 at 8:23 am #22729

I see. Then you seem to be losing the POST vars somewhere in your IPN script. You’d need to study your code to find where it may be happening.

I emailed Jason asking him about it.

Posted: Thursday Aug 23rd, 2012 at 8:21 am #22850

Hi Critistian,

Thanks for the support, ya it would be great if Jason could help!!!

Also if you provide me with a good sample message that S2 member expects the IPN to be in, I could look into the IPN script and try to make any changes required to get it to work.

Best Regards,
Santosh

Posted: Monday Aug 27th, 2012 at 7:07 pm #23214
Staff Member

Thanks for the heads up on this thread.

Regarding this log entry you posted earlier…

This log entry is missing the custom variable, which s2Member expects (i.e. requires) that it start with the installation domain name. This IPN would pass fine, if custom were set to:

custom=www.wpskillset.com

Also, the item_number MUST match up with an s2Member Membership Level #.

item_number=1 (indicating the IPN is granting access to Membership Level #1).

Other than those two variables, everything else is fine. s2Member only requires special attention to these two variables, as everything else processed by s2Member follows the PayPal Standard IPN variables strictly.

PHP v5.2.17 :: WordPress® v3.4.1 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 44.79 MB :: Real Memory 45.00 MB :: Peak Memory 44.86 MB :: Real Peak Memory 45.00 MB
www.wpskillset.com/?s2member_paypal_notify=1
User-Agent: 
array (
  'mc_gross' => '1.00',
  'invoice' => '5421999',
  'protection_eligibility' => 'Ineligible',
  'payer_id' => 'JZJE3GFFKQ7RS',
  'tax' => '0.00',
  'payment_date' => '01:05:03 Aug 17, 2012 PDT',
  'payment_status' => 'Completed',
  'charset' => 'windows-1252',
  'first_name' => 'sudhir',
  'mc_fee' => '0.34',
  'notify_version' => '3.6',
  'custom' => '',
  'payer_status' => 'verified',
  'business' => '111@222.com',
  'quantity' => '1',
  'verify_sign' => 'AJ8AOnKio3Pt0.vQM31eNl-CpUrlA5xWtq2FATYdippjkz0cruqjq7w1',
  'payer_email' => 'sudhir2krishnan@gmail.com',
  'txn_id' => '76681356UX670160S',
  'payment_type' => 'instant',
  'last_name' => 'krishnan',
  'receiver_email' => '111@111.com',
  'payment_fee' => '0.34',
  'receiver_id' => 'CSLAJAGCH2RJS',
  'txn_type' => 'web_accept',
  'item_name' => 'Quality Wordpress Websites - Video Tutorials Course',
  'mc_currency' => 'USD',
  'item_number' => 'wso_mrchh5_5421999',
  'residence_country' => 'US',
  'handling_amount' => '0.00',
  'transaction_subject' => 'Quality Wordpress Websites - Video Tutorials Course',
  'payment_gross' => '1.00',
  'shipping' => '0.00',
  'ipn_track_id' => 'db80807d6d8a2',
  's2member_log' => 
  array (
    0 => 'IPN received on: Fri Aug 17, 2012 8:05:11 am 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.',
  ),
  'subscr_gateway' => 'paypal',
)
Posted: Monday Aug 27th, 2012 at 7:14 pm #23216
Staff Member

Posted: Tuesday Aug 28th, 2012 at 4:47 pm #23344
Staff Member

Cristian brought to my attention…

You posted this script, which is a hack that we posted some time ago, but should still work as expected.

<?php
/*
---- Configuration. -------------------------------------------------------------------------------------------------------*/

/* s2Member installation domain. */
$config&#91;"custom"&#93; = "www.wpskillset.com";

/* s2Member Membership Level# */
$config&#91;"item_number"&#93; = "1";

/* s2Member Proxy IPN URL handler. - You'll get this from Dashboard: `s2Member -> PayPal Options -> IPN Integration -> Proxy IPN URL`. */
$config["proxy_ipn_handler_url"] = "http://www.wpskillset.com/?s2member_paypal_notify=1";

/* Or use "http://www.wpskillset.com/?s2member_paypal_notify=1&s2member_paypal_proxy=proxy&s2member_paypal_proxy_verification=12b122ba5812a0fcdfb1a1613727464d";  */

/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
@ignore_user_abort(true);
header("HTTP/1.0 200 OK");
header("Content-Type: text/plain; charset=utf-8");
eval /* Clean buffers. */('while (@ob_end_clean ());');

if( /* No ``$_POST`` vars? */empty($_POST) || !is_array($_POST))
	exit /* Exit now. There is nothing to process. */();
	
$_p = (get_magic_quotes_gpc()) ? stripslashes_deep($_POST) : $_POST;
$_p = trim_deep /* Now trim this array deeply. */($_p);

$_paypal_ipn_server_ip = $_ip = /* Forge IP address to match the PayPal® IPN server here. */ "216.113.188.202";
/* See list of IPs here: <https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_golivechecklist>. */

$_p["custom"] = $config["custom"]; $_p["item_number"] = $config["item_number"];
echo (trim(curlpsr($config["proxy_ipn_handler_url"], http_build_query($_p, null, "&"), 20, 20, array("REMOTE_ADDR: ".$_ip, "HTTP_X_FORWARDED_FOR: ".$_ip))));

unset($_paypal_ipn_server_ip, $_ip);
/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
function trim_deep($value = FALSE)
	{
		return is_array($value) ? array_map("trim_deep", $value) : trim((string)$value);
	}
function stripslashes_deep($value = FALSE)
	{
		return is_array($value) ? array_map("stripslashes_deep", $value) : stripslashes((string)$value);
	}
function curlpsr($url = FALSE, $post_vars = array(), $max_con_secs = 20, $max_stream_secs = 20, $headers = array())
	{
		if(($url = trim($url)) && ($curl = curl_init()))
			{
				if /* Because cURL can't deal with complex arrays. */(is_array($post_vars))
					$post_vars = http_build_query($post_vars);
				$follow = (!ini_get("safe_mode") && !ini_get("open_basedir"));
				curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $post_vars, CURLOPT_FOLLOWLOCATION => $follow, CURLOPT_MAXREDIRS => (($follow) ? 5 : 0), CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
				$o = trim(curl_exec($curl));
				curl_close($curl);
			}
		return (!empty($o)) ? $o : false;
	}
?>

In this script/hack, the custom and item_number variables are set explicitly, as seen in this portion of the code:

$_p["custom"] = $config["custom"]; $_p["item_number"] = $config["item_number"];

Since the custom and item_number variables are NOT being filled in however (according to your log files), I suspect one of the following is happening.

1. Your PayPal account is NOT actually processing IPNs through this script, and instead it’s processing them directly, or through another central IPN processing script somewhere?

2. You’ve made some modifications to the above script?

If problems persist, I recommend that you attach a logging routine to this script, so you/we can see the results. Here is the full code you posted above, with an extra line of code that logs the full set of POST data being processed.

<?php
/*
---- Configuration. -------------------------------------------------------------------------------------------------------*/

/* s2Member installation domain. */
$config&#91;"custom"&#93; = "www.wpskillset.com";

/* s2Member Membership Level# */
$config&#91;"item_number"&#93; = "1";

/* s2Member Proxy IPN URL handler. - You'll get this from Dashboard: `s2Member -> PayPal Options -> IPN Integration -> Proxy IPN URL`. */
$config["proxy_ipn_handler_url"] = "http://www.wpskillset.com/?s2member_paypal_notify=1";

/* Or use "http://www.wpskillset.com/?s2member_paypal_notify=1&s2member_paypal_proxy=proxy&s2member_paypal_proxy_verification=12b122ba5812a0fcdfb1a1613727464d";  */

/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
@ignore_user_abort(true);
header("HTTP/1.0 200 OK");
header("Content-Type: text/plain; charset=utf-8");
eval /* Clean buffers. */('while (@ob_end_clean ());');

if( /* No ``$_POST`` vars? */empty($_POST) || !is_array($_POST))
	exit /* Exit now. There is nothing to process. */();
	
$_p = (get_magic_quotes_gpc()) ? stripslashes_deep($_POST) : $_POST;
$_p = trim_deep /* Now trim this array deeply. */($_p);

$_paypal_ipn_server_ip = $_ip = /* Forge IP address to match the PayPal® IPN server here. */ "216.113.188.202";
/* See list of IPs here: <https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_golivechecklist>. */

$_p["custom"] = $config["custom"]; $_p["item_number"] = $config["item_number"];
file_put_contents(dirname(__FILE__)."/paypal-proxy-ipn.log", var_export($_p, TRUE)."\n\n", FILE_APPEND);
echo (trim(curlpsr($config["proxy_ipn_handler_url"], http_build_query($_p, null, "&"), 20, 20, array("REMOTE_ADDR: ".$_ip, "HTTP_X_FORWARDED_FOR: ".$_ip))));

unset($_paypal_ipn_server_ip, $_ip);
/*
---- Do NOT edit anything below, unless you know what you're doing. --------------------------------------------------------*/
function trim_deep($value = FALSE)
	{
		return is_array($value) ? array_map("trim_deep", $value) : trim((string)$value);
	}
function stripslashes_deep($value = FALSE)
	{
		return is_array($value) ? array_map("stripslashes_deep", $value) : stripslashes((string)$value);
	}
function curlpsr($url = FALSE, $post_vars = array(), $max_con_secs = 20, $max_stream_secs = 20, $headers = array())
	{
		if(($url = trim($url)) && ($curl = curl_init()))
			{
				if /* Because cURL can't deal with complex arrays. */(is_array($post_vars))
					$post_vars = http_build_query($post_vars);
				$follow = (!ini_get("safe_mode") && !ini_get("open_basedir"));
				curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_CONNECTTIMEOUT => $max_con_secs, CURLOPT_TIMEOUT => $max_stream_secs, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $post_vars, CURLOPT_FOLLOWLOCATION => $follow, CURLOPT_MAXREDIRS => (($follow) ? 5 : 0), CURLOPT_ENCODING => "", CURLOPT_VERBOSE => false, CURLOPT_FAILONERROR => true, CURLOPT_FORBID_REUSE => true, CURLOPT_SSL_VERIFYPEER => false));
				$o = trim(curl_exec($curl));
				curl_close($curl);
			}
		return (!empty($o)) ? $o : false;
	}
?>

The line that handles logging, is as follows:

file_put_contents(dirname(__FILE__)."/paypal-proxy-ipn.log", var_export($_p, TRUE)."\n\n", FILE_APPEND);

So you’ll want to monitor this file in the same directory: paypal-proxy-ipn.log

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