post https://secure.fusebill.com/v1/subscriptions//migrate
This endpoint allows you to migrate a customer's subscription to a new plan type as defined in your plan family configuration. The migration action can be scheduled with this call to occur at a specified time in the future, or it can be done immediately.
Path Parameters
Property | Type | Description |
---|---|---|
subscriptionID | Integer | The Fusebill generated ID of the subscription intended to migrate |
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | Integer | The Fusebill generated ID of the customer who owns the subscription to be migrated | Yes |
planFamilyRelationshipId | Integer | The Fusebill generated ID of the plan family relationship being used to define the rules of the migration | Yes |
migrationTimingOption | Enum{NextBillingPeriod, Now, SpecificDate} | Controls the timing of the migration. "Now" immediately migrates the subscription, whereas the other options schedule the migration to occur in the future. | Yes |
earningOption | Enum: {FamilyDefault, None, Unearned, Full} | Controls how to handle the financials of the source subscription. Charges can be fully earned, the unearned charges can be reversed, or all the charges can be reversed. | Optional |
nameOverrideOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the name is transferred from the source subscription to the destination | Optional |
expiryOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the description is transferred from the source subscription to the destination | Optional |
descriptionOverrideOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the subscription reference is transferred from the source subscription to the destination | Optional |
referenceOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the expiry progression is transferred from the source subscription to the destination | Optional |
expiryOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the custom fields are transferred from the source subscription to the destination | Optional |
customFieldsOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the name is transferred from the source subscription to the destination | Optional |
contractStartOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the contract start information is transferred from the source subscription to the destination | Optional |
contractEndOption | Enum: {FamilyDefault, DoNotTransfer, Transfer} | Controls whether the contract end information is transferred from the source subscription to the destination | Optional |
scheduledMigrationDate | DateTime | The scheduled time for this migration to occur. | Optional. Required if migrationTimingOption is "SpecificDate" |
Examples
curl -X POST "https://secure.fusebill.com/v1/subscriptions/{subscriptionId}/migrate"\
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:{customerId},planFamilyRelationshipId:{planFamilyRelationshipId},migrationTimingOption:'NextBillingPeriod'}"
//Json Payload
string jsonData = "{customerid:{customerId},planFamilyRelationshipId:{planFamilyRelationshipId},migrationTimingOption:'NextBillingPeriod'}}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/subscriptions/{subscriptionId}/migrate");
//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 Requests
import requests
#Import library json
import json
#Define your payload parameters
payload = {"customerid":{Id},"planFamilyRelationshipId":{Id},"migrationTimingOption":'NextBillingPeriod'}
#Define your header parameters
headers = {'Authorization' : 'Basic {API Key}', 'Content-Type' : 'application/json'}
#Pass in your payload and header and store the response object
r = requests.post('https://secure.fusebill.com/v1/subscriptions/{subscriptionId}/migrate',data=json.dumps(payload), headers=headers)
print(r.content)
{
"customerId": 12874295,
"planFamilyRelationshipId": 407766,
"migrationTimingOption": "SpecificDate",
"earningOption": "Full",
"nameOverrideOption": "Transfer",
"descriptionOverrideOption": "Transfer",
"referenceOption": "Transfer",
"expiryOption": "Transfer",
"customFieldsOption": "Transfer",
"contractStartOption": "DoNotTransfer",
"contractEndOption": "DoNotTransfer",
"scheduledMigrationDate": "2020-05-10"
}
Response
null
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "options",
"Value": "Please do not specify a scheduled migration date when the migration type is now."
}
]
}