Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-05T21:55:12-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=2938 2011-06-05T21:55:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=20133#p20133 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Statistics: Posted by johnleblanc — June 5th, 2011, 9:55 pm


]]>
2011-06-05T20:56:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=20115#p20115 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
johnleblanc wrote:
Would it make sense to add an additional Subscription Modification Notifications section within the s2Member API / Notifications settings?


A new Modification Notification is now available.
http://wordpress.org/extend/plugins/s2member/changelog/
From the Changelog for s2Member v110605+ ( available now )
(s2Member). New API Notification. New "Modification" Notification now available under: s2Member -> API Notifications. Say that three times fast!

SNAG-0033.png

Statistics: Posted by Jason Caldwell — June 5th, 2011, 8:56 pm


]]>
2011-04-07T08:43:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9269#p9269 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Thanks for reporting back John.

Yes, s2Member will honor the location of WP_CONTENT_DIR, and others.

Sorry, I'm not seeing anything in your implementation that would prevent your Hook from firing. Your Hook is attached to a core WordPress function that is called upon by s2Member in it's upgrade/downgrade routine. Perhaps it will help if I point you to the specific section of s2Member's code that calls upon this routine. Please see: /s2member/includes/classes/paypal-notify-in.inc.php @ line# 419
Code:
$user->set_role ("s2member_level" . $paypal["level"]); /* (upgrade/downgrade) */ 
* The call to set_role(), results in the `set_user_role` Hook being fired by WordPress®.
Code:
    function set_role( $role ) {
        foreach ( (array) $this->roles as $oldrole )
            unset( $this->caps[$oldrole] );

        if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
            return;

        if ( !empty( $role ) ) {
            $this->caps[$role] = true;
            $this->roles = array( $role => true );
        } else {
            $this->roles = false;
        }
        update_user_meta( $this->ID, $this->cap_key, $this->caps );
        $this->get_role_caps();
        $this->update_user_level_from_caps();
        do_action( 'set_user_role', $this->ID, $role );
    } 

Statistics: Posted by Jason Caldwell — April 7th, 2011, 8:43 am


]]>
2011-04-04T18:47:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9077#p9077 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
Code:
add_action('set_user_role', 'my_role_change_handler', 1, 2);
function my_role_change_handler($user_id, $new_role) {
    if ( function_exists('my_rpc_function') ) {
        my_rpc_function($user_id);
    } else {
        wp_mail( 'john@xxxxx.com', 's2hacks', 'my_rpc_function not available');
    }
}

I should mention that I override WP_CONTENT_DIR, WP_CONTENT_URL, WP_PLUGIN_DIR, WP_PLUGIN_URL and PLUGINDIR within wp-config.php in case s2member is specifically searching within "wp-content" instead of honoring the constants.

Statistics: Posted by johnleblanc — April 4th, 2011, 6:47 pm


]]>
2011-04-04T03:45:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9023#p9023 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> How is your Hook function attached exactly?

Some of s2Member's processing occurs through internal proxy requests that occur in other script instances ( i.e. child processes spawned by a parent process ). Also, if your Hook is too late, WordPress could exit before it's ever attached. Try it like this.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
* Notice here that I'm setting priority to 1.
Code:
<?php
add_action
("set_user_role", "my_role_change_handler", 1, 2);
function my_role_change_handler($user_id, $new_role){
    if($new_role === "s2member_level1")
        { /* Do something here? */ }
    }
}
?>

Reference article: http://codex.wordpress.org/Function_Ref ... add_action

Statistics: Posted by Jason Caldwell — April 4th, 2011, 3:45 am


]]>
2011-04-04T03:27:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9018#p9018 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> set_user_role hook and found that it ran shortly after cancellation from wp-cron.php?doing_wp_cron

I then submitted payment for an upgrade from Level 0 to Level 1 and set_user_role didn't seem to fire at all despite being immediately recognized as Level 1 upon payment.

I got this apparent success in my paypal-ipn.log:
Code:
    0 => 'IPN received on: Mon Apr 4, 2011 7:56:59 am UTC',
    1 => 's2Member POST vars verified with a Proxy Key',
    2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
    3 => 's2Member txn_type identified as (web_accept|subscr_signup).',
    4 => 's2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.',
    5 => 's2Member Level/Capabilities updated w/ advanced update routines.',
    6 => 'Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.',
    7 => 'Storing IPN signup vars now. These are associated with a User\'s account record; for future reference.',

Then got this apparent failure:
Code:
    0 => 'Unable to verify POST vars. Possibly caused by a fraudulent request. If this error continues, please run IPN tests against your server from a PayPal® Sandbox account. They provide special diagnostic tools to assist you.',
    1 => 'If you\'re absolutely SURE that your PayPal® 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 to PayPal® 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. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows® server.',

Perhaps a little break from this issue will provide me some clarity. Perhaps I should also spend more time investigating on my own before burning all of your time on this.

Your dedication is amazing and I'm thankful!

Statistics: Posted by johnleblanc — April 4th, 2011, 3:27 am


]]>
2011-04-04T02:35:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9015#p9015 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> You are VERY welcome.
johnleblanc wrote:
Would it make sense to add an additional Subscription Modification Notifications section within the s2Member API / Notifications settings?

Yes, I think so. We'll take a closer look before any changes are made, but I'm leaning in that direction.


In the meantime, what is a good hook for me to use if I want to trigger a function every time a user level is altered?

There is a Hook native to WordPress, which is good for this,
and it's fired as a result of any changes made by s2Member, or otherwise.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code:
<?php
add_action
("set_user_role", "my_role_change_handler", 10, 2);
function my_role_change_handler($user_id, $new_role){
    if($new_role === "s2member_level1")
         { /* Do something here? */ }
}
?>

Statistics: Posted by Jason Caldwell — April 4th, 2011, 2:35 am


]]>
2011-04-04T02:18:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9013#p9013 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
Would it make sense to add an additional Subscription Modification Notifications section within the s2Member API / Notifications settings?

In the meantime, what is a good hook for me to use if I want to trigger a function every time a user level is altered?

Statistics: Posted by johnleblanc — April 4th, 2011, 2:18 am


]]>
2011-04-04T02:09:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9011#p9011 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Thanks John. OK, I see what's happening now that we've put this all together.

This is related to the creation of Recurring Profiles.

Whenever you create a new PayPal® Recurring Profile, you're actually creating an internal schedule for PayPal to follow. The first payment in this schedule is not actually captured and fully processed by PayPal for up to 24 hours after the Recurring Profile is created ( even in the case of Subscription Modifications ).

So to answer your question. The reason you've not received the Payment Notification yet, is because PayPal has not yet captured/processed the very first payment in the billing cycle. Once they do ( which should be within 24 hours ), they will send s2Member an IPN response with `txn_type=recurring_payment`.

At that time, your script will get the Payment Notification from s2Member.
~ and this should also be recorded inside your /s2member-logs/paypal-ipn.log file.

In the mean time, if you need an immediate API Notification from s2Member, you can use s2Member's Signup Notification, which also includes dollar amounts like Payment Notifications do.

That being said, in the case of a Subscription Modification, a Signup Notification is NOT processed, because the Customer has already signed up in the past ( i.e. they're modifying, not signing up ). I'll see what we can do about this in a future release. I can see where that particular scenario might need improvement with regard to API Notifications.

Please let me know if this helps you.

Statistics: Posted by Jason Caldwell — April 4th, 2011, 2:09 am


]]>
2011-04-04T01:07:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9009#p9009 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
Code:
array (
  'txn_type' => 'subscr_signup',
  'subscr_id' => 'xxxxx',
  'custom' => 'www.xxxxx.com',
  'txn_id' => 'xxxxx',
  'period1' => '0 D',
  'period3' => '1 M',
  'mc_amount1' => '0.00',
  'mc_amount3' => '4.95',
  'mc_gross' => '4.95',
  'mc_currency' => 'USD',
  'tax' => '0.00',
  'recurring' => '4.95',
  'payer_email' => 'xxxxx@xxxxx.com',
  'first_name' => 'John',
  'last_name' => 'LeBlanc',
  'option_name1' => 'Updating Subscr. ID',
  'option_selection1' => '40',
  'item_name' => 'UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
  'item_number' => '1',
  'proxy_verified' => 'paypal',
  's2member_log' =>
  array (
    0 => 'IPN received on: Mon Apr 4, 2011 4:57:18 am UTC',
    1 => 's2Member POST vars verified with a Proxy Key',
    2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
    3 => 's2Member txn_type identified as (web_accept|subscr_signup).',
    4 => 's2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.',
    5 => 's2Member Level/Capabilities updated w/ advanced update routines.',
    6 => 'Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.',
    7 => 'Storing IPN signup vars now. These are associated with a User\'s account record; for future reference.',
  ),
  'subscr_gateway' => 'paypal',
  'eotper' => NULL,
  'ccaps' => NULL,
  'level' => '1',
  'initial_term' => '0 D',
  'initial' => '4.95',
  'regular' => '4.95',
  'regular_term' => '1 M',
  's2member_paypal_proxy' => 'paypal',
  's2member_paypal_proxy_use' => 'pro-emails',
  's2member_paypal_proxy_verification' => 'xxxxx',
)

Statistics: Posted by johnleblanc — April 4th, 2011, 1:07 am


]]>
2011-04-04T00:56:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9007#p9007 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Thank you!

This log entry looks normal.
'txn_type' => 'recurring_payment_profile_created'
is not suppose to trigger any action on the part of s2Member.

There should be other entries in your log file matching the same subscr_id value. Is that correct? If so, please post those. Specifically, you should have one with 'txn_type' => 'subscr_signup'.
If so, please post that one for me.

Statistics: Posted by Jason Caldwell — April 4th, 2011, 12:56 am


]]>
2011-04-04T00:45:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9006#p9006 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
Here's my environment:
WordPress 3.1
Framework WS-P-3.5
s2member 3.5.7
Pro Module 1.5.7
PHP Version 5.2.13
Apache 2.0 (Linux)

Here's the end of my paypal-ipn.log:
Code:
array (
  'payment_cycle' => 'Monthly',
  'txn_type' => 'recurring_payment_profile_created',
  'last_name' => 'LeBlanc',
  'next_payment_date' => '03:00:00 Apr 04, 2011 PDT',
  'residence_country' => 'US',
  'initial_payment_amount' => '0.00',
  'rp_invoice_id' => 'xxxxx',
  'currency_code' => 'USD',
  'time_created' => '21:57:16 Apr 03, 2011 PDT',
  'verify_sign' => 'xxxxx',
  'period_type' => 'Regular',
  'payer_status' => 'unverified',
  'tax' => '0.00',
  'payer_email' => 'xxxxx@xxxxx.com',
  'first_name' => 'John',
  'receiver_email' => 'xxxxx@xxxxx.com',
  'payer_id' => 'xxxxx',
  'product_type' => '1',
  'shipping' => '0.00',
  'amount_per_cycle' => '4.95',
  'profile_status' => 'Active',
  'charset' => 'windows-1252',
  'notify_version' => '3.1',
  'amount' => '4.95',
  'outstanding_balance' => '0.00',
  'recurring_payment_id' => 'xxxxx',
  'product_name' => 'UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
  's2member_log' =>
  array (
    0 => 'IPN received on: Mon Apr 4, 2011 4:57:20 am UTC',
    1 => 's2Member POST vars verified through a POST back to PayPal®.',
    2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
    3 => 's2Member txn_type identified as recurring_payment_profile_created.',
    4 => 'The txn_type does not require any action on the part of s2Member.',
    5 => 's2Member Pro handles this event on-site, with an IPN proxy.',
  ),
  'subscr_gateway' => 'paypal',
  'custom' => 'www.xxxxx.com',
  'item_number' => '1',
  'subscr_id' => 'xxxxx',
  'item_name' => 'UPGRADE TO  PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
)

Signup, cancellation and EOT notifications are working fine. It's only the payment notifications that are not taking place.

Statistics: Posted by johnleblanc — April 4th, 2011, 12:45 am


]]>
2011-04-04T00:28:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=9004#p9004 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Excellent. Thank you, and for the KUDOS as well!

OK. Can you please post the WordPress/s2Member versions that you're running, and if you can post the last few sections of your /paypal-ipn.log file, that would be great too. Feel free to xxxxx out email addresses from your log file entries.

Statistics: Posted by Jason Caldwell — April 4th, 2011, 12:28 am


]]>
2011-04-03T17:33:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=8975#p8975 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]>
Thanks once again for your prompt response. You're diligence is astounding!

I've enabled logging and the messages within paypal-api.log and paypal-ipn.log seem to indicate success. The transaction I'm testing is a Free member (Level 0) upgrade to Level 1 at $4.95 monthly.

Here is the PayPal Pro form shortcode:
Code:
[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)" ps="paypal" cc="USD" ns="1" custom="www.example.com" ta="0" tp="0" tt="D" ra="4.95" rp="1" rt="M" rr="1" modify="1" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" /]


Mahalo!
John

Statistics: Posted by johnleblanc — April 3rd, 2011, 5:33 pm


]]>
2011-04-03T16:03:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=8969#p8969 <![CDATA[Re: Payment Notifications not happening (PayPal Pro Forms)]]> Hi John. Thanks for reporting this important issue.

Let's start by taking a look at your Pro Form Shortcode.
I would also make sure that you have logging enabled under:
s2Member -> PayPal Options -> Account Details

After running a transaction, take a look inside:
/plugins/s2member-logs/paypal-ipn.log

* Are you offering a free trial perhaps?

Statistics: Posted by Jason Caldwell — April 3rd, 2011, 4:03 pm


]]>
2011-04-03T03:28:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2938&p=8929#p8929 <![CDATA[Payment Notifications not happening (PayPal Pro Forms)]]> s2Member API / Notifications -> Payment Notifications section exactly like my s2Member API / Notifications -> Registration Notifications section including the same notification URLs and the same email address within the Send An Email Transaction Log Of This Event section.

Registration Notifications work fine, they fetch the Registration Notification URLs and email a log successfully.

Payment Notifications don't seem to trigger either of those actions. The payment is being successfully processed (VISA credit card via PayPal Pro Form), the user level is updated and the user is receiving the "Your account has been updated" email.

Is this a known issue? If not, what are my steps to debug?

Statistics: Posted by johnleblanc — April 3rd, 2011, 3:28 am


]]>