Delayed cancellation

ryan robinson's Avatar

ryan robinson

04 May, 2011 06:07 PM

I noticed a discussion from a year ago that talked about delayed cancellations. IE, it is May and a customer is on an annual subscription that is due for renewal in Sep. If the customer cancels today, CG shows the Cancelled Date/Time as today. I currently CK for a cancelled date/time to determine if a customer is still active. However, in the above scenario my customers would be denied access to services for which they have paid. Is this a planned feature? If not, what is the best way to handle the scenario?

  1. Support Staff 1 Posted by Marc Guyer on 04 May, 2011 06:59 PM

    Marc Guyer's Avatar

    Hi Ryan -- We'd like to implement this but since it's an edge case, we continue to push it to the back burner. There are several workarounds that come to mind... Probably the best way would be to change your logic for determining if the customer is still active. If the customer's current subscription is canceled, use the bill date for the latest invoice as the 'inactive' date.

  2. 2 Posted by ryan robinson on 05 May, 2011 03:13 PM

    ryan robinson's Avatar

    I have a hard time believing this is an edge case. Even in the middle of the month if a user cancels they should still have the remainder of the month available. What would be really nice is if the PHP wrapper had a method that allowed us to check if a user is active. You wouldn't have to make any changes on the cheddargetter end of things. It would just look something like this:

    $response = $client->isActive($code);

    And in the client class:

    Check if there is a cancelled date - if not, return true

     if yes, check if the current invoice expires in the future - yes, return true
    

    all other cases, return false.

    Then we would have an easy way to check if a client should have access. That is what I am going to do on my end - seems like something that wouldn't take long to add to your wrapper and I think you'd find that many users would thank you.

    Thanks for pointing me in the right direction.

  3. Support Staff 3 Posted by Marc Guyer on 05 May, 2011 03:49 PM

    Marc Guyer's Avatar

    I have a hard time believing this is an edge case.

    My point was that cancelation is an edge case. Maybe those are the wrong words. What I mean is that cancelation isn't a core concern. Further, continuing to allow access to the service through the term after cancelation is not a requirement unless your business dictates that it is a requirement. Simply stating in your terms that there are no refunds and cancelation is effective immediately upon cancelation should suffice in most cases. At the end of the day, if they've canceled then they don't want to use the service. Why bend over backwards to figure out a way to let customers use your service who don't want to use your service?

    Anyway, rant over. There actually is a method called CheddarGetter_Client::getCustomerIsActive().

    https://github.com/marcguyer/cheddargetter-client-php/commit/3d8374...

    You're more than welcome to extend that in your implementation or fork it and make the change. That sounds like an improvement that others could benefit by. The method could accept another bool param (defaulted to false) which, when true would mean they should remain active until the end of the term. Have you ever forked on GitHub?

  4. 4 Posted by ryan robinson on 05 May, 2011 04:52 PM

    ryan robinson's Avatar

    I am not very proficient with git hub. Before you posed I came up with a solution which was virtually identical (albeit less efficient) than your link. So, I'll take what you provided and use it because it is exactly what I need.

    Your points about cancellation are valid. However, if you say "cancellations effective immediately" and a customer cancels with a month left you still have to take the occasional "but I still had a month left" phone call. If you just program for it, then you never take the phone call and you never have a customer that feels cheated. In our particular case it is important, so thanks for the link!

  5. Support Staff 5 Posted by Marc Guyer on 05 May, 2011 08:13 PM

    Marc Guyer's Avatar

    Cool. Post the method you come up with here and we'll add it to the trunk.

  6. 6 Posted by ryan robinson on 05 May, 2011 10:24 PM

    ryan robinson's Avatar

    I added this to response.php:

    /**

     * Is the user active?  IE has the subscription been canceled.  If so, do they have time remaining in the current billing cycle
     *
     * @param string $code Your code for the customer
     * @param string|null $id CG id for the customer
     * @return true or false depending on the result
     * @throws CheddarGetter_Response_Exception
     */
    public function isActive($code = null) {
        $subscriptions = $this->getCustomerSubscriptions($code);
        $subscription = current($subscriptions);
        $invoices = $subscription["invoices"];
        $invoice = current($invoices);
    
        if ($subscription["canceledDatetime"] != ""){
            if(strtotime($invoice["billingDatetime"])<=time()){
                return false;
            }
        }
        return true;
    }
    

    And now I can do this in my apps:

    $response = $client->getCustomer($uid); $acitve = $response->isActive();

    if ($active){
    do something nice....
    } else{
    ...reprimand my customers for cancelling and ask them to please subscribe again because I need the money! }

  7. Support Staff 7 Posted by Marc Guyer on 06 May, 2011 07:46 PM

    Marc Guyer's Avatar

    Thanks Ryan -- We expanded on that and rolled it all into a single method. The latest is available on github

    /**
     * Whether or not a customer's subscription is active and in good standing
     *
     * @param $code string your code for the customer - required if more than one customer is in the response
     * @param $remainActiveThroughEndOfPeriod bool Set to true if you'd like the account to remain active until the end of the current payment period rather than inactive at the moment of cancelation
     * @throws CheddarGetter_Response_Exception if the response type is incompatible or if a $code is not provided and the response contains more than one customer
     * @return array
     */
    public function getCustomerIsActive($code = null, $remainActiveThroughEndOfPeriod = false) {
        $subscription = $this->getCustomerSubscription($code);
        if ($subscription['canceledDatetime']) {
            if (strtotime($subscription['canceledDatetime']) <= time()) {
                if ($remainActiveThroughEndOfPeriod) {
                    $invoice = $this->getCustomerInvoice($code);
                    if (strtotime($invoice['billingDatetime']) > time()) {
                        return true;
                    }
                }
                return false;
            }
        }
        return true;
    }
    
  8. Marc Guyer closed this discussion on 06 May, 2011 07:46 PM.

  9. ryan robinson re-opened this discussion on 06 May, 2011 08:59 PM

  10. 8 Posted by ryan robinson on 06 May, 2011 08:59 PM

    ryan robinson's Avatar

    This is perfect. I don't see any reason to provide any other solution. This
    gets the job done.

    On May 6, 2011 1:46 PM, "Marc Guyer" <
    [email blocked]> wrote:

  11. Marc Guyer closed this discussion on 06 May, 2011 09:14 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