Coupons for Recurring Billing

Discussion in 'Payments processing' started by steveric, Dec 22, 2008.

  1. steveric

    steveric New Member

    Joined:
    Dec 22, 2008
    Messages:
    14
    We're running version 3.0.8.

    When we create a coupon it only applies the coupon on the first month's subscription fee. From month 2 on the customer is billed the full price.

    We want the coupon discount on all monthly subscription fees. Is this option available in the most recent version?

    Thanks, Stefan
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Yep, the new version allows you to set it to either the 1st payment, or all payments (1st and recurring). It wont let you do only recurring (2nd on).

    David
  3. steveric

    steveric New Member

    Joined:
    Dec 22, 2008
    Messages:
    14
    David,

    Is it possible to just replace specific files in our current installation to activate the new coupon functionality? If yes, which files to replace?

    Or do we need to do a full upgrade? With a smooth running amember application including affiliate program, we're just a bit worried we may run into problems after upgrade with the many active PayPal subscriptions we have now and our JROX affiliate program integration (Version 1.6.2.58).

    So upgrading from version 3.0.8 does it affect a lot of functionality? Are there any upgrade instructions available?

    Thanks, Stefan
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    I think there were some major file changes between 3.08 and 314. You can see for yourself by downloading the update zip, and seeing the files being replaced.

    David
  5. rdorfman

    rdorfman New Member

    Joined:
    Feb 25, 2008
    Messages:
    12
    Here's an ugly hack to 3.0.9.... prices hard-coded into file:

    In paypal_r.inc.php in function build_subscription_params:

    Code:
            if ($disc = $GLOBALS['COUPON_DISCOUNT']){
                if ($a[1]){ // first trial used, make second
                    fatal_error(_PLUG_PAY_PAYPALR_ERROR12);
                } else {   // we have a coupon, apply hard-coded discount to recurring price
                	// RD hack
                	// hard-code price vals
                	$a[1] = 0.00;  	// trial price
                	$p[1] = 7;	// trial period
                	$t[1] = "D";	// trial time unit (D=days)
                	$a[3] = 60.30;  // subsciption price (67-6.70)
                	$p[3] = 1;	// subsciption period
                	$t[3] = "M";	// subsciption time unit (M=month)
                	// orig code below
                    // $a[1] = $a[3] - $disc;
                    // $p[1] = $p[3];
                    // $t[1] = $t[3];
                }
            }
    
    Also in product.inc.php we need to set $GLOBALS['COUPON_DISCOUNT'] to a non-zero number:

    Code:
          if (count($to_discount) ) {
              $GLOBALS['COUPON_CODE'] = $coupon['code'];
              // RD hack
              // $GLOBALS['COUPON_DISCOUNT'] must be nonzero
              // $GLOBALS['COUPON_DISCOUNT'] = round($orig_amount - array_sum($prices), 2);
              $GLOBALS['COUPON_DISCOUNT'] = 6.70;
           }

Share This Page