So, I am unsure if it will work, but this is my test, where I intentionally neuter Stripe’s Cancellation routines:
Inside the folder /wp-content/plugins/s2member-pro/src/includes/classes/gateways/stripe
I modified a few files…
stripe-cancellation-in.inc.php
if(is_array($ipn_signup_vars = c_ws_plugin__s2member_utils_users::get_user_ipn_signup_vars()))
{
/* Deactivated Section Below and changed the Log Return to Reflect That
$ipn['txn_type'] = 'subscr_cancel';
$ipn['subscr_cid'] = $ipn_signup_vars['subscr_cid'];
$ipn['subscr_id'] = $ipn_signup_vars['subscr_id'];
$ipn['custom'] = $ipn_signup_vars['custom'];
$ipn['period1'] = $ipn_signup_vars['period1'];
$ipn['period3'] = $ipn_signup_vars['period3'];
$ipn['payer_email'] = $ipn_signup_vars['payer_email'];
$ipn['first_name'] = $ipn_signup_vars['first_name'];
$ipn['last_name'] = $ipn_signup_vars['last_name'];
$ipn['option_name1'] = $ipn_signup_vars['option_name1'];
$ipn['option_selection1'] = $ipn_signup_vars['option_selection1'];
$ipn['option_name2'] = $ipn_signup_vars['option_name2'];
$ipn['option_selection2'] = $ipn_signup_vars['option_selection2'];
$ipn['item_name'] = $ipn_signup_vars['item_name'];
$ipn['item_number'] = $ipn_signup_vars['item_number'];
$ipn['s2member_paypal_proxy'] = 'stripe';
$ipn['s2member_paypal_proxy_use'] = 'pro-emails';
$ipn['s2member_paypal_proxy_verification'] = c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen();
c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
*/
}
Commented out the segment above, first line of the excerpt is number 89.
stripe-cancellation.inc.php
public static function stripe_cancellation()
{
/* Disabled the Function Below
if(!empty($_POST['s2member_pro_stripe_cancellation']))
c_ws_plugin__s2member_pro_stripe_cancellation_in::stripe_cancellation();
*/
}
I added the return false and I commented out the original. Not sure what this does but hopefully it cripples one item necessary.
stripe-utilities.inc.php
try // Attempt to cancel the subscription for this customer.
{
/* Deactivated Routines Below
// Check for draft/open invoice and void.
$subscription = \Stripe\Subscription::retrieve($subscription_id);
if (!empty($subscription->latest_invoice)) {
$latest_invoice = \Stripe\Invoice::retrieve($subscription->latest_invoice);
// If draft, finalize to change status to "open".
if ($latest_invoice->status == 'draft') {
$latest_invoice = $latest_invoice->finalizeInvoice([
'auto_advance' => false
]);
}
if ($latest_invoice->status == 'open') {
$latest_invoice = $latest_invoice->voidInvoice();
}
}
// Delete subscription if cancel now, update if at period end.
if ($cancel_at_period_end) {
$subscription = \Stripe\Subscription::update(
$subscription_id,
array('cancel_at_period_end' => true)
);
} else {
$subscription = \Stripe\Subscription::retrieve($subscription_id);
$subscription = $subscription->delete();
}
self::log_entry(__FUNCTION__, $input_time, $input_vars, time(), $subscription);
return $subscription; // Stripe subscription object.
*/
}
Again, commented out that segment to disable it.
I am pretty sure what I am doing is extremely inelegant and might not work. Hopefully it won’t cause issues. Maybe @clavaque gives some feedback and tells me the same could be done with half line of code
I’ll keep you all posted.