Update Purchase Discount

This call is used to update a purchase discount on a draft purchase

Request Parameters

PropertyTypeDescription
idIntegerID of the purchase discount on the draft purchase
discountTypeEnum:{Percentage, Amount, AmountPerUnit}Indicates how amount is interpreted for calculating the discount
amountDecimalThe percentage for the discount if discountType is "Percentage", the fixed amount if the it is "Amount", or the fixed amount per unit of quantity if it is "AmountPerUnit"
Examples
curl -X PUT "https://secure.fusebill.com/v1/purchaseDiscounts" \ 
    -H "Content-Type: application/json" \ 
    -H "Authorization: Basic {APIKey}" \ 
    -d "{purchaseId:164359,discountType:'Percentage':amount:10.0}"
//Json Payload 
string jsonData = "{'purchaseId':164359,'discountType':'Percentage':'amount':10.0}"; 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/purchaseDiscounts"); 
//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 = {'purchaseId':164359,'discountType':'Percentage':'amount':10.0} 
#Pass in your URI, Payload and Headers 
r = requests.put('https://secure.fusebill.com/v1/purchaseDiscounts, data=json.dumps(payload), headers=headers) 
print(r.content)
{
    "purchaseId": 165549,
    "discountType": "Percentage",
    "amount": 15.0,
    "id": 19245,
    "uri": "https://secure.fusebill.com/v1/purchaseDiscounts/19245"
}
Response
{
  "purchaseId": 164359,
  "discountType": "Percentage",
  "amount": 10,
  "id": 598462,
  "uri": "https://secure.fusebill.com/v1/purchasediscounts/598462"
}
{
    "ErrorId": 0,
    "HttpStatusCode": 500,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Requested value 'percentage' was not found."
        }
    ]
}
Language
Authorization