Add Tracked Item on Purchase

This call adds a tracked item to a purchase. Note that the purchase must be in draft status.

Request Parameters

PropertyTypeDescriptionRequired
referenceStringThe unique identifier for this tracked item. This uniqueness is enforced by Fusebill across all tracked items for that product, not just tracked items on the given purchase. [Max Length: 255 characters]Yes
purchaseIdIntegerThe Fusebill generated unique ID for the draft purchase of a tracking enabled purchasable product and with which you want the new tracked item associated withYes
nameStringAn field for storing custom data, intended to be the name of the item. [Max Length 100 characters]Yes
descriptionStringAn optional field for storing custom data, intended to be a description of the item. [Max Length: 255 characters]Optional
Examples
curl –X POST https://secure.fusebill.com/v1/purchaseProductItems\ 
-H "Content-Type: application/json" \ 
-H "Authorization: Basic {APIKey}" \ 
-d "{reference:'vh63k2jxu77291z',name:'license code',description: 'Premium Edition',purchaseId:556891}"
//Json data for payload 
string jsonData = "{'reference':'vh63k2jxu77291z','name':'license code', 'description': 'Premium Edition','purchaseId':556891}"; 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/purchaseProductItems"); 
//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 = {'reference':'vh63k2jxu77291z','name':'license code', 'description': 'Premium Edition','purchaseId':556891} 
#Pass in your URI, Payload and Headers 
r = requests.post('https://secure.fusebill.com/v1/purchaseProductItems, data=json.dumps(payload), headers=headers) 
print(r.content)
{
  "reference": "LiscenceKeyHere",
  "name": "Basic License",
  "description": "provides basic access",
  "purchaseId": 1234567
}
Response
{
  "reference": "vh63k2jxu77291",
  "name": "Liscence Code",
  "description": "Premium Edition",
  "purchaseId": 165111,
  "customerId": 650594,
  "productId": 46818,
  "status": "Active",
  "createdDate": "2019-11-08T13:50:32",
  "modifiedDate": "2019-11-08T13:50:32.64",
  "id": 242593,
  "uri": "https://secure.fusebill.com/v1/purchaseProductItems/242593"
}
{
    "ErrorId": 0,
    "HttpStatusCode": 404,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Purchase with id 123 not found."
        }
    ]
}
Language
Authorization