Subscriptions: How to limit the renewals?

opus13opus13 Member
in Help edited October 2012
I've been asked to get a 'split payment' type of setup going for a product. Essentially a subscription, but with 3 payments only. Is there a way to set up a subscription that expires after the third payment?
«1
Comments
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    We are considering a setup for subscriptions that would allow essentially say 'start on this date and run X times', but currently you'd basically want to set the end date to be 3 times the subscription period your dealing with in your add to cart - which you could do either server side on page creation or in the javascript on the page.

    So for example, if you have monthly payments, from today (2nd of October) you'd set the end date to after the 2nd of December (todays payment, plus November and Decembers payment). So by setting the end date to something like the 3rd of October, the subscription will end after the third payment.

    Make sense?
  • opus13opus13 Member
    edited October 2012
    Ah. I found the section in the samples dealing with subscriptions, but there was no obvious mention of defining the end date.

    Are there any examples around showing how that should be specified?

    What i'm trying to do is a one time fee (discounted) versus 3 payments, once a month.

    Thanks!
  • lukeluke FoxyCart Team
    Hello opus13. The docs here specify the sub_enddate format: http://wiki.foxycart.com/v/1.0/products/subscriptions#subscription-related_product_options Is something unclear there? If it is, we definitely want to get it fixed in the docs.

    As for doing a discounted fee, our discount system (line item, category or coupon) should work for that as well. Please let us know how we can help.
  • Ah, I see it, but I don't understand exactly where it is supposed to be specified. The form I have going so far is:
    <form action="https://xxx.foxycart.com/cart"; method="post" accept-charset="utf-8">  
        <label class="label_left">Please select your Schedule</label>
        <select id="frequency" name="Frequency">   
             <option value="1m">Once per month - $25</option>  
             <option value="1m{p+:25}">Twice per month - $50</option>
             <option value="1m{p+:75}">Four times per month - $100</option>   
        </select>   
        <input id="price" type="hidden" name="price" value="25">   
        <input id="name" type="hidden" name="name" value="classes">   
        <input id="name" type="hidden" name="code" value="classes">   
        <input type="submit" name="Classes" value="Subscribe" class="submit" /> 
    </form>
    

    I see room for adding specific dates, but not for '92 days', then again, I don't see the format to be used.

    Do I...
    <option value="1m{p+:75}{end_date:92d}">Four times per month - $100</option>   
    
    ?
    or is this a add on field?
    <input id="end_date" type="hidden" name="end_date" value="92">
    

    There is no reference code for doing something like this that I can see.
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    Sorry if I wasn't clear earler. We don't currently have the ability to set end dates based on a certain amount of periods or days or any other amount in the future.

    As the docs that Luke linked to specify, to set an end date, you would add a sub_enddate parameter on the product, that is a date in the format of YYYYMMDD. So based on how far in the future you want to set the end date, you'll need to work out what that date will be using javascript, and then set the hidden sub_enddate value in the form to match.
  • so... subscriptions in the current system, for anyone, would all have to be made uniquely for each subsciber in order to have a standardized run time?

    Any idea what kind of a timeline before a more standard 'run for x' type of system would be available?
  • lukeluke FoxyCart Team
    That feature has 60 votes so far, but as you can see there's a lot of other items on the list along with some big company projects we're working on: http://requests.foxycart.com/forums/4162-general-requests

    I thought we had some JavaScript already built to help with this... if not, we'll come up with some for you. Can you outline what you're trying to build? If you just want to cancel a subscription in 6 months (as an example) the JavaScript should be pretty striaght forward to set the sub_enddate to 6 months from today on page load. If you describe what you're looking for, we can help out further.
  • opus13opus13 Member
    edited October 2012
    That would be much appreciated.

    What was requested of me was:
    Service Packages:
    
    Option 1 -  $379 or $135/month (3 Payments)
    
    Option 2 -  $447 or $160/month (3 Payments)
    
    Option 3 -  $527 or $190/month (3 Payments)
    


    One of these days I have just got to learn JS myself.

    Edit: Oh yeah, is it a problem if I am using .72?
  • I am also very interested in this, and setting up as x# of times rather than would certainly be a lot cleaner than an end date.

    In the mean time, given the extra parameters...
    sub_frequency=30d&sub_enddate=20121104
    

    the product in the cart appears as...
    Subscription Details
        Frequency: Every 30 Days
        Start Date: 2012-10-03
        Next Date: 2012-11-02
        End Date: 2012-11-04
    

    Is there any way to change all that to simply say something like: "You will be billed again after 30 days"?
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    If you don't mind going kind of manual you could probably whip up a little jQuery to rewrite it and hide certain lines.
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    I've written a little snippet up if you'd like to give it a try.

    Firstly, paste this into the head of your page, after the FoxyCart includes: https://gist.github.com/c3a457848c5737a3b35c

    Then, in your add to cart form, add the following:
    <input type="hidden" name="sub_enddate" value="3m 1d" />
    

    That should, on page load, update the subscription end date to be 3 months and 1 day in the future of the subscription start date - which will either be today (if no start date is set) or the subscription start date if that is set as part of the form.
  • fc_adamfc_adam FoxyCart Team
    @nate_cs,

    Yeah, when we develop functionality to allow you to set subscriptions to run for a certain number of periods, we'll probably also revisit how that is represented in the cart as well.

    For an immediate solution, you'd need to utilising some javascript as @sparkweb says.
  • Thanks @sparkweb great idea, I did not consider that, but that should work for now.

    @fc_adam I'll give that a try and appreciate you putting that together so quickly. I'll let you know how it works out.
  • fc_adam: Much thanks! i'll be poking at this later tonight.

  • opus13opus13 Member
    edited October 2012
    Damn. Didn't even get as far as testing... just including the script breaks the sites SSL :/

    edit: For testing sake I just did a 3 day, $1 per payment sub. let's see how it goes!
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    What do you mean it broke the sites SSL?
  • unfortunately, just that. when the script is fully embedded (not referenced in a sidecar file), browsers throw flags. As soon as I remove the script, it's all good again.

    ssl-break.jpg
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    Could you link me to a page where you've embedded the script and it's throwing that warning? I'd love to take a closer look.
  • https://www.naturalevo.com/register/

    I'll have the script back up in a few minutes
  • Ain't that a bitch. Now the SSL parses true.
  • fc_adamfc_adam FoxyCart Team
    I can't think of a reason that it *should* cause your SSL to fail, let me know if you can get it failing again and I'll take a look.
  • That's what was kicking me as well. There's no external references, no sidecar assets called via http://... nothing.

    But hey, now it works, and i'm testing out the functionality on a live card now (payment #1 was last night, hopefully payment #2 will set in about 10 minutes).
  • hmm. a second transaction never went though after setting the input field to
    <input type="hidden" name="sub_enddate" value="1d 4d" />
    

    is the JS locked to the specific 1 month time frame, or is is adjustable?
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    Based on that, the end date would be 5 days after the start day. What is the subscription set to for it's next run date?

    Could you let me know the FoxyCart domain you're testing with? I don't see the subs currently in your store (unless I'm looking at the wrong store)
  • This site's account is under 'naturalevo'.

    I'm not seeing any subscription transactions either, just static, $1 transactions.

    What i current have embedded:
    <form action="https://naturalevo.foxycart.com/cart"; method="post" accept-charset="utf-8">  
    	<label class="label_left">Please select your program</label>
    
        <select id="frequency" name="Incuding">   
             <option value="1d">With no follow up sessions - 3 payments of $135</option>  
             <option value="1m{p+:25}">With two follow up sessions - 3 payments of $160</option>
             <option value="1m{p+:55}">With four follow up sessions - 3 payments of $190</option>   
        </select>   
        <input id="price" type="hidden" name="price" value="1">   
        <input id="name" type="hidden" name="name" value="Lifestyle Coaching for the Individual">   
        <input id="name" type="hidden" name="code" value="lifestycoach-ind-sub">   
        <input type="hidden" name="sub_enddate" value="1d 4d" />
        <input type="submit" name="Lifestyle Coaching" value="Get Fit!" class="submit" /> 
    </form>
    

  • fc_adamfc_adam FoxyCart Team
    @opus13,

    So yeah - you're actually creating a transaction - not a subscription. You haven't specified a sub_frequency setting. What you've set as "Including" should be "sub_frequency" as it's name. A frequency setting is required to start a subscription.

    When you add the product to the cart you should see all of the sub information included with the product in the cart like the sub start date, next date and end date.
  • (looks like my previous pst about it working never showed up?)

    Anyways, the limited duration subscriptions are working, but they are all adding one extra month, making 4 payments, not 3. Any ideas?

    Thanks
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    Could you link me to the specific add to cart so I could take a look please?
  • fc_adamfc_adam FoxyCart Team
    @opus13,

    Ah - try changing that to 2m 1d instead of 3m 1d. Technically as the first payment is taken today, the third payment is only in 2 months, not 3.
Sign In or Register to comment.