delete https://secure.fusebill.com/v1/PurchaseCoupons?purchaseId=&couponCode=&deleteAllDiscounts=
This function is used to delete a coupon from a Purchase before it is finalized.
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
purchaseId | Integer | This is the Id value of the Purchase you want to delete the Coupon from. | Yes |
couponCode | String | This is the Coupon code that you want to remove from the specified Purchase. | Yes |
deleteAllDiscounts | Boolean | This determines if the Discount applied by the Coupon should also be deleted. If True, the Discount is removed along with the Coupon. If False, the Coupon is removed but the Discount it applied remains in effect. | Yes |
Examples
curl -X DELETE "https://secure.fusebill.com/v1/PurchaseCoupons?purchaseId={PurchaseId}&couponCode={CouponCode}&deleteAllDiscounts=true" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//path parameter
int purchaseId = {PurchaseId};
string couponCode = {CouponCode};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/PurchaseCoupons?purchaseId="+purchaseId+"&couponCode="+couponCode+"&deleteAllDiscounts=true" );
//Set content length
request.ContentLength = 0;
//Add Content type
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/PurchaseCoupons?purchaseId={id}&couponCode=fixed10&deleteAllDiscounts=true', headers=headers)
print(r.content)
Response
Upon success a 204 No Content response is returned
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "PurchaseCouponCode with id 123 not found."
}
]
}