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.

Continuation of EOT/ARB cancellation issue

Home Forums Community Forum Continuation of EOT/ARB cancellation issue

This topic contains 2 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jul 9th, 2013 at 10:35 am #53181

OK. so we’re trying to force cancel ARB subscription id in authorize.net upon demotion. I think it would be awesome to have this an option in s2member.
Anyway, we’ve successfully been able to to get s2member to demote a user for any failed payments but have not been able to force authorize.net to cancel the ARB subscription. We’re going to try the following below. Can you let me know if this is the best way and/or is there a better way?

The following code is placed in our s2-hacks file.

Thanks for any insight you can provide.
/////////////

add_action('ws_plugin__s2member_during_auto_eot_system_during_demote', 'my_eot_hook_function');

function my_eot_hook_function($vars)
{
	extract($vars);
	$user = new WP_User($user_id); # Get the user's data again
	
	//ATTEMPT TO RECEIVE FIRST DEBUGGING EMAIL
	$terms = count($vars);
	$ifusedMailArbMsg = '';
	
	foreach ($vars as $field => $value)
	{
		$terms--;
		$ifusedMailArbMsg .= $field . ' = ' . $value;
		if ($terms)
		{
			$ifusedMailArbMsg .= " <br /> ";
		}
	}
	$ifusedMailArbMsg .= 'This should be the end of the results after demotion and should be the last email sent out.  Check the time sent. We should probably try and cancel out ARB in this function';
	$headers1 = 'From: notifications@morningcoach.com' . "rn" ;
	wp_mail('tech@morningcoach.com', 'fn test: my_eot_hook_function', $ifusedMailArbMsg , $headers1);
	
	
	//TEMP REMOVED BELOW
	//send_payment_failure_email($user_id);
	
	//PROGRAMATICALLY CANCEL ARB
	$request = array ("x_method" =&gt; "cancel", "x_subscription_id" =&gt; $subscription_id);
	$response = c_ws_plugin__s2member_pro_authnet_utilities::authnet_arb_response ($request);
	
	//ATTEMPT 2ND DEBUGGING EMAIL
	$terms2 = count($response);
	$response_str = '';
	
	foreach ($response as $field =&gt; $value)
	{
		$terms2--;
		$response_str .= $field . ' = ' . $value;
		if ($terms2)
		{
			$response_str .= " <br /> ";
		}
	}
	
	wp_mail('tech@morningcoach.com','result of forced cancellation in eot_hook fn',$response_str,$headers1);

}

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Wednesday Jul 10th, 2013 at 7:45 pm #53259

??? any insight guys?

Posted: Thursday Jul 11th, 2013 at 5:34 am #53281
$request = array ("x_method" => "cancel", "x_subscription_id" => $subscription_id);

$subscription_id seems to not be set, so there’s no subscription to cancel.

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