delete https://secure.fusebill.com/v1/SubscriptionCoupons?subscriptionId=&couponCode=&deleteAllDiscounts=
This function is used to remove a coupon from an existing subscription. You can control whether you would like associated discounts that have been applied by the coupon to also be removed by this action.
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
subscriptionID | Integer | The target subscriptionid that currently has the coupon that needs to be removed. | Yes |
couponCode | String | The coupon code that needs to be removed on the subscription. | Yes |
deleteAllDiscounts | Boolean | Boolean identifying if the associated discounts created by the coupon should also be removed from all subscription products when the coupon is removed from the subscription. | Yes |
Examples
curl -X DELETE "https://secure.fusebill.com/v1/SubscriptionCoupons?subscriptionId={subscriptionId}&couponCode={couponCode}&deleteAllDiscounts=true" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//path parameters
int subscriptionId = {subscriptionId};
string couponCode = "{couponCode}";
bool deleteAllDiscounts = DeleteAllTheDiscounts?;
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionCoupons?subscriptionId="+subscriptionId+"&couponCode="+couponCode+"&deleteAllDiscounts="+deleteAllDiscounts);
//Add Content type
request.ContentLength = 0;
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "DELETE";
//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
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in your URI and Headers
r = requests.delete('https://secure.fusebill.com/v1/SubscriptionCoupons/?subscriptionId={id}&couponCode=ApplyThis&deleteAllDiscounts=true', headers=headers)
print(r.content)
Response
Returns a 204 No Content Response upon success
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "SubscriptionCouponCode with id 1 not found."
}
]
}