Adding extra months to a plan

ryan robinson's Avatar

ryan robinson

15 Dec, 2010 11:48 PM

I have a plan set up that is set to bill once annually. However, we are running a promotion at launch to encourage customers to purchase the annual plan. When they select the annual plan, they get an additional 3 months free. Here is how I think I am going to handle this in CheddarGetter:

  1. subscribe the customer to the annual plan
  2. get the customer, the current invoice billing date and add 3 months to it
  3. direct customer to the thank you page.

I just wanted to make sure that this was the best way to handle the scenario before writing the code. Is that the correct way to handle it?

  1. Support Staff 1 Posted by Marc Guyer on 16 Dec, 2010 04:18 PM

    Marc Guyer's Avatar

    Ryan -- that is exactly the technique I'd recommend.

  2. 2 Posted by ryan robinson on 16 Dec, 2010 04:35 PM

    ryan robinson's Avatar

    Thanks for the response. I haven't tried it yet. But, what will happen with the email notifications. Will they get a new subscription notification telling them that their next bill date is in 1 year and then a suscription change notification telling them about the extra 3 months?

  3. Support Staff 3 Posted by Marc Guyer on 16 Dec, 2010 04:58 PM

    Marc Guyer's Avatar

    If you have the new subscription type turned on, they will receive the email at signup. Upon changing the bill date, no email is sent. I'd suggest modifying the email template to specify the correct date (or remove it altogether). You can use the customer meta-data feature to "pass" the correct date to the email template, or you can calculate it within the template.

  4. 4 Posted by ryan robinson on 17 Dec, 2010 01:16 AM

    ryan robinson's Avatar

    So I wrote the code to change the billing date and it works like a charm. However, the confirmation email is an issue. Currently, I just have the default template that sends has the parameter --- {$invoice.billingDatetime|date_format:"%m/%d/%Y"} --- in it. Your code must send the email as soon as the customer is created because it populates it with the old date and sends it to the user. So, two questions:

    1. Can I get it to populate the new date?
    2. If not, how do I get the email template to accurately add 3 months? (i can read up on smarty if it isn't a simple answer)
    3. If I do calculate it, is there any danger that it might delay sending the email at some point that it might pass the new date and then add an additional 3 months?

    Thanks.

  5. Support Staff 5 Posted by Marc Guyer on 17 Dec, 2010 02:58 PM

    Marc Guyer's Avatar

    There's two ways to do this.

    1. do it with smarty (learning curve are you familiar with PHP?)
    2. do it with customer meta-data - this might be the best option http://support.cheddargetter.com/kb/api-8/customer-meta-data

    If I do calculate it, is there any danger that it might delay sending the email at some point that it might pass the new date and then add an additional 3 months?

    No worries here.

  6. 6 Posted by ryan robinson on 17 Dec, 2010 04:10 PM

    ryan robinson's Avatar

    Option 2 is going to be best since we will turn the promotion off and on at times. Metadata allows us to put the correct date in depending on the status of the promotion. But, I need your help. I've been trying to get metadata submitted, but it isn't passing it. This is the code for the array I pass to CG:

    $CGdata = array(

        'code'          => $uid,
        'firstName'         => $firstName,
        'lastName'      => $lastName,
        'email'             => $_POST['email'],
        'subscription'  => array(
            'planCode'      => $_POST['plans'],
            'ccNumber'      => $_POST['card_num'],
            'ccExpiration'  => $_POST['expiration_month']."/".$_POST['expiration_year'],
            'ccFirstName'   => $bFirstName,
            'ccLastName'    => $bLastName,
            'ccZip'         => $_POST['b_zip'],
            'metaData'      => array ('billDate' => "$mydate" )
    
    
        )
    );
    

    is that the correct format for inserting metadata?

  7. Support Staff 7 Posted by Marc Guyer on 17 Dec, 2010 05:27 PM

    Marc Guyer's Avatar

    You've got it nested within the 'subscription' key. 'metaData' must be at the root level of the array.

  8. 8 Posted by ryan robinson on 17 Dec, 2010 05:51 PM

    ryan robinson's Avatar

    Rookies:) Thanks.

  9. Dean closed this discussion on 16 Jan, 2013 03:43 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM