chargify

Chargify Cancel Subscription: How to set cancellation message


The doc says that you can use the cancellation_message parameter/field when sending a request. I've tried both URL parameters and a field in JSON body, but none of these set the cancellation_message in the response to anything but null.

curl -H "authorization":"Basic somelongkeybase64=" -X DELETE https://myapp.chargify.com/subscriptions/17356012.json?cancellation_message=Application%20deleted

curl -H "authorization":"Basic somelongkeybase64=" -H Content-Type:application/json -d '{"cancellation_message":"Application deleted"}' -X DELETE https://myapp.chargify.com/subscriptions/17356169.json

Am I missing something?


Solution

  • Got an answer from Chargify support team. The cancellation_message should be wrapped into subscription in the request body:

    {
      'subscription': {
        'cancellation_message': 'Canceling the subscription via the API'
       }
    }
    

    So the working curl request looks like the following:

    curl -H "authorization":"Basic somelongkeybase64=" -H Content-Type:application/json -d '{"subscription":{"cancellation_message":"Application deleted"}}' -X DELETE https://myapp.chargify.com/subscriptions/17356169.json
    

    Hope it can help someone, too.