Hi Cristián – thanks for your answer.
I actually did something similar to what you suggested, “patching” the upgrade shortcode with the new price.
On the upgrade page, i have two links, each one sending a different “?upgrade_to” parameter (basic / premium).
Below is the PHP code used to calculate the refund value / discount based on the remaining subscription months.
$upgrade_to = htmlspecialchars($_REQUEST['upgrade_to'], ENT_QUOTES, 'UTF-8');
$expiration_date = get_user_meta($current_user->ID, 'wp_s2member_auto_eot_time', true);
$remaining_months = -1;
$curr_mem_type = get_current_user_role(2);
if (current_user_is("s2member_level1")) $curr_level_price = 450;
if (current_user_is("s2member_level2")) $curr_level_price = 995;
$today = time();
while($today < $expiration_date)
{
$remaining_months++;
$today = strtotime("+ 1 month", $today);
}
switch($upgrade_to) {
case "basic":
$desired_mem_type = "BASIC Membership";
$desired_level_price = 450;
$memlevelid = 1;
break;
case "premium":
$desired_mem_type = "PREMIUM Membership";
$desired_level_price = 995;
$memlevelid = 2;
break;
}
$refund_value = round ($curr_level_price / 12 * $remaining_months, 2);
$upgrade_price = $desired_level_price - $refund_value;
And this is the shortcode used:
<?php echo do_shortcode('[s2Member-Pro-PayPal-Form modify="1" level="'.$memlevelid.'" ccaps="" desc="Total Charge: $'.$upgrade_price.' USD" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="'.$_SERVER['HTTP_HOST'].'" ta="0" tp="0" tt="D" ra="'.$upgrade_price.'" rp="1" rt="Y" rr="0" rrt="" rra="2" accept="paypal,visa,mastercard,amex" accept_via_paypal="paypal" coupon="" accept_coupons="1" default_country_code="US" captcha="0" /]'); ?>
However, i have a question – if i set the payment recurring (“rr” = 1), and the “ra” (payment value) attribute is discounted above to a lower value than my desired annual subscription – what happens in this case after one year?
For example, the annual fee for premium membership is $995, but due to discounts applied, the “RA” value will be $300. Which will be the amount auto-billed at the end of the time period: $995 or $300?
I’m asking because i would like to have the client auto-billed, but at the regular annual value, not at the discounted price.
Can I setup the discounted payment value as a “trial” payment (“TA = 300”), and then the full value as the regular price (“RA = 995”), with “RR = 1”?
In the case above, after the initial “trial” year expires, the user’s paypal will be auto-charged at the full rate?
Thanks a lot!