2017-04-06 65 views
0

The doc說,您可以在發送請求時使用cancellation_message參數/字段。我已經嘗試了兩個URL參數和JSON正文中的一個字段,但沒有一個將cancellation_message設置爲對null以外的任何響應。Chargify取消訂閱:如何設置取消消息

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 

我錯過了什麼嗎?

回答

1

從Chargify支持團隊得到了答案。 的cancellation_message應該被裹進subscription請求體:

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

所以工作curl要求如下所示:

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 

希望它可以幫助別人,太。