Modification of Subscription

Referencing: https://s2member.com/kb-article/forms-for-modifying-user-accounts/

What do I do if I want to change the subscription (not add to it) and change the ccaps and not the user level.

Thx,
Nigel

Hi Nigel.

You can have the logged in user buy the new subscription for the same level, then his level won’t change, but he gets the ccaps you add with it.

Is it just to add the ccaps, or do you also change the pricing?

Keep in mind that the previous subscription’s payment won’t be taken into account, nor the paid time he had left. You’ll have to do the proration with some php, or warn them about it.

if you only want to sell ccaps, you can just sell it to them with a buy-now (single) payment, and let the existing subscription continue. WP Admin > s2Member > [gateway] Buttons/Form > Capability

Does that help? :slight_smile:

Thanks.

What I want to do is:

Client buys monthly sub for £100 / month.
Client wants to upgrade to annual at £600 a year.
Client clicks upgrade (modify)
At the end of the month term the annual subs comes into force and the monthly dropped.

I suppose what I’ll need to do is:

Work out the remaining term and create a shortcode builder to generate a payment with a trail amount of the number of days left + the annual full amount, and cancel the original monthly subs (somehow!).

This seems like a lot of work to have to do to get a membership system to do something that must be pretty universally needed for a subscription based site.

How do I do the cancellation behind the scenes please after the upgrade is completed?

Thx,
Nigel

Hi Nigel.

s2 doesn’t do proration yet, but it’s on my list, and now has your vote for it too. Right, you’d need a bit of PHP to work out the details. The previous subscription would be ended when the new one is created. The PHP would work out a “trial” period that covers the remaining paid time from the first subscription, and the new subscription’s first payment would be charged afterwards.

Here’s a code sample I wrote a while ago that can give you an idea:

// Proration for level 1 subscription upgrade to level 2 subscription.
if (current_user_is('s2member_level1') {
	$level1_price     = 100; // Your level 1 price.
	$level1_days      = 30;  // Your level 1 term in days.
	$level1_day_price = $level1_price / $level1_days;
	$level2_price     = 600; // Your level 2 price.
	$user_eot_npt     = s2member_eot(); // https://s2member.com/kb-article/s2eot-shortcode-documentation/#toc-e00e3e46
	$user_days_left   = ceil(($user_eot_npt['time'] - time()) / DAY_IN_SECONDS);
	$user_credit      = ceil($user_days_left * level1_day_price);
	$level2_1st_pay   = $level2_price - $user_credit;

	// Now configure your Shortcode with trial term same as regular term, but trial amount with what you calculated above.
	// The Shortcode here has been abbreviated for clarity in this regard.
	echo do_shortcode('[s2Member-Pro-PayPal-Form ... ta="'.$level2_1st_pay.'" ... /]');
}

I hope that helps! :slight_smile:

Lovely thanks…