Jump to content

REST API Documentation

/downloads/files/{id}/buy


Generate an invoice to buy a file

This endpoint is only available for requests made using an OAuth Access Token for a particular member, not using an API Key or the Client Credentials Grant Type.


Parameters

Name Type Description
currency string Desired currency. If not specified, will use member's default
returnUri string The URI to return to after payment is complete. If not specified, will redirect back to the file URI

Exceptions

Code Message Description
2S303/V INVALID_ID The file ID does not exist or the authorized user does not have permission to view it
1S303/R CANNOT_BUY The member cannot buy the file
1S303/S NOT_PURCHASABLE The file is not currently purchasable
1S303/T BUY_PRODUCT The file cannot be bought directly - direct user to buy associated product
1S303/U INVALID_CURRENCY The currency specified is not available

Response

Name Type Description
id int ID number
title string Title
status string 'paid' = Paid; 'pend' = Pending; 'expd' = Expired; 'canc' = Cancelled
issueDate datetime The date the invoice was issued
paidDate datetime The date the invoice was paid
customer customer object Customer
items array of item objects Items
subTotal money object Subtotal of item costs
shippingCharges array of item objects Shipping charges
shippingTotal money object Total cost of shipping charges
tax array of taxitem objects Tax charges
taxTotal money object Total cost of tax charges
total money object Total
outstanding money object The outstanding amount to be paid
billingAddress geolocation object Billing address
shippingAddress geolocation object Shipping Address
poNumber string PO Number (set by customer)
notes string Notes (set by customer)
transactions array of transaction objects Transactions against this invoice
shipments array of order objects Shipments generated from this invoice (if paid)
purchases array of purchase objects Purchases generated from this invoice (if paid)
viewUrl string The URL to where the customer can view this invoice
checkoutUrl string The URL to where the customer can pay this invoice

customer object

Name Type Description
id int ID number
name string Username
title string Member title
timezone string Member timezone
formattedName string Username with group formatting
primaryGroup group object Primary group
secondaryGroups array of group objects Secondary groups
email string Email address
joined datetime Registration date
registrationIpAddress string IP address when registered
warningPoints int Number of active warning points
reputationPoints int Number of reputation points
photoUrl string URL to photo (which will be the site's default if they haven't set one)
photoUrlIsDefault bool Indicates if the value of photoUrl is the site's default
coverPhotoUrl string URL to profile cover photo (will be blank if there isn't one)
profileUrl string|null URL to profile
validating bool Whether or not the validating flag is set on the member account
posts int Number of content item submissions member has made
lastActivity datetime|null Last activity date on the site.
lastVisit datetime|null Last distinct visit date on the site.
lastPost datetime|null Latest content submission date.
profileViews int Number of times member's profile has been viewed
birthday string Member birthday in MM/DD/YYYY format (or MM/DD format if no year has been supplied).
customFields array of fieldgroup objects Custom profile fields. For requests using an OAuth Access Token for a particular member, only fields the authorized user can view will be included
rank array of rank objects Rank
achievements_points int Points
allowAdminEmails bool Whether or not this member wants to receive admin emails
completed bool Whether or not the registration is completed

group object

Name Type Description
id int ID number
name string Name
formattedName string Name with formatting

fieldgroup object

Name Type Description
name string Group name
fields array of field objects Fields

field object

Name Type Description
name string Field name
value string Value

rank object

Name Type Description
id int ID number
name string Name
url string Path to the rank icon
points int Points

item object

Name Type Description
name string Item name
itemApp string Key for application. For example, 'nexus' for products and renewals; 'downloads' for Downloads files
itemType string Key for item type. For example, 'package' for products; 'file' for Downloads files.
itemId int The ID for the item. For example, the product ID or the file ID.
itemUrl string Any relevant URL (for example, for Downloads files, this will be the URL to view the file)
itemImage string If the item has a relevant image (for exmaple, product image, Downloads file screenshot), the URL to it
quantity int The quantity being purchased
itemPrice money object Item price, before tax
linePrice money object Line price, before tax
taxClassId tax object If the item should be taxed, the Tax Class that applies
physical bool If the item is physical
weight float If the item is physical, the weight in kilograms
length float If the item is physical, the length in metres
width float If the item is physical, the width in metres
height float If the item is physical, the height in metres
renewalTerm renewalterm object If the item renews, the renewal term
expireDate datetime If the item has been set to expire at a certain date but not automatically renew, the dare it will expire
details object The values for any custom package fields
parentPurchase purchase object If when the item has been purchased it will be a child of an existing purchase, the parent purchase
parentItem int If when the item has been purchased it will be a child of another item on the same invoice, the ID number of the item that will be the parent
groupWithParent bool If when the item has been purchased it will have its renewals grouped with its parent
payTo customer object If the payment for this item goes to another user (for example for Downloads files), the user who will receive the payment
commission float If the payment for this item goes to another user (for example for Downloads files), the percentage of the price that will be retained by the site (in addition to fee)
fee money object If the payment for this item goes to another user (for example for Downloads files), the fee that will be deducted by the site (in addition to commission)

money object

Name Type Description
currency string The currency code (e.g. 'USD')
amount string The amount

tax object

Name Type Description
id int ID Number
name string Name

renewalterm object

Name Type Description
term string 'd' for days; 'w' for weeks; 'm' for months; 'y' for years
unit int The number for term. For example, if the renewal term is every 6 months, term will be 'm' and unit will be 6
price money object The renewal price
taxClass tax object If the renewal price is taxed, the tax class that applies

purchase object

Name Type Description
id int ID number
name string Name
itemApp string Key for application. For example, 'nexus' for products and renewals; 'downloads' for Downloads files
itemType string Key for item type. For example, 'package' for products; 'file' for Downloads files.
itemId int The ID for the item. For example, the product ID or the file ID.
customer customer object Customer
purchased datetime Purchased date
expires datetime Expiration date
active bool If purchase is currently active (not expired)
canceled bool If purchase has been canceled
renewalTerm renewalterm object Renewal term
customFields object Values for custom fields
parent purchase object Parent purchase
show bool If this purchase shows in the client area and AdminCP
licenseKey string License key
image string If the item has a relevant image (for exmaple, product image, Downloads file screenshot), the URL to it
url string The URL for the customer to view this purchase in the client area

taxitem object

Name Type Description
class tax object The tax class
rate float The rate (for example 0.2 means 20%)
amount money object Amount to pay

geolocation object

Name Type Description
lat float Latitude
long float Longitude
addressLines array of strings Lines of the street address
city string City
region string State/Region
country string 2-letter country code
postalCode string ZIP/Postal Code

transaction object

Name Type Description
id int ID number
status string Status: 'okay' = Paid; 'pend' = Pending, waiting for gateway; 'wait' = Pending, manual approval required; 'hold' = Held for manual approval; 'revw' = Flagged for review; 'fail' = Failed; 'rfnd' = Refunded; 'prfd' = Partially refunded
invoiceId int Invoice ID Number
amount money object Amount
refundAmount money object If partially refunded, the amount that has been refunded
credit money object If credited, the amount that has been credited
gateway gateway object The gateway
gatewayId string Any ID number provided by the gateway to identify the transaction on their end
date datetime Date
customer customer object Customer

gateway object

Name Type Description
id int ID number
name string Name

order object

Name Type Description
id int ID number
status string Status: 'done' = Shipped; 'pend' = Waiting to be shipped; 'canc' = Canceled
invoiceId int Invoice ID Number
method flatrate object The shipment method (may be null if using EasyPost)
items object The items in the shipment and their quantities
requestDate datetime When the shipment was requested
shipDate datetime When the shipment was shipped
address geolocation object The delivery address
trackingUrl string The URL to view tracking information, if available

flatrate object

Name Type Description
id int ID number
name string Name
×
×
  • Create New...