List Purchases By Product

This call is used to retrieve a list of purchases made of a particular purchasable product. A purchase of a product is done outside of the plan/subscription model, meaning that subscription products based on a purchasable product are not included in the response to this call.

In order to manage the size of the data returned it is strongly recommended that pagination is used.

URL Parameters

PropertyTypeDescriptionRequired
productIDIntegerThis is the Fusebill generated ID of the product available for purchase.Yes

This call supports string filtering (Read More) and datetime/numeric range filtering (Read More)
&query=parameterName:Value

Parameter NameAcceptable ValuesParameter NameAcceptable Values
AmountDecimal RangeCustomer.QuickBooksIdInteger
CancellationTimestampDate RangeCustomer.ReferenceString
CreatedTimestampDate RangeCustomer.SalesforceIdString
CustomerIdIntegerCustomer.StatusDraft, Active, Cancelled, Hold, Suspended
Customer.AccountStatusGood, PoorStanding, CollectionDescriptionString
Customer.ArbalanceDecimal RangeEarningIntervalMonthly, Yearly
Customer.CompanyNameStringEarningNumberOfIntervalInteger
Customer.CreatedTimestampDate RangeEarningTimingIntervalDaily, EarnImmediately, DoesNotEarn, Monthly, Yearly, Interval
Customer.CurrencyIdInteger (1-24)*EarningTimingTypeStartOfInterval, EndOfInterval, DoesNotEarn
Customer.CurrentMrrDecimal RangeEffectiveTimestampDate Range
Customer.CurrentNetMrrDecimal RangeIsEarnedImmediatelyBoolean
Customer.CustomerReference.Reference1StringIsTrackingItemsBoolean
Customer.CustomerReference.Reference2StringModifiedTimestampDate Range
Customer.CustomerReference.Reference3StringNameString
Customer.FirstNameStringPricingModelTypeStandard, Tiered, Stairstep, Volume, Formula
Customer.LastNameStringPurchaseTimestampDate Range
Customer.MiddleNameStringQuantityDecimal Range
Customer.ModifiedTimestampDate RangeSalesforceIdString
Customer.MonthlyRecurringRevenueDecimal RangeStatusDraft, Purchased, Reversed, Cancelled
Customer.NetMRRDecimal RangetargetOrderQuantityDecimal Range
Customer.NetSuiteIdStringTaxableAmountDecimal Range
Customer.ParentIdInteger

* See here for Fusebill currency codes
This call supports pagination (Read More)
&pageSize=10&pageNumber=0
This call supports sorting (Read More)
&sortOrder=Ascending or &sortOrder=Descending
&sortExpression=expression

Examples
curl -X GET "https://secure.fusebill.com/v1/purchases/getbyProductId?id={{productID}}&query=Quantity:0|5&pageSize=100&pageNumber=0" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic {APIKey}"
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/purchases/getbyProductId?id={{productID}}&query=Quantity:0|5&pageSize=100&pageNumber=0");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "GET";      
//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 requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in your URI, Payload and Headers
r = requests.get('https://secure.fusebill.com/v1/purchases/getbyProductId?id={{productID}}&query=Quantity:0|5&pageSize=100&pageNumber=0', headers=headers)
print(r.content)
Response
[
  {
    "customerId": 12762177,
    "code": "device",
    "effectiveTimestamp": "2019-11-11T19:39:55",
    "taxableAmount": 15,
    "amount": 15,
    "modifiedTimestamp": "2019-11-11T19:40:07.963",
    "salesforceId": "b045a250231VC4RCAW",
    "netsuiteLocationId": "12",
    "productId": 25309384,
    "name": "Fitness Tracker",
    "description": "Model 5000",
    "status": "Purchased",
    "quantity": 1,
    "targetOrderQuantity": null,
    "isTrackingItems": false,
    "pricingModelType": "Standard",
    "customFields": [],
    "discounts": [],
    "priceRanges": [
      {
        "min": 0,
        "max": null,
        "amount": 15,
        "conditionAmount": null,
        "variableAmount": null
      }
    ],
    "productItems": [],
    "couponCodes": [],
    "earningSettings": {
      "earningInterval": "",
      "earningNumberOfIntervals": null,
      "earningTimingInterval": "EarnImmediately",
      "earningTimingType": "StartOfInterval"
    },
    "id": 1616831,
    "uri": "https://secure.fusebill.com/v1/Purchases/1616831"
  }
]
{
  "ErrorId": 0,
  "HttpStatusCode": 404,
  "Errors": [
    {
      "Key": "Api Error",
      "Value": "Product with id 1 not found."
    }
  ]
}
Language
Authorization