Subscriptions

Hello,

Is there a way that I could have users choose to pay for a product in full or in two payments? If this is possible I would like to set a date when the second payment is charged.
Comments
  • fc_jedfc_jed FoxyCart Team
    edited June 2015
    @generocha

    It's entirely possible, but you would need to get a little creative. When do you intend for the second payment to be charged?

    You could set your sub_frequency with two options: one blank value (full) and the other with an interval (installment). I've take the liberty to write you a sample:

    <input type = "hidden" name = "sub_enddate" value = "20150704" />
    <select id = "sub_frequency" name="sub_frequency">
    <option value="">Full</option>
    <option value="1m">Installment</option>
    </select>


    In this scenario, let's say you want to bill the second payment next month, then I could set my end date to the day after today. The customer would be billed twice, once at the start and the other one month from now. There would only be two times he would be billed.

    Of course, you would have to set a different price for when the customer selects full payment or installment, but that would be up to your discretion.
  • I would like the second payment to be charged on December 31, 2015. Can you set the sub_frequency to only be charged twice?

    How do I have two different prices for one product?
  • fc_adamfc_adam FoxyCart Team
    @generocha,

    For what you're describing, there is a second approach you could take as well.

    To keep things simple, I'd recommend splitting this into two products - so there would be an add to cart button for paying all today and a second button for paying in two installments.

    For the installments button - you would have a form that actually adds two products to the cart at once. One would be a normal product for todays charge. The second product would be the second charge as a subscription with a start date of the day you want the second charge to be captured. You'd then also set the end date of the subscription to the day after the start date. That would look like this:

    <input type="hidden" name="1:name" value="First Charge" />
    <input type="hidden" name="1:price" value="100" />
    <input type="hidden" name="1:code" value="partial-payment" />
    <input type="hidden" name="2:name" value="Second Charge" />
    <input type="hidden" name="2:price" value="100" />
    <input type="hidden" name="2:sub_frequency" value="1m" />
    <input type="hidden" name="2:sub_startdate" value="20151231" />
    <input type="hidden" name="2:sub_enddate" value="20160101" />
    <input type="hidden" name="2:parent_code" value="partial-payment" />
    The downside to this approach is the second payment looks a little confusing to the customer - as they'll see a subscription which runs at a certain frequency (I've set that to every month). The start and end date would show that it will only run once, but it may not be initially evident to some people. Unfortunately we don't have a standard single-run future product at this time, so that's the only way to have a product run in the future just once.


    You could still take the approach that Jed suggested above - but to have the second charge of the subscription run on a certain date, you'd need to set the sub_frequency to the number of days between todays date and the date you want it to run. So for example, right now it is 210 days until December 31st, 2015 - so to have a subscription start right now and run again on December 31st, you'd set the sub_frequency to 210d. You would need to dynamically set that value in your add to cart to represent the correct amount of days.
  • Yes, I am thinking that several products will work. First I need to add content to the end of the receipt but I don't see how to do this inside the receipt container.
  • fc_jedfc_jed FoxyCart Team
    @generocha

    Looking at the different approaches, I believe the one @fc_adam proposed would better fit your requirement. You could manipulate the content of your receipt by using the receipt template, although this isn't very advisable since it might produce additional issues when upgrading. What content do you plan to add?
  • I need to add information about the product and the client would like it in the receipt. I have one more issue that has occurred in the checkout. I have a field that ask the user for DOB. I am using the Jquery calendar plugin. Everything works fine until an email is entered in the main email field. If something was added in the DOB field it is blank when an email is entered in the main email field and the Jquery calendar doesn't pop up when the DOB field is selected. I have had this issue before with the FoxyCart checkout.
  • fc_jedfc_jed FoxyCart Team
    @generocha

    Adding custom information is as easy as adding an extra hidden input when you pass your product through the form (i.e. <input type="hidden" name="custom" value="Custom Input" />)

    DOB? Do you mean Date of Birth? I don't believe FoxyCart has a native input for date of birth. Could you send me specific replication steps and links, or pictures to show me what type of error you are encountering? I advice you to check the names of the fields, because it might be conflicting with the checkout error checking.
  • I have created a custom field DOB(date of Birth). I am using Jquery UI Datepicker to populate this filed. When the user clicks the custom filed DOB the Datepicker is displayed. This works fine until the user enters an email address into the email field.
  • fc_jedfc_jed FoxyCart Team
    edited June 2015
    @generocha

    Could you please place the code here so that we could investigate?
  • I will Whisper you the URL of the checkout.
  • fc_jedfc_jed FoxyCart Team
    @generocha

    Could you provide steps to replicate the error?
  • As I said above if nothing is added in the email field and you click in the field DOB the Jquery Datepicker will be displayed. But if you add anything in the email then go down to the DOB field, anything in the DOB field will be deleted and the Jquery Datepicker will not be displayed.
  • fc_jedfc_jed FoxyCart Team
    @generocha

    Currently, I'm not getting the same error as you're describing. I'm getting an error with missing the credit card input, but that's about it. You have a lot of mandatory entries that need to be inputted.

    From the looks of it, this seems like an error in the way you implemented the Datepicker. It's triggered on error check because it might not be dynamically added. In any case, I advice that you check that, because it seems that it's not an FC-related error.
  • The error happens after the password is entered.
  • fc_jedfc_jed FoxyCart Team
    @generocha

    Yes, I see. But, that happens because the error checking reevaluates the page and that's where the datepicker breaks down. Overriding the error checking would cause more errors for the native functions. It doesn't necessarily cause the datepicker error, because datepicker would breakdown regardless. I suggest following the fix suggested here: http://stackoverflow.com/questions/713205/why-is-jqueryui-datepicker-throwing-an-error

  • fc_adamfc_adam FoxyCart Team
    @generocha,

    To expand on the answer Jed provided - the issue with the datepicker disappearing does relate to the page markup being re-rendered - a part of our new template functionality for 2.0.

    When the twig triggers the markup to be rerendered for your custom fields - that causes the markup to be replaced, which means that the element that had the datepicker attached no longer exists - it's now a new element.

    To ensure it keeps the date picker, you need to re-initialize it whenever the render happens. You can do that by hooking into our events system like this:
    <script type="text/javascript">
    FC.client.on("render.done", function() {
    // Initialise date-picker in here
    });
    </script>
    That way, whenever the re-render event occurs, it will ensure the datepicker is initialized on that element.

    You'll still want to initialise it on page load as well - so maybe put the initialise call within a function, and then call that function on jQuery page load and also on "render.done".
  • korthjp17korthjp17 Member
    edited June 2015
    I'm also running into the same issue with a site we are working on with a datepicker field. It works fine once a person goes to the checkout, until they sign in. When the fields refresh, the datepicker no longer works. I have tried it the way you suggested, but still no luck. Ours is a little different where we are blocking certain conditions. Here is the most recent version of what I'm using:


    FC.client.on("render.done", function() {
    $("#Delivery_Date").datepicker("destroy");
    var minDate = null;
    var dt = new Date();
    var hour = dt.getHours();
    if(parseInt(hour, 12) > 12) {
    minDate = 1;
    } else {
    minDate = 0;
    };
    $("#Delivery_Date").datepicker({minDate: minDate, beforeShowDay: $.datepicker.noWeekends, inline: true});
    $(document).ready(function(){
    $("#Delivery_Date").datepicker("destroy");
    var minDate = null;
    var dt = new Date();
    var hour = dt.getHours();
    if(parseInt(hour, 12) > 12) {
    minDate = 1;
    } else {
    minDate = 0;
    };
    $("#Delivery_Date").datepicker({minDate: minDate, beforeShowDay: $.datepicker.noWeekends, inline: true});
    });
    });

    I read some other articles stating it could be an issue that it's already been initialized so it needs to be destroyed first, but have tried without that as well.

    Anyone had any luck with this issue?
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    Sorry to hear the code isn't working for you. Could you whisper me your store domain so I can take a look please?
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    Thanks for whispering that information.

    It took me a while to work this one out. It related to the fact that you were including the CSS and javascript within the custom fields section of the configuration. That meant that each time the page re-rendered (or just specifically the custom fields section) and it meant the javascript and CSS was re-added. I think that was causing issues.

    I made a small change to your configuration section of your test store which got it working. Specifically I did this:

    Moved the CSS inclusion to the header section of the "Add custom header and footer code" configuration option. To the same option I added the javascript file and script to the bottom of the footer section.

    What this does is ensures that the CSS and javascript is only run once of the checkout - and testing your checkout after making that change shows it continuing t work for me.
  • @fc_adam ,

    Thanks for looking into this issue for us! It makes sense now that I see what you did to fix it. I'll run a few more tests on it and make sure it's working, but initially it seems like that fixed it.

    Thanks again!
  • I have a few questions about subscriptions.

    If a user cancels their subscriptions do we receive an email? Is the store notified?
    If a credit card is declined do we receive an email? Is the store notified?
    If the credit card expires do we receive an email? Is the store notified?

    Do you have step by step information on how a user would login into their account and update information?
  • fc_adamfc_adam FoxyCart Team
    @generocha,

    You can see information on working with subscriptions here: http://wiki.foxycart.com/static/redirect/subscriptions

    To answer your specific questions:
    If a user cancels their subscriptions do we receive an email? Is the store notified?
    If a user sets their sub to cancel, the sub will receive an end date of tomorrow and when that runs with the normal subscription processing, an email receipt will be triggered which communicates to the customer that their subscription has been cancelled. If you are set up to receive BCC's of those receipts, you'll get that as well.

    You can also be notified by making use of our Subscription Datafeed (http://wiki.foxycart.com/static/redirect/subscription_datafeed) which includes subscriptions which were cancelled on that day.
    If a credit card is declined do we receive an email? Is the store notified?
    You don't receive an email, but the subscription datafeed will include any stores that are past due - which a declined credit card will cause.
    If the credit card expires do we receive an email? Is the store notified?
    If the credit card expires - that will cause a declined transaction, so the answer is the same as above. The subscription datafeed also does include soon to expire credit cards though - so you can take action on those.


    To summarise - we don't currently include official dunning-style functionality for subscriptions, so for alerting customers that their card is about to expire, or that they have a past due amount, we provide the functionality to allow you to set that type of system up with our subscription datafeed. If that's beyond your abilities though, you could use an existing integration like OrderDesk (https://foxytools.com/orderdesk/) in order to automate subscription management beyond what FoxyCart provides out of the box.
  • @fc_adam,

    I am running into another issue on the same cart you helped us with before - with the DatePicker field. If I scroll down to pick a date before logging in, it works just fine. However, when I login with my email/pw for a saved account and pick a date from the list that's valid, it triggers the error state. If I click again and pick the same date, the error will go away then.

    Any thoughts on how to fix this?

    Thanks in advance,
    Jason
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    I can replicate that on my side - but I'm not sure exactly what's causing it. For some reason, our javascript isn't picking up correctly the new value of the delivery date field that first time - it thinks it's blank.

    We'll take a look and see if we can tell what's causing that.
  • @fc_adam ,

    Just wanted to check in with you to see if you had any luck with the validation error at all? We have a client that is getting really close to wanting to launch a site, but we would like to have this addressed before launch.

    Thanks in advance,
    Jason
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    Thanks for bumping the thread, and I'm sorry for the delay. I had asked another team member to take a look as I was unavailable to at the time but it looks like they may have unfortunately missed my note. We'll take another look and get back to you as soon as we can.
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    I'm sorry for the delay. I've managed to hunt down the issue here - and it relates to the datepicker library applying the change to the field after our javascript checks for the change. You can work around that by adding the following additional condition to the date picker code:
    onSelect: function() {
    jQuery(this).trigger("blur");
    }
  • @fc_adam
    Thanks for getting back to me on this issue! I tried implementing it, but the validation state still appears after I select a date. When I'm not logged in, it seems to work fine. If i'm logged in though, it still gives me the error state after picking a date.
  • fc_adamfc_adam FoxyCart Team
    @korthjp17,

    Oh sorry - try this instead:
    onSelect: function() {
    jQuery(this).trigger("blur").trigger("focusin.fc");
    }
  • @fc_adam

    That worked! Thank you very much for all of your help!
Sign In or Register to comment.