get https://secure.fusebill.com/v1/Purchases/GetByProductId?id=productID&query=parameterName:value&pageSize=100&pageNumber=0
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
Property | Type | Description | Required |
---|---|---|---|
productID | Integer | This 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 Name | Acceptable Values | Parameter Name | Acceptable Values |
---|---|---|---|
Amount | Decimal Range | Customer.QuickBooksId | Integer |
CancellationTimestamp | Date Range | Customer.Reference | String |
CreatedTimestamp | Date Range | Customer.SalesforceId | String |
CustomerId | Integer | Customer.Status | Draft, Active, Cancelled, Hold, Suspended |
Customer.AccountStatus | Good, PoorStanding, Collection | Description | String |
Customer.Arbalance | Decimal Range | EarningInterval | Monthly, Yearly |
Customer.CompanyName | String | EarningNumberOfInterval | Integer |
Customer.CreatedTimestamp | Date Range | EarningTimingInterval | Daily, EarnImmediately, DoesNotEarn, Monthly, Yearly, Interval |
Customer.CurrencyId | Integer (1-24)* | EarningTimingType | StartOfInterval, EndOfInterval, DoesNotEarn |
Customer.CurrentMrr | Decimal Range | EffectiveTimestamp | Date Range |
Customer.CurrentNetMrr | Decimal Range | IsEarnedImmediately | Boolean |
Customer.CustomerReference.Reference1 | String | IsTrackingItems | Boolean |
Customer.CustomerReference.Reference2 | String | ModifiedTimestamp | Date Range |
Customer.CustomerReference.Reference3 | String | Name | String |
Customer.FirstName | String | PricingModelType | Standard, Tiered, Stairstep, Volume, Formula |
Customer.LastName | String | PurchaseTimestamp | Date Range |
Customer.MiddleName | String | Quantity | Decimal Range |
Customer.ModifiedTimestamp | Date Range | SalesforceId | String |
Customer.MonthlyRecurringRevenue | Decimal Range | Status | Draft, Purchased, Reversed, Cancelled |
Customer.NetMRR | Decimal Range | targetOrderQuantity | Decimal Range |
Customer.NetSuiteId | String | TaxableAmount | Decimal Range |
Customer.ParentId | Integer |
* 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."
}
]
}