post https://secure.fusebill.com/v1/SubscriptionProductQuantityChange?preview=&showZeroDollarCharges=&temporarilyDisableAutoPost=
This endpoint allows you to update the quantity of a single subscription product.
Use this endpoint under limited circumstances
This endpoint should only be used for changes that would not result in a charge to the customer's account, and only for blocks of quantity to specific products. If used outside this specific scenario, it can result in a large number of follow-up actions taking place. Webhooks, charge regeneration, invoice regeneration, and integrations will all be affected, so its use should be kept to a minimum.
If you need to make multiple changes or changes that would result in charges, use either the Update Subscription for multiple items at once or Update Subscription Product for a single product.
Sample Requests
POST /v1/SubscriptionProductQuantityChange?preview=false&showZeroDollarCharges=false&temporarilyDisableAutoPost=true HTTP/1.1
Host: secure.fusebill.com
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"subscriptionProductId": 10711645,
"deltaQuantity": 4
}
POST /v1/SubscriptionProductQuantityChange?preview=false&showZeroDollarCharges=false&temporarilyDisableAutoPost=true HTTP/1.1
Host: secure.fusebill.com
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"subscriptionProductId": 10711645,
"deltaQuantity": -2
}
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
Preview | Boolean | You can choose to use the parameter ?preview=true to return a preview DTO but choosing this option will not finalize the purchase | Optional |
showZeroDollarCharges | Boolean | This parameter specifies whether the invoice preview will include $0 charges | Optional |
temporarilyDisableAutoPost | Boolean | This will specify whether or not the resulting invoice from this call will post the related invoice or not. | Optional |
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
subscriptionProductID | Decimal | ID of the Subscription Product | Yes |
deltaQuantity | Decimal | Value to change the subscription product by. To lower the quantity of a subscription, provide a negative number | Yes |
description | String | A custom description for the quantity change [Max Length: 1000 characters] | Optional |
Examples
curl –X POST https://secure.fusebill.com/v1/SubscriptionProductQuantityChange \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{subscriptionProductId:1234, deltaQuantity:1.0}"
//Json data
string jsonData = "{'subscriptionProductId':1234, 'deltaQuantity':1.0}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionProductQuantityChange");
//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 = {'subscriptionProductId':1234, 'deltaQuantity':1.0}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/SubscriptionProductQuantityChange', data=json.dumps(payload), headers=headers)
print(r.content)
{
"subscriptionProductId": 123456,
"deltaQuantity": 2.0
}
Response
{
"subscriptionId": 937050,
"planProduct": {
"status": "Active",
"productId": 56444,
"planId": 25127,
"productCode": "dogservice",
"productName": "Dog Service",
"productStatus": "Active",
"productDescription": null,
"productType": "RecurringService",
"productGLCode": "",
"quantity": 10,
"maxQuantity": null,
"isRecurring": true,
"isFixed": false,
"isOptional": true,
"isIncludedByDefault": false,
"isTrackingItems": false,
"chargeAtSubscriptionActivation": true,
"orderToCashCycles": [
{
"planFrequencyId": 71686,
"planProductId": 190280,
"numberOfIntervals": 1,
"interval": "Monthly",
"chargeModels": [
{
"chargeModelType": "Signup",
"chargeTimingType": "StartOfPeriod",
"prorationGranularity": null,
"prorateOnPositiveQuantity": false,
"prorateOnNegativeQuantity": false,
"reverseChargeOnNegativeQuantity": false,
"id": 10711645,
"uri": null
},
{
"chargeModelType": "Lifetime",
"chargeTimingType": "Immediate",
"prorationGranularity": null,
"prorateOnPositiveQuantity": false,
"prorateOnNegativeQuantity": false,
"reverseChargeOnNegativeQuantity": false,
"id": 10711645,
"uri": null
}
],
"remainingInterval": null,
"groupQuantityChangeCharges": false,
"planProductPriceUplifts": null,
"customServiceDateNumberOfIntervals": 0,
"customServiceDateInterval": "Periods",
"customServiceDateProjection": "Future",
"earningInterval": "Monthly",
"earningNumberOfIntervals": 1,
"earningTimingInterval": "Daily",
"earningTimingType": "StartOfInterval",
"pricingModel": {
"pricingModelType": "Standard",
"quantityRanges": [
{
"min": 0,
"max": null,
"prices": [
{
"amount": 5,
"currency": "USD",
"id": 10711645,
"uri": null
}
],
"id": 0,
"uri": null
}
],
"id": 10711645,
"uri": null
},
"id": 10711645,
"uri": null
}
],
"resetType": "Never",
"planProductUniqueId": 62905,
"generateZeroDollarCharge": false,
"id": 190280,
"uri": ""
},
"quantity": 10,
"isIncluded": false,
"startDate": null,
"subscriptionProductOverride": null,
"subscriptionProductPriceOverride": null,
"chargeAtSubscriptionActivation": true,
"isCharged": false,
"subscriptionProductDiscount": null,
"subscriptionProductDiscounts": [],
"customFields": null,
"monthlyRecurringRevenue": 0,
"netMonthlyRecurringRevenue": 0,
"amount": 0,
"status": "Active",
"lastPurchaseDate": "2018-05-01T18:22:46.0006372Z",
"earningSettings": {
"earningTimingInterval": "Daily",
"earningTimingType": "StartOfInterval"
},
"remainingInterval": null,
"groupQuantityChangeCharges": false,
"priceUpliftsEnabled": false,
"priceUplifts": [],
"historicalPriceUplifts": [],
"customServiceDateNumberOfIntervals": 0,
"customServiceDateInterval": "Periods",
"customServiceDateProjection": "Future",
"generateZeroDollarCharge": false,
"id": 10711645,
"uri": "https://secure.fusebill.com/v1/SubscriptionProductQuantityChange/10711645"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Resultant quantity cannot be negative. Current Quantity: 15.000000, Delta Quantity: -92.0"
}
]
}