Page 1 of 1

EOT for Failed Payments?

PostPosted: May 17th, 2011, 12:58 pm
by toddz88
When Paypal sends a "Failed Payments" IPN event (recurring_payment_suspended_due_to_max_failed_payment), what EOT value is set by s2member?

Is it basically immediate / instant / now (the time the ipn is received)?
Or is it calculated somehow (as Cancellations are)?

Re: EOT for Failed Payments?

PostPosted: May 17th, 2011, 1:27 pm
by Cristián Lávaque
I believe that if he's in a trial, the EOT will be set at the end of it, and if he had paid access then the auto-EOT behavior applies immediately. But that's what I believe, I'll ask Jason to confirm this to be sure.

Re: EOT for Failed Payments?

PostPosted: May 18th, 2011, 6:58 pm
by Jason Caldwell
Thanks for the great question.
s2Member considers this an immediate EOT.
No EOT Time is set. Instead, s2Member demotes and/or deletes ( based on your configuration ), immediately in this scenario, txn_type=recurring_payment_suspended_due_to_max_failed_payment

Re: EOT for Failed Payments?

PostPosted: May 18th, 2011, 7:14 pm
by Cristián Lávaque
Thanks for confirming it.

Re: EOT for Failed Payments?

PostPosted: May 19th, 2011, 6:27 pm
by toddz88
So if Failed Payments do not actually set an EOT value, will it still trigger the s2m api "EOT/Deletion Notification", even if my s2m setting for Auto-EOT Behavior is "DEMOTE", rather than Delete? Should i read it as "EOT/Deletion/Demotion Notification" ?

Just want to clarify since the documentation under "EOT/Deletion Notification" does not explicitly mention Failed Payments, and does suggest that an EOT "is triggered" for these situations where we'd want to immediately deny the member access to the site:
An EOT is triggered immediately when you refund a Customer, when a Customer forces a chargeback to occur, or when a paid Subscription ends naturally ( i.e. expires ), and your Payment Gateway sends s2Member an EOT ( End Of Term ) response.

Re: EOT for Failed Payments?

PostPosted: May 20th, 2011, 2:12 am
by toddz88
I just noticed the list of possible values for the %%eot_del_type%% Replacement Code (shown in the documentation under API / Notifications > EOT/Deletion Notification):
user-removal-deletion ( i.e. manual removal/deletion )
auto-eot-cancellation-expiration-demotion
auto-eot-cancellation-expiration-deletion
ipn-cancellation-expiration-demotion
ipn-cancellation-expiration-deletion
ipn-refund-reversal-demotion
ipn-refund-reversal-deletion


But.. i'm still not clear which is used for Failed Payments (the IPN event "recurring_payment_suspended_due_to_max_failed_payment").

Re: EOT for Failed Payments?

PostPosted: May 20th, 2011, 6:49 pm
by toddz88
Trying to figure this out.. looking at s2member-pro/includes/classes/gateways/paypal/paypal-checkout-in-inc.php, found "recurring_payment_suspended_due_to_max_failed_payment" mentioned only twice:

line 1268:
Code: Select all
(preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i",$paypal["txn_type"]) && ($recurring = 1))/**/

line 1294:
Code: Select all
$paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - recurring_payment_profile_cancel w/ initial_payment_status (failed).";

neither explicity map that PP IPN event to an s2m %%eot_del_type%%. So I'm guessing it's set to the "no/else" here..
line 1314:
Code: Select all
$eot_del_type = ($is_refund_or_reversal) ? "ipn-refund-reversal-demotion" : "ipn-cancellation-expiration-demotion";


So I am hoping for confirmation that:
a Max Failed Payments IPN triggers an s2m api "EOT/Deletion" Notification with %%eot_del_type%%="ipn-cancellation-expiration-demotion" ?

My goal in all this is to be able to alert the site owner (using s2m api notifs) when a member has been Suspended (in Paypal) and Demoted (in our site) due explicitly to MaxFailedPayments. This is IMPORTANT because this is probably a member who did NOT INTEND to lose access to the site, as opposed to someone who Cancelled (or did a Refund, Reversal, or Chargeback).

Thanks!
Todd

Re: EOT for Failed Payments?

PostPosted: May 23rd, 2011, 3:38 am
by Jason Caldwell
Gotchya. I see what you're trying to accomplish now.

Yes, for txn_type=recurring_payment_suspended_due_to_max_failed_payment
%%eot_del_type%% = ipn-cancellation-expiration-demotion
Or, if you've configured s2Member to delete, it will be:
ipn-cancellation-expiration-deletion

No, we don't currently have a separate "type" string for this event, but I can certainly now why you want one. I'll see what we can do about that. Until then, you could do something like this.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action
("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", "my_custom_function");
function my_custom_function($vars = array())
    {
        if($vars["paypal"]["txn_type"] === "recurring_payment_suspended_due_to_max_failed_payment")
            $vars["__refs"]["eot_del_type"] = "ipn-cancellation-failed-payments-demotion";
    }
?>

Now you will get this "type" string:
ipn-cancellation-failed-payments-demotion