Skip to main content
Version: 7.5.x

Purchases

Entry Point: /purchases/{scope}

A purchase is a receipt of an executed order. A Purchase lists the order’s total cost, purchase date, purchase status (COMPLETE or FAILED), tax paid, paymentmeans, which lists the billing and shipping details as well as customer’s paymentmethods, 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’s purchase history, which allows customers to inspect their previous purchases, check for correctness, and track the purchase’s status. Cortex API records each successful purchase and the last failed purchase. Cortex API does not track each failed purchase, it only records the last failed purchase. Once the purchase completes, the failed purchase is removed from the record and a successful purchase is recorded.

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.

The Paymentmeans resource is responsible for recording a purchase’s billing details, such as a customer’s billing address and paymentmethod

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 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
  regionValid region codes for this field can be retrieved using the Geographies Resource.string
  postal-codePostal code or zip code.string
  country-nameValid country codes for this field can be retrieved using the Geographies Resource.string
  phone-numberPhone numberstring
  organizationThe organizationstring

Read Purchase Form​

Read the purchase form to complete the purchase.

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 Lookup Form​

Retrieve the purchase lookup form.

Workflow​

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

Lookup Purchase By Number​

Look up 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

Read Purchase Line Item​

Retrieve a purchase’s line item, which includes details on the item that was purchased 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 Paymentmean​

Read a payment mean from a list of payment means.

Workflow​

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