The Subscription Activation call does not require a content body.
This action will set the status of a Subscription to Active, which in most cases this will generate an invoice, and depending on the customer's billing options, apply a charge and a collection attempt against the Customer's payment method.
The Subscription will activate regardless of the collection attempt failing or succeeding so you should review the invoices to ensure payment was successful. This call will return the Subscription which you have activated so you can verify that the status field is set to Active. This action can only be performed against Subscriptions which have a status value of Draft or Provisioning.
In Fusebill, each Subscription is attached to a Billing Period which defines the start and end of the billing cycle and the duration (eg: one month, starting from the 1st of January or 1 Year starting on the 4th of May). Fusebill allows a Customer to have multiple Billing Periods which means different Subscriptions can have different start and end dates (eg: one Subscription starting on the 4th of the month, one on the 9th, etc). You can define the Billing Period that the Subscription should align to when you perform this call by passing in the appropriate fields in the call body.
Path Parameters
Property | Type | Description |
---|---|---|
subscriptionID | Integer | ID of the subscription to be activated |
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
preview | Boolean | If the Preview url parameter is set to True the subscription 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 |
temporarilyDisableAutoPost | Boolean | This will specify whether or not the resulting invoice from this call will post the related invoice or not | Optional |
view | Enum: {sideeffects} | If the value "sideeffects" is used, the response will include any resulting invoice information. | Optional |
Request Examples
POST https://secure.fusebill.com/v1/subscriptionActivation/216252
//this example will activate the subscription with the ID 216252. No body is required.
POST https://secure.fusebill.com/v1/subscriptionActivation/7680461?Preview=true&showzerodollarcharges=true
//This example will return a preview of the subscription activation.
//The subscription will remain in draft state after this request has completed
POST https://secure.fusebill.com/v1/subscriptionActivation/7680461?view=sideeffects
//This example will post the customer
//The resulting invoice created by the activation will be included in the response.
POST https://secure.fusebill.com/v1/subscriptionActivation
{
"invoiceDay": 20,
}
//This example includes a payload with an invoice month.
//This subscription will be activated, and billing will run on the 20th of the month.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
invoiceMonth | Integer (1-12) | Tells the system to create a billing period that cycles on the specified month and assigns this subscription to it. Typically only used for yearly frequencies. If this parameter is used for a monthly frequency, Fusebill will adjust the billing period such that the subscription will recharge on the provided day and month. | Optional |
invoiceDay | Integer (1-28) | Tells the system to create a billing period that cycles on the specified day. | Optional |
curl -X POST "https://secure.fusebill.com/v1/SubscriptionActivation/{subscriptionId}?preview=true" \
-H "Content-Type: application/json" \
-H "Content-Length: 0" \
-H "Authorization: Basic {APIKey}" \
//Json Payload
string jsonData = "{invoiceDay:20}";
//path parameter, subscriptionId
int pathParameter = {subscriptionId};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionActivation/"+pathParameter);
//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 dictionary to the Payload parameter
payload = {"invoiceDay":20}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/subscriptionActivation/{id}?preview=true', data=json.dumps(payload), headers=headers)
print(r.content)
{
"invoiceMonth": 1,
"invoiceDay": 1
}
[
{
"customerId":172677,
"planFrequency":{
"planRevisionId":122453,
"numberOfIntervals":1,
"interval":"Monthly",
"numberOfSubscriptions":1,
"status":"Active",
"setupFees":[
{
"amount":10.0,
"currency":"USD",
"id":0,
"uri":null
}
],
"charges":[
{
"amount":2.0,
"currency":"USD",
"id":0,
"uri":null
}
],
"isProrated":false,
"prorationGranularity":null,
"planFrequencyUniqueId":114,
"remainingInterval":null,
"id":114,
"uri":null
},
"planCode":"BSC2",
"planName":"Basic",
"planDescription":"Basic Monthly Services for Kennedy Consulting",
"planReference":null,
"status":"Cancelled",
"reference":null,
"subscriptionOverride":null,
"hasPostedInvoice":true,
"createdTimestamp":"2017-01-11T18:35:37",
"activatedTimestamp":null,
"provisionedTimestamp":"2017-01-11T19:07:57",
"nextPeriodStartDate":null,
"scheduledActivationTimestamp":"2017-02-01T05:00:00",
"subscriptionProducts":[
],
"remainingInterval":null,
"remainingIntervalPushOut":null,
"openSubscriptionPeriodEndDate":null,
"chargeDiscount":null,
"setupFeeDiscount":null,
"chargeDiscounts":[
],
"setupFeeDiscounts":[
],
"customFields":null,
"planAutoApplyChanges":false,
"autoApplyCatalogChanges":false,
"monthlyRecurringRevenue":0.0000,
"netMonthlyRecurringRevenue":0.0000,
"amount":12.0000,
"contractStartTimestamp":null,
"contractEndTimestamp":null,
"expiredTimestamp":null,
"cancellationTimestamp": null,
"modifiedTimestamp": "2020-04-27T19:10:14.023",
"coupons":[
],
"invoiceDay": 1,
"invoiceMonth": null,
"canMigrate": false,
"migrationDate": null,
"scheduledMigrationDate": null,
"migrations": null,
"subscriptionHasRecurringEndOfPeriodCharge":false,
"id":122453,
"uri":"https://secure.fusebill.com/v1/subscriptions/122453"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Cannot activate a subscription that has been activated."
}
]
}