post https://secure.fusebill.com/v1/customercancellation
This function allows you to cancel a customer currently in any non-cancelled status. Canceling a customer also cancels subscriptions associated with that customer. Cancelling applies the same cancellationOption
to the Subscriptions as was specified in the Customer Cancellation action. For example, "Full" will refund the Customer the full value of each Subscription active on their account.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | integer | The customerId value uniquely identifies a Customer record in the Fusebill system. This value is unique to each customer. | Yes |
cancellationOption | Enum: {None, Unearned, Full} | This field defines how the system behaves when cancelling the customer's subscriptions. "None" indicates that no reversal will take place, and the system will fully earn the charges. "Unearned" will reverse the unearned revenue amounts. This is a typically partial reversal based on monthly or daily earning rules set on the plan product level at the time the subscription was created. "Full" will fully reverse all charges for the current period, regardless of how much is earned. | Yes |
Examples
curl HTTPS://secure.fusebill.com/v1/CustomerCancellation \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:{Id}, cancellationOption:'None'}"
//Json Payload
string jsonData = "{'customerId':{Id}, 'cancellationOption':'None'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customerCancellation");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "POST";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(jsonData);
streamWriter.Flush();
streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dict to the Payload parameter
payload = {'customerId': {id}, 'cancellationOption': 'None'}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/customerCancellation',data=json.dumps(payload), headers=headers)
print(r.content)
{
"customerId": 1234,
"cancellationOption": "None"
}
Response
Returns a 204 No Content Response upon success
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Allowable Cancel Options are: None, Unearned, Full"
}
]
}