post https://secure.fusebill.com/v1/customeractivation?preview=&showzerodollarcharges=&view=
This function allows you to activate a customer currently in draft status.
There are various fields in the JSON payload which are required when activating a draft customer. These options are activateAllSubscriptions
, activateAllDraftPurchases
and temporarilyDisableAutoPost
. All of these fields are required unless preview
has been set to true, in which case only the customerID
is required.
To include the full invoice object created from the activation , you can include the parameter view=sideeffects
in the URL. This will cause the newly created invoice object to be included in the response.
Sample Requests
POST https://secure.fusebill.com/v1/customerActivation?Preview=true&showzerodollarcharges=true&view=sideeffects
//This request will preview the customer activation, and show any zero dollar charges on invoices. After this call the customer will still be in draft state.
{
"customerId": 8708457,
"activateAllSubscriptions": true,
"activateAllDraftPurchases": true,
"temporarilyDisableAutoPost": false
}
POST https://secure.fusebill.com/v1/customerActivation
//This request will activate the customer
{
"customerId": 8708457,
"activateAllSubscriptions": true,
"activateAllDraftPurchases": true,
"temporarilyDisableAutoPost": false
}
POST https://secure.fusebill.com/v1/customerActivation?view=sideeffects
//This request will activate the customer, and the resulting response will include the invoice object within the payload.
{
"customerId": 8708457,
"activateAllSubscriptions": true,
"activateAllDraftPurchases": true,
"temporarilyDisableAutoPost": false
}
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
preview | String | If the Preview url parameter is set to True the customer is not activated, the call will simple simulate the activation and calculate the mock invoice. | Optional |
showZeroDollarCharges | Boolean | If set to true, zero dollar charges will be included on invoices. | Optional |
view | String | Acceptable value is "Sideeffects". Displays resulting invoices | Optional |
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | Integer | This is the Fusebill ID of the customer | Yes |
activateAllSubscriptions | Boolean | If True, draft subscriptions will be activated along with the customer | Yes, unless preview is set to true. |
activateAllDraftPurchases | Boolean | If True, draft purchases will be activated along with the customer | Yes, unless preview is set to true. |
temporarilyDisableAutoPost | Boolean | This will specify whether or not the resulting invoice from this call will post the related invoice or not | Yes, unless preview is set to true. |
Example
curl -X POST "https://secure.fusebill.com/v1/CustomerActivation?preview=true" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{"customerId": 8708457, "activateAllSubscriptions": true, "activateAllDraftPurchases": true, "temporarilyDisableAutoPost": false}"
//Query string
string previewQuery = "false";
//Json Payload
string jsonData = "{
"customerId": 8708457,
"activateAllSubscriptions": true,
"activateAllDraftPurchases": true,
"temporarilyDisableAutoPost": false
}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/CustomerActivation?preview="+previewQuery);
//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 json
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"customerId": 8708457, "activateAllSubscriptions": true, "activateAllDraftPurchases": true, "temporarilyDisableAutoPost": false}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/CustomerActivation?preview=true',data=json.dumps(payload), headers=headers)
print(r.content)
{
"customerId": 650512,
"activateAllSubscriptions": true,
"activateAllDraftPurchases": true,
"temporarilyDisableAutoPost": true
}
Response
{
"firstName": "Richardson",
"middleName": "Reeves",
"lastName": "Woods",
"companyName": "Gadtron",
"suffix": "Sr.",
"primaryEmail": "[email protected]",
"primaryPhone": 8874452248,
"secondaryEmail": "[email protected]",
"secondaryPhone": 8585333923,
"title": "Mrs",
"reference": 100986,
"status": "Active",
"customerAccountStatus": "Good",
"currency": "USD",
"customerReference": {
"reference1": null,
"reference2": "customValue",
"reference3": null,
"salesTrackingCodes": [],
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
},
"customerAcquisition": {
"adContent": null,
"campaign": null,
"keyword": null,
"landingPage": null,
"medium": null,
"source": null,
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
},
"monthlyRecurringRevenue": 250,
"netMonthlyRecurringRevenue": 220,
"salesforceId": 12345678,
"salesforceAccountType": null,
"salesforceSynchStatus": "Enabled",
"netsuiteId": 12345678,
"netsuiteSynchStatus": "Enabled",
"netsuiteCustomerType": "Individual",
"portalUserName": "Richardson1974",
"parentId": 12000749,
"quickBooksLatchType": null,
"quickBooksId": null,
"quickBooksSyncToken": null,
"hubSpotId": null,
"hubSpotCompanyId":null,
"geotabId": "7813",
"modifiedTimestamp": "2019-11-07T15:51:11.1915461Z",
"createdTimestamp": "2018-01-01T03:33:33.02",
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "This activity could not be processed since the service status is Active"
}
]
}