Skip to main content
Version: 8.2.x

Purchases

Entry Point: /purchases/{scope}

A purchase is a receipt of an executed checkout. A purchase contains the order’s total cost, purchase date, purchase status (COMPLETE or FAILED), tax paid, paymentinstruments, and line items, which are lists of the items the customer purchased.

Each time customers make successful purchases, Cortex API records them in its database. Using the purchases resource, client developers can retrieve the customer or account’s purchase history. Both successful purchases and failed purchase attempts are returned.

Purchase line items are collections of items the customer purchased. Each line item can contain one or more of the same item, but will not have two different items. For example, one line item can have 7 Rock-Star t-shirts or one Rock-Star t-shirt, but it won’t have one Rock-Star t-shirt and a Song track. The Song track and t-shirt would be in separate line items.

Read Purchase​

Retrieve a customer’s purchase.

Workflow​

  1. Start with purchases
  2. GET the link with rel: element
  3. Render the response

Response Fields​

Type: purchases.purchase​

NameDescriptionType
purchase-numberPurchase number associated with the purchase. This is the reference customers use if they need to communicate with the store’s customer service representative.string
statusIndicates the status of the purchase. The following are possible status values: IN_PROGRESS - The purchase is being processed, COMPLETED - The purchase is processed, CANCELLED - The purchase is cancelled.string
monetary-totalThe total cost paid for the purchase, including taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
taxesThe taxes for the purchasearray
  titleThe name of the tax.string
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
tax-totalThe total amount of tax paid for the purchase.object
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
purchase-dateThe date on which the purchase was made.object
  valueThe millisecond value of the date in Epoch time.long
  display-valueThe formatted date value to display on the client application.string

Read Created By​

Read the buyer who initiated the purchase.

Workflow​

  1. Start with purchase
  2. GET the link with rel: created-by
  3. Render the response

Response Fields​

Type: purchases.creator​

NameDescriptionType
user-emailEmail address of the user who created the purchase.string
user-full-nameFull name of the user who created the purchase.string

Read Purchase Billing Address​

Read the billing address for the purchase.

Workflow​

  1. Start with purchase
  2. GET the link with rel: billingaddress
  3. Render the response

Response Fields​

Type: addresses.address​

NameDescriptionType
nameThe customer name.object
  given-nameThe person’s given name.string
  family-nameThe person’s family name.string
addressThe customer address. Address field names are based on the v.card specification. For more information on this specification, see v.card.object
  street-addressThe street address.string
  extended-addressExtra field for address information. This field is optional.string
  localityThe city name.string
  regionThe region name. A region typically corresponds to a province or a state of a country.string
  postal-codePostal code or zip code.string
  country-nameThe country name.string
phone-numberPhone numberstring
organizationThe organizationstring

Read Purchase Form​

Read the purchase form to complete the purchase. Like the order resource, the purchase form may have Needinfo messages. Needinfos identify a condition that must be satisfied before a transaction can complete. Needinfos link to a selector where the customer can select the missing condition. After the Needinfos are satisfied, the order can be submitted to a purchase. For a list of messages that can appear on the order, see needinfo-messages in the Structured Messages topic.

Workflow​

  1. Start with order
  2. GET the link with rel: purchaseform
  3. Render the response

Create Purchase​

Submit the purchase form to complete the purchase.

Workflow​

  1. Start with create-purchase-form
  2. Fill out the form
  3. POST the form using the link with rel: submitorderaction

Read Purchase Look Up Form​

Retrieve the purchase look-up form.

Workflow​

  1. Start with lookups
  2. GET the link with rel: purchaselookupform
  3. Render the response

Response Fields​

Type: purchases.purchase-number​

NameDescriptionType
purchase-numberThe purchase number.string

Lookup Purchase By Number​

Lookup a purchase by the purchase number.

Workflow​

  1. Start with purchase-lookup-form
  2. Fill out the form
  3. POST the form using the link with rel: purchaselookupaction

Request Fields​

Type: purchases.purchase-number​

NameDescriptionType
purchase-numberThe purchase number.string

Read Purchase Line Items​

Retrieve a list of purchase line items.

Workflow​

  1. Start with purchase
  2. GET the link with rel: lineitems
  3. Render the response

Read Paginated Purchase Line Items​

Retrieve a list of paginated purchase line items.

Workflow​

  1. Start with purchase
  2. GET the link with rel: paginatedlineitems
  3. Render the response

Read Paginated Line Items Paginator​

Retrieve a paginator form to configure line items pagination.

Workflow​

  1. Start with paginated-purchase-line-items
  2. GET the link with rel: paginator
  3. Render the response

Response Fields​

Type: purchase.purchase-line-item-paginator​

NameDescriptionType
sizePage size. Number of line items on a page.integer

Read Purchase Line Item​

Retrieve a purchase’s line-item including details on the purchased item, such as item name, quantity purchased and cost.

Workflow​

  1. Start with purchase
  2. GET the link with rel: lineitems
  3. GET the link with rel: element
  4. Render the response

Response Fields​

Type: purchases.line-item​

NameDescriptionType
nameThe name of the item that was purchased.string
quantityThe number of items that were purchased.integer
configurationThe Fields associated with the purchase line item (Dictionary of String/Strings)object
line-extension-taxThe tax paid for the purchased item(s).array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-amountThe purchase price of the item(s), excluding taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-totalThe total amount paid for the item(s), including taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string

Read Purchase Line Item Option​

Read the option for the item purchased by the customer.

Workflow​

  1. Start with purchase-line-item
  2. GET the link with rel: options
  3. GET the link with rel: element
  4. Render the response

Response Fields​

Type: purchases.option​

NameDescriptionType
nameThe name of the item option.string
display-nameThe localized name of the item option, intended for display in the client application.string
selected-value-idThe id of the selected value.string
option-idThe id of the option.string

Purchase Line Item Option Value​

The purchase line item option value.

Workflow​

  1. Start with purchase-line-item-option
  2. GET the link with rel: value
  3. Render the response

Response Fields​

Type: purchases.value​

NameDescriptionType
nameThe name of the item option.string
display-nameThe localized name of the option name, intended for display in the client application.string

Purchase Line Item Components​

Read the component for the item purchased by the customer.

Workflow​

  1. Start with purchase-line-item
  2. GET the link with rel: components
  3. GET the link with rel: element
  4. Render the response

Response Fields​

Type: purchases.line-item​

NameDescriptionType
nameThe name of the item that was purchased.string
quantityThe number of items that were purchased.integer
configurationThe Fields associated with the purchase line item (Dictionary of String/Strings)object
line-extension-taxThe tax paid for the purchased item(s).array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-amountThe purchase price of the item(s), excluding taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-totalThe total amount paid for the item(s), including taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string

Read Dependent Purchase Line Item​

Read a dependent purchase line item.

Workflow​

  1. Start with purchase-line-item
  2. GET the link with rel: dependentlineitems
  3. GET the link with rel: element
  4. Render the response

Response Fields​

Type: purchases.line-item​

NameDescriptionType
nameThe name of the item that was purchased.string
quantityThe number of items that were purchased.integer
configurationThe Fields associated with the purchase line item (Dictionary of String/Strings)object
line-extension-taxThe tax paid for the purchased item(s).array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-amountThe purchase price of the item(s), excluding taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-totalThe total amount paid for the item(s), including taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string

Read Parent Purchase Line Item​

Read a parent purchase line item.

Workflow​

  1. Start with purchase-line-item
  2. GET the link with rel: parent
  3. Render the response

Response Fields​

Type: purchases.line-item​

NameDescriptionType
nameThe name of the item that was purchased.string
quantityThe number of items that were purchased.integer
configurationThe Fields associated with the purchase line item (Dictionary of String/Strings)object
line-extension-taxThe tax paid for the purchased item(s).array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-amountThe purchase price of the item(s), excluding taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string
line-extension-totalThe total amount paid for the item(s), including taxes.array
  currencyThe currency the cost is in.string
  amountThe decimal value of the cost.decimal
  displayFormatted currency string that can be displayed on the client application.string