put https://secure.fusebill.com/v1/SubscriptionProducts?preview=&temporarilyDisableAutoPost=
This function will allow you to edit a Subscription Product Item in a specific Subscription Product in a specific Subscription for a Customer.
Note, setting the PriceUpliftsEnabled
key-value to "False" from a previous value of "True" will delete existing, future and historical price uplifts.
Query Parameters
Property | Type | Description | Required |
---|---|---|---|
preview | Boolean | If true, then the subscription product will not be changed. The JSON returned will show how the subscription product would be changed if the update actually occurred. Included in the response would be an invoicePreview object, since the update may result in an invoice being posted, such as a change to quantity. | Optional |
temporarilyDisableAutoPost | Boolean | If the customer is set up to have their invoices auto-post, this can be used to exclude the invoice which may be generated from this call from that process. The invoice generated would instead be a ready draft invoice. | Optional |
Request Parameters
Property | Type | Description |
---|---|---|
quantity | Decimal | This is the quantity of this Subscription Product being purchased. Used by the pricing model and price ranges to calculate the overall price. |
isIncluded | Boolean | Controls whether this subscription product is included if the plan product is optional. |
startDate | Timestamp | Controls scheduling for when this product generates charges. Can only be changed before the subscription has charges |
subscriptionProductOverride | Object. Defined below | Used to override name and description |
subscriptionProductPriceOverride | Object. See Subsctiptions: Subscription Product Price Override for details | Used to override pricing details |
chargeAtSubscriptionActivation | Boolean | Controls whether this subscription product will charge at activation. Can only be changed before the subscription has charges |
subscriptionProductDiscount | Object | Deprecated. Use the list subscriptionProductDiscounts instead |
subscriptionProductDiscounts | List of objects. Defined below. | A list of discounts applied to this subscription product |
earningSettings | Object. Defined below | Controls how this subscription product earns |
remainingInterval | Integer | The number of intervals until this subscription product expires |
upliftPriorToRecharge | Boolean | Controls whether price uplifts occur just prior to recharge |
includingInitialCharge | Boolean | Controls whether the initial charge counts when timing price uplifts |
priceUpliftsEnabled | Boolean | Controls whether price uplifts are being used for this subscription product |
priceUplifts | List of objects. Definition below. | A schedule of price uplifts |
customServiceDateNumberOfIntervals | Integer | Service dates control the dates displayed on invoice below the line item representing this subscription product on this plan frequency. This indicates how many intervals away from the invoice date is to be displayed. |
customServiceDateInterval | Enum: {Days, Periods} | Service dates control the dates displayed on invoice below the line item representing this subscription product. This controls whether the distance from the invoice date is measured in days or periods. |
customServiceDateProjection | Enum: {Past, Future} | Service dates control the dates displayed on invoice below the line item representing this plan product on this plan frequency. This controls whether the service date is before the posted invoice, or after. |
generateZeroDollarCharge | Boolean | Indicates whether this subscription product should generate a charge if it is zero dollars |
id | Integer | The Fusebill generated ID that uniquely identifies this subscription product. |
Subscription Product Override Fields
Property | Type | Description |
---|---|---|
name | String | This is the value which will be displayed instead of planProduct.productName on invoices and in other customer facing locations. [Max Length: 100 characters] |
description | String | This is the value which will be displayed instead of planProuct.productDescription on invoices and in other customer facing locations. [Max Length: 500 characters] |
Price Uplift Fields
Property | Type | Description |
---|---|---|
sequenceNumber | Integer | Indicates which position this uplift is in the sequence |
remainingIntervals | Integer | The remaining number of intervals before this price uplift takes effect after the previous uplift in the sequence occurs |
amount | Decimal | The percent amount this uplift will increase the price by |
repeatForever | Boolean | If this uplift is the last in the sequence, this indicates whether this uplift will repeat every numberOfIntervals after its first occurrence |
upliftPriorToRecharge | Boolean | Indicates whether the uplift occurs just prior to or just after the recharge |
Subscription Product Discount
Property | Type | Description |
---|---|---|
discountType | Enum:{ Percentage, Amount, AmountPerUnit} | This field indicates the type of discount applied. |
amount | Decimal | For Percentage discounts, this is the percentage which is discounted from the charge (if the discount is 25%, this value will be 25). For Amount discounts this is the actual value to subtract from the charge. |
remainingUsagesUntilStart | Integer | This is the number of billing cycles which must pass before the discount is applied. |
remainingUsage | Integer | This is the number of billing cycles which must pass before the discount automatically expires and is removed. This will be NULL for discounts which are perpetual. |
Earning Settings Fields
Property | Type | Description |
---|---|---|
earningTimingInterval | Enum:{Daily, Monthly, Yearly, Interval, EarnImmediately, DoesNotEarn} | Controls how the earning timing is measured for this subscription product |
earningTimingType | Enum:{StartOfInterval, EndOfInterval} | Controls whether the earning occurs at the start or end of the interval defined in earningTimingInterval |
Examples
curl -X PUT "https://secure.fusebill.com/v1/SubscriptionProducts?preview=true" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{subscriptionId:{subscriptionId},planProduct:{status:'Active',productId:14934,planId:3273,productCode:'monthlycharge',productName:'Monthly Charge',productStatus:'Active',productDescription:null,productType:'RecurringService',productGLCode:'',quantity:1.0,maxQuantity:null,isRecurring:true,isFixed:false,isOptional:false,isIncludedByDefault:true,isTrackingItems:true,chargeAtSubscriptionActivation:true,orderToCashCycles:[{planFrequencyId:5500,planProductId:22140,numberOfIntervals:1,interval:'Monthly',chargeModels:[{chargeModelType:'Signup',chargeTimingType:'StartOfPeriod',prorationGranularity:'Daily',prorateOnPositiveQuantity:false,prorateOnNegativeQuantity:false,reverseChargeOnNegativeQuantity:false,id:653431,uri:null},{chargeModelType:'Lifetime',chargeTimingType:'Immediate',prorationGranularity:'Daily',prorateOnPositiveQuantity:false,prorateOnNegativeQuantity:false,reverseChargeOnNegativeQuantity:false,id:653431,uri:null}],remainingInterval:null,groupQuantityChangeCharges:false,planProductPriceUplifts:null,earningInterval:'Monthly',earningNumberOfIntervals:1,earningTimingInterval:'Daily',earningTimingType:'StartOfInterval',pricingModel:{pricingModelType:'Standard',quantityRanges:[{min:0.0,max:null,prices:[{amount:15.99,currency:'USD',id:653431,uri:null}],id:0,uri:null}],id:653431,uri:null},id:653431,uri:null}],resetType:'Never',planProductUniqueId:21874,id:22140,uri:''},quantity:1.0,isIncluded:true,startDate:null,subscriptionProductOverride:null,subscriptionProductPriceOverride:null,chargeAtSubscriptionActivation:true,isCharged:true,subscriptionProductDiscount:null,subscriptionProductDiscounts:[],customFields:null,monthlyRecurringRevenue:15.99,netMonthlyRecurringRevenue:15.99,amount:15.99,status:'Active',lastPurchaseDate:'2017-01-24T20:06:48',earningSettings:{earningTimingInterval:'Daily',earningTimingType:'StartOfInterval'},remainingInterval:null,groupQuantityChangeCharges:false,priceUpliftsEnabled:false,priceUplifts:[],historicalPriceUplifts:[],id:653431}"
//True to see a preview of your changes, false to apply the changes
bool preview = false;
//Json Payload
//This Json payload should be retrieved by using the Read Subscription Product endpoint
string jsonData ="{'subscriptionId':{subscriptionProduct},'planProduct':{'status':'Active','productId':16730,'planId':2788,'productCode':'netflix','productName':'Netflix','productStatus':'Active','productDescription':'tv package updated','productType':'RecurringService','productGLCode':'recurring1','quantity':1.0,'maxQuantity':null,'isRecurring':true,'isFixed':false,'isOptional':true,'isIncludedByDefault':false,'isTrackingItems':false,'chargeAtSubscriptionActivation':true,'orderToCashCycles':[{'planFrequencyId':4766,'planProductId':18336,'numberOfIntervals':1,'interval':'Monthly','chargeModels':[{'chargeModelType':'Signup','chargeTimingType':'StartOfPeriod','prorationGranularity':'Daily','prorateOnPositiveQuantity':false,'prorateOnNegativeQuantity':false,'reverseChargeOnNegativeQuantity':false,'id':654096,'uri':null},{'chargeModelType':'Lifetime','chargeTimingType':'Immediate','prorationGranularity':'Daily','prorateOnPositiveQuantity':false,'prorateOnNegativeQuantity':false,'reverseChargeOnNegativeQuantity':false,'id':654096,'uri':null}],'remainingInterval':null,'groupQuantityChangeCharges':false,'planProductPriceUplifts':null,'earningInterval':'Monthly','earningNumberOfIntervals':1,'earningTimingInterval':'Monthly','earningTimingType':'StartOfInterval','pricingModel':{'pricingModelType':'Standard','quantityRanges':[{'min':0.0,'max':null,'prices':[{'amount':10.0,'currency':'USD','id':654096,'uri':null}],'id':0,'uri':null}],'id':654096,'uri':null},'id':654096,'uri':null}],'resetType':'Never','planProductUniqueId':18070,'id':18336,'uri':''},'quantity':1.0,'isIncluded':false,'startDate':null,'subscriptionProductOverride':null,'subscriptionProductPriceOverride':null,'chargeAtSubscriptionActivation':true,'isCharged':false,'subscriptionProductDiscount':null,'subscriptionProductDiscounts':[],'customFields':null,'monthlyRecurringRevenue':0.0,'netMonthlyRecurringRevenue':0.0,'amount':0.0,'status':'Active','lastPurchaseDate':null,'earningSettings':{'earningTimingInterval':'Monthly','earningTimingType':'StartOfInterval'},'remainingInterval':null,'groupQuantityChangeCharges':false,'priceUpliftsEnabled':false,'priceUplifts':[],'historicalPriceUplifts':[],'id':654096,'uri':'https://stg-secure.fusebill.com/v1/subscriptionproducts/654096'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionProducts?preview="+preview);
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + apiKey);
//Set request method
request.Method = "PUT";
//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 = {"subscriptionId":{id},"planProduct":
{"status":"Active","productId":{id},"planId":{id},"productCode":"subscriptionproduct","productName":"subscriptionProduct","productStatus":"Active","product
Description":None,"productType":"RecurringService","productGLCode":"","quantity":0.0,"maxQuantity":None,"isRecurring":"true","isFixed":"false","isOptional":
"true","isIncludedByDefault":"false","isTrackingItems":"true","chargeAtSubscriptionActivation":"true","orderToCashCycles":
[{"planFrequencyId":{id},"planProductId":{id},"numberOfIntervals":1,"interval":"Monthly","chargeModels":
[{"chargeModelType":"Signup","chargeTimingType":"StartOfPeriod","prorationGranularity":"Daily","prorateOnPositiveQuantity":"false","prorateOnNegativeQuantit
y":"false","reverseChargeOnNegativeQuantity":"false","id":{id},"uri":None},
{"chargeModelType":"Lifetime","chargeTimingType":"Immediate","prorationGranularity":"Daily","prorateOnPositiveQuantity":"false","prorateOnNegativeQuantity":
"false","reverseChargeOnNegativeQuantity":"false","id":{id},"uri":None}],"remainingInterval":None,"groupQuantityChangeCharges":"false","planProductPriceUp
lifts":None,"earningInterval":"Monthly","earningNumberOfIntervals":1,"earningTimingInterval":"Daily","earningTimingType":"StartOfInterval","pricingModel":
{"pricingModelType":"Standard","quantityRanges":[{"min":0.0,"max":None,"prices":
[{"amount":0.0,"currency":"USD","id":{id},"uri":None}],"id":0,"uri":None}],"id":{id},"uri":None},"id":{id},"uri":None}],"resetType":"Never","planProdu
ctUniqueId":22639,"id":22905,"uri":""},"quantity":0.0,"isIncluded":"true","startDate":None,"subscriptionProductOverride":None,"subscriptionProductPriceOverr
ide":None,"chargeAtSubscriptionActivation":"true","isCharged":"true","subscriptionProductDiscount":None,"subscriptionProductDiscounts":
[],"customFields":None,"monthlyRecurringRevenue":0.0,"netMonthlyRecurringRevenue":0.0,"amount":0.0,"status":"Active","lastPurchaseDate":"2017-02-
09T20:40:30","earningSettings":
{"earningTimingInterval":"Daily","earningTimingType":"StartOfInterval"},"remainingInterval":None,"groupQuantityChangeCharges":"false","priceUpliftsEnabled":
"false","priceUplifts":[],"historicalPriceUplifts":[],"id":{id},"uri":"https://stg-secure.fusebill.com/v1/subscriptionProducts/748636"}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/subscriptionProducts?preview=true', data=json.dumps(payload), headers=headers)
print(r.content)
{
"subscriptionId": 307446,
"planProduct": {
"status": "Active",
"productId": 46744,
"planId": 17135,
"productCode": "streamingscreenliscence",
"productName": "Streaming Screen liscence",
"productStatus": "Active",
"productDescription": "A liscence for the service to be steamed to 1 screen",
"productType": "RecurringService",
"productGLCode": "1234",
"quantity": 5.0,
"maxQuantity": null,
"isRecurring": true,
"isFixed": false,
"isOptional": false,
"isIncludedByDefault": true,
"isTrackingItems": false,
"chargeAtSubscriptionActivation": true,
"orderToCashCycles": [
{
"planFrequencyId": 22056,
"planProductId": 60885,
"numberOfIntervals": 3,
"interval": "Monthly",
"chargeModels": [
{
"chargeModelType": "Signup",
"chargeTimingType": "StartOfPeriod",
"prorationGranularity": null,
"prorateOnPositiveQuantity": false,
"prorateOnNegativeQuantity": false,
"reverseChargeOnNegativeQuantity": false,
"id": 2360360,
"uri": null
},
{
"chargeModelType": "Lifetime",
"chargeTimingType": "Immediate",
"prorationGranularity": null,
"prorateOnPositiveQuantity": false,
"prorateOnNegativeQuantity": false,
"reverseChargeOnNegativeQuantity": false,
"id": 2360360,
"uri": null
}
],
"remainingInterval": 1,
"groupQuantityChangeCharges": false,
"planProductPriceUplifts": null,
"customServiceDateNumberOfIntervals": 0,
"customServiceDateInterval": "Periods",
"customServiceDateProjection": "Future",
"upliftPriorToRecharge": true,
"includingInitialCharge": true,
"earningInterval": "Monthly",
"earningNumberOfIntervals": 3,
"earningTimingInterval": "Daily",
"earningTimingType": "StartOfInterval",
"pricingModel": {
"pricingModelType": "Standard",
"quantityRanges": [
{
"min": 0.0,
"max": null,
"prices": [
{
"amount": 10.0,
"conditionAmount": null,
"variableAmount": null,
"currency": "USD",
"id": 2360360,
"uri": null
}
],
"id": 0,
"uri": null
}
],
"id": 2360360,
"uri": null
},
"id": 2360360,
"uri": null
}
],
"resetType": "Never",
"planProductUniqueId": 60619,
"sortOrder": 0,
"generateZeroDollarCharge": false,
"id": 60885,
"uri": ""
},
"quantity": 5.0,
"isIncluded": true,
"startDate": null,
"subscriptionProductOverride": null,
"subscriptionProductPriceOverride": null,
"chargeAtSubscriptionActivation": true,
"isCharged": true,
"subscriptionProductDiscount": null,
"subscriptionProductDiscounts": [],
"customFields": null,
"monthlyRecurringRevenue": 16.67,
"netMonthlyRecurringRevenue": 16.67,
"amount": 50.0,
"status": "Active",
"lastPurchaseDate": "2019-12-06T21:43:31",
"earningSettings": {
"earningTimingInterval": "Daily",
"earningTimingType": "StartOfInterval"
},
"remainingInterval": 1,
"groupQuantityChangeCharges": false,
"priceUpliftsEnabled": false,
"priceUplifts": [
],
"upliftPriorToRecharge": false,
"includingInitialCharge": true,
"historicalPriceUplifts": [],
"customServiceDateNumberOfIntervals": 0,
"customServiceDateInterval": "Periods",
"customServiceDateProjection": "Future",
"modifiedTimestamp": "2019-12-06T21:43:27.81",
"salesforceId": null,
"generateZeroDollarCharge": true,
"id": 2360360,
"uri": "https://secure.fusebill.com/v1/subscriptionProducts/2360360"
}
Response
{
"subscriptionId":123061,
"planProduct":{
"status":"Active",
"productId":14934,
"planId":3273,
"productCode":"monthlycharge",
"productName":"Monthly Charge",
"productStatus":"Active",
"productDescription":null,
"productType":"RecurringService",
"productGLCode":"",
"quantity":1.0,
"maxQuantity":null,
"isRecurring":true,
"isFixed":false,
"isOptional":false,
"isIncludedByDefault":true,
"isTrackingItems":true,
"chargeAtSubscriptionActivation":true,
"orderToCashCycles":[
{
"planFrequencyId":5500,
"planProductId":22140,
"numberOfIntervals":1,
"interval":"Monthly",
"chargeModels":[
{
"chargeModelType":"Signup",
"chargeTimingType":"StartOfPeriod",
"prorationGranularity":"Daily",
"prorateOnPositiveQuantity":false,
"prorateOnNegativeQuantity":false,
"reverseChargeOnNegativeQuantity":false,
"id":653431,
"uri":null
},
{
"chargeModelType":"Lifetime",
"chargeTimingType":"Immediate",
"prorationGranularity":"Daily",
"prorateOnPositiveQuantity":false,
"prorateOnNegativeQuantity":false,
"reverseChargeOnNegativeQuantity":false,
"id":653431,
"uri":null
}
],
"remainingInterval":null,
"groupQuantityChangeCharges":false,
"planProductPriceUplifts":null,
"earningInterval":"Monthly",
"earningNumberOfIntervals":1,
"earningTimingInterval":"Daily",
"earningTimingType":"StartOfInterval",
"pricingModel":{
"pricingModelType":"Standard",
"quantityRanges":[
{
"min":0.0,
"max":null,
"prices":[
{
"amount":15.99,
"currency":"USD",
"id":653431,
"uri":null
}
],
"id":0,
"uri":null
}
],
"id":653431,
"uri":null
},
"id":653431,
"uri":null
}
],
"resetType":"Never",
"planProductUniqueId":21874,
"generateZeroDollarCharge": false,
"id":22140,
"uri":""
},
"quantity":1.0,
"isIncluded":true,
"startDate":null,
"subscriptionProductOverride":null,
"subscriptionProductPriceOverride":null,
"chargeAtSubscriptionActivation":true,
"isCharged":true,
"subscriptionProductDiscount":null,
"subscriptionProductDiscounts":[
],
"customFields":null,
"monthlyRecurringRevenue":15.99,
"netMonthlyRecurringRevenue":15.99,
"amount":15.99,
"status":"Active",
"lastPurchaseDate":"2017-01-25T15:59:41",
"earningSettings":{
"earningTimingInterval":"Daily",
"earningTimingType":"StartOfInterval"
},
"remainingInterval":null,
"groupQuantityChangeCharges":false,
"priceUpliftsEnabled":false,
"priceUplifts":[
],
"historicalPriceUplifts":[
],
"generateZeroDollarCharge": false,
"id":653431,
"uri":"https://secure.fusebill.com/v1/SubscriptionProducts/653431"
}{
"subscriptionId":123061,
"planProduct":{
"status":"Active",
"productId":14934,
"planId":3273,
"productCode":"monthlycharge",
"productName":"Monthly Charge",
"productStatus":"Active",
"productDescription":null,
"productType":"RecurringService",
"productGLCode":"",
"quantity":1.0,
"maxQuantity":null,
"isRecurring":true,
"isFixed":false,
"isOptional":false,
"isIncludedByDefault":true,
"isTrackingItems":true,
"chargeAtSubscriptionActivation":true,
"orderToCashCycles":[
{
"planFrequencyId":5500,
"planProductId":22140,
"numberOfIntervals":1,
"interval":"Monthly",
"chargeModels":[
{
"chargeModelType":"Signup",
"chargeTimingType":"StartOfPeriod",
"prorationGranularity":"Daily",
"prorateOnPositiveQuantity":false,
"prorateOnNegativeQuantity":false,
"reverseChargeOnNegativeQuantity":false,
"id":653431,
"uri":null
},
{
"chargeModelType":"Lifetime",
"chargeTimingType":"Immediate",
"prorationGranularity":"Daily",
"prorateOnPositiveQuantity":false,
"prorateOnNegativeQuantity":false,
"reverseChargeOnNegativeQuantity":false,
"id":653431,
"uri":null
}
],
"remainingInterval":null,
"groupQuantityChangeCharges":false,
"planProductPriceUplifts":null,
"earningInterval":"Monthly",
"earningNumberOfIntervals":1,
"earningTimingInterval":"Daily",
"earningTimingType":"StartOfInterval",
"pricingModel":{
"pricingModelType":"Standard",
"quantityRanges":[
{
"min":0.0,
"max":null,
"prices":[
{
"amount":15.99,
"currency":"USD",
"id":653431,
"uri":null
}
],
"id":0,
"uri":null
}
],
"id":653431,
"uri":null
},
"id":653431,
"uri":null
}
],
"resetType":"Never",
"planProductUniqueId":21874,
"generateZeroDollarCharge": false,
"id":22140,
"uri":""
},
"quantity":1.0,
"isIncluded":true,
"startDate":null,
"subscriptionProductOverride":null,
"subscriptionProductPriceOverride":null,
"chargeAtSubscriptionActivation":true,
"isCharged":true,
"subscriptionProductDiscount":null,
"subscriptionProductDiscounts":[
],
"customFields":null,
"monthlyRecurringRevenue":15.99,
"netMonthlyRecurringRevenue":15.99,
"amount":15.99,
"status":"Active",
"lastPurchaseDate":"2017-01-25T15:59:41",
"earningSettings":{
"earningTimingInterval":"Daily",
"earningTimingType":"StartOfInterval"
},
"remainingInterval":null,
"groupQuantityChangeCharges":false,
"priceUpliftsEnabled":false,
"priceUplifts":[
],
"historicalPriceUplifts":[
],
"generateZeroDollarCharge": false,
"id":653431,
"uri":"https://secure.fusebill.com/v1/SubscriptionProducts/653431"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "dto",
"Value": "When disabling price uplifts, do not provide a set of price uplifts."
}
]
}