The Activate Subscriptions call requires a content body.
This action will set the status of multiple Subscriptions to Active, which in most cases this will generate an invoice, and depending on the customer's billing options, apply a charge and make a collection attempt against the Customer's payment method. The activations occur regardless of the collection attempt succeeding or failing, unless the field invoicePreview is set to true.
All subscriptions being activated from this request are required to belong to the same customer. This action can only be performed when all Subscriptions have a status value of Draft or Provisioning.
This call returns a list of the Subscriptions which you have activated so you can verify that the status field is set to Active. If previewing, then the response also includes a preview of the invoice that would be generated.
Request Examples
POST https://secure.fusebill.com/v1/SubscriptionsActivation
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"subscriptionIds":[
301932,
301931
]
}
//this example will activate the subscriptions with IDs 301932 and 301931
POST https://secure.fusebill.com/v1/SubscriptionsActivation
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"subscriptionIds":[
301932,
301931
],
"invoicePreview":true
}
//this example will return a preview of the subscriptions with IDs 301932 and 301931 in active status
//there will also be a preview of the invoice(s) and charges that would have been generat
//this will not activate the subscriptions with IDs 301932 and 301931
POST https://secure.fusebill.com/v1/SubscriptionsActivation
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"subscriptionIds":[
301932,
301931
],
"temporarilyDisableAutoPost":true
}
//this example will activate the subscriptions with IDs 301932 and 301931
//any invoice(s) that would normally be posted will instead be draft invoice(s)
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
subscriptionIds | Array | This is a list of the subscription IDs to activate | Yes |
invoicePreview | Boolean | If set to true, an invoice preview is returned in the response. False by default. | Optional |
temporarilyDisaleAutoPost | Boolean | If set to true, invoices will not immediately post as a result of the subscriptions being activated. False by default | Optional |
curl –X POST https://secure.fusebill.com/v1/SubscriptionsActivation \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{subscriptionIds:[{subscriptionId1},{subscriptionId2}],invoicePreview:false,temporarilyDisableAutoPost:false}"
//Json data, with Subscription IDs that match the subscriptions to activate
string jsonData = "{'subscriptionIds':[{subscriptionId1},{subscriptionId2}],'invoicePreview':false,'temporarilyDisableAutoPost':false}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionsActivation");
//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 = {'subscriptionIds':[{subscriptionId1},{subscriptionId2}],'invoicePreview':False,'temporarilyDisableAutoPost':False}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/SubscriptionsActivation', data=json.dumps(payload), headers=headers)
print(r.content)
{
"subscriptionIds": [
1234,
2234,
3234
],
"invoicePreview": false,
"temporarilyDisableAutoPost": true
}
{
"subscriptions": [
{
"customerId": 595626,
"planFrequency": {
"planRevisionId": 301969,
"numberOfIntervals": 3,
"interval": "Monthly",
"numberOfSubscriptions": 1,
"status": "Active",
"setupFees": [],
"charges": [],
"isProrated": false,
"prorationGranularity": null,
"planFrequencyUniqueId": 22060,
"remainingInterval": null,
"invoiceInAdvance": 0,
"salesforceId": null,
"id": 22045,
"uri": null
},
"planCode": "bronze",
"planName": "Bronze",
"planDescription": null,
"planReference": null,
"status": "Active",
"reference": null,
"subscriptionOverride": null,
"hasPostedInvoice": true,
"createdTimestamp": "2019-08-14T20:06:56",
"activatedTimestamp": "2019-08-14T20:20:10.0009073Z",
"provisionedTimestamp": null,
"nextPeriodStartDate": "2019-11-01T04:00:00",
"lastPeriodStartDate": "2019-08-14T18:46:09",
"scheduledActivationTimestamp": null,
"subscriptionProducts": [
],
"remainingInterval": 3,
"remainingIntervalPushOut": 4,
"openSubscriptionPeriodEndDate": "2019-11-01T04:00:00",
"chargeDiscount": null,
"setupFeeDiscount": null,
"chargeDiscounts": null,
"setupFeeDiscounts": null,
"customFields": null,
"planAutoApplyChanges": false,
"autoApplyCatalogChanges": false,
"monthlyRecurringRevenue": 166.6700,
"netMonthlyRecurringRevenue": 166.6700,
"amount": 500.000000000000,
"contractStartTimestamp": null,
"contractEndTimestamp": null,
"expiredTimestamp": null,
"coupons": [],
"invoiceDay": 1,
"invoiceMonth": null,
"canMigrate": true,
"migrationDate": null,
"scheduledMigrationDate": null,
"subscriptionHasRecurringEndOfPeriodCharge": false,
"nextRechargeDate": "2019-11-01T04:00:00",
"invoiceInAdvance": 0,
"billingPeriodDefinitionId": 228969,
"id": 301932,
"uri": "subscriptions/301969"
},
{
"customerId": 595626,
"planFrequency": {
"planRevisionId": 301972,
"numberOfIntervals": 3,
"interval": "Monthly",
"numberOfSubscriptions": 1,
"status": "Active",
"setupFees": [],
"charges": [],
"isProrated": false,
"prorationGranularity": null,
"planFrequencyUniqueId": 22060,
"remainingInterval": null,
"invoiceInAdvance": 0,
"salesforceId": null,
"id": 22045,
"uri": null
},
"planCode": "bronze",
"planName": "Bronze",
"planDescription": null,
"planReference": null,
"status": "Active",
"reference": null,
"subscriptionOverride": null,
"hasPostedInvoice": true,
"createdTimestamp": "2019-08-14T20:19:38",
"activatedTimestamp": "2019-08-14T20:20:10.0009073Z",
"provisionedTimestamp": null,
"nextPeriodStartDate": "2019-11-01T04:00:00",
"lastPeriodStartDate": "2019-08-14T18:46:09",
"scheduledActivationTimestamp": null,
"subscriptionProducts": [
],
"remainingInterval": 3,
"remainingIntervalPushOut": 4,
"openSubscriptionPeriodEndDate": "2019-11-01T04:00:00",
"chargeDiscount": null,
"setupFeeDiscount": null,
"chargeDiscounts": null,
"setupFeeDiscounts": null,
"customFields": null,
"planAutoApplyChanges": false,
"autoApplyCatalogChanges": false,
"monthlyRecurringRevenue": 166.6700,
"netMonthlyRecurringRevenue": 166.6700,
"amount": 500.000000000000,
"contractStartTimestamp": null,
"contractEndTimestamp": null,
"expiredTimestamp": null,
"coupons": [],
"invoiceDay": 1,
"invoiceMonth": null,
"canMigrate": true,
"migrationDate": null,
"scheduledMigrationDate": null,
"subscriptionHasRecurringEndOfPeriodCharge": false,
"nextRechargeDate": "2019-11-01T04:00:00",
"invoiceInAdvance": 0,
"billingPeriodDefinitionId": 228969,
"id": 301931,
"uri": "subscriptions/301972"
}
],
"id": 0,
"uri": null
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "Subscription with id 1 not found."
}
]
}