chartmogul/chartmogul-php

Feature Request: Cancel Sub

Closed this issue · 4 comments

It would be useful to be able to cancel a subscription with the subscription UUID rather than having to do it via the Customer class.

From what I can tell this is possible via:
https://dev.chartmogul.com/v1.0/reference#cancel-a-customers-subscription

Hello @mattlanham, thank you for the report. I am not sure what you mean exactly, though. I've tried the documented example and it works.

<?php
    // set up an example invoice with a subscription line item
    $subsUUID = $customerInvoices->invoices[0]->line_items[0]->subscription_uuid;
    print_r($subsUUID); //eg. sub_2ca30291-f6cf-4801-802e-396176d4eab3

    $subscription = new ChartMogul\Subscription(["uuid" => $subsUUID]);
    // $subscription = $subscription->setCancellationDates(["2013-02-03T01:02:33.000Z"]);
    // OR
    $subscription = $subscription->cancel("2013-02-03T01:02:33.000Z");

So... you are able to cancel a subscription directly with the Subscription class. Can you please specify your problem further?

Oh, I didn't see any documentation for new ChartMogul\Subscription(["uuid" => $subsUUID]) that looks like it will resolve my issue, perhaps it's worth adding that to the Readme with the other subscription examples.

I recommend using our reference documentation, which is most up-to-date and offers more explanation:
https://dev.chartmogul.com/v1.0/reference#cancel-a-customers-subscription

Ah, I didn't even notice the language switcher, that will make it so much easier!! Thanks! and great work!