You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR).

Overview

Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order.

From the Orders endpoints you can retrieve:

  • A list of all the orders for a commerce company:
    GET /companies/{companyId}/connections/{connectionId}/data/commerce-orders.
  • The details of an individual order:
    GET /companies/{companyId}/connections/{connectionId}/data/commerce-orders/{orderId}.

Data model

Field

Type

Description

id

string

Identifier of the order, unique to the company.

orderNumber

string

Friendly reference for the order in the commerce or point of sale platform.

country

string

ISO code for the country where the order was placed.

currency

string
See currency

Currency in which the order was placed.

createdDate

string
See date

Date on which the order was first recorded in the commerce or point of sale platform.

closedDate

string (optional)

Date on which order was closed after the product was shipped, paid for, and any refund period had elapsed.

totalAmount

decimal

Total amount of the order, including tax, net of any discounts and refunds.

totalRefund

decimal

Total amount refunded issued by a merchant on an order (always a negative value).

totalTaxAmount

decimal

Total amount of tax applied to the order.

totalDiscount

decimal

Total amount of discount applied to the order.

totalGratuity

decimal

Extra amount added to a bill.

orderLineItems

array
See order line items

Line items relating to the order.

payments

array
See payments

Payments for this order.

serviceCharges

array
See serviceCharges

Service charges for this order.

customerRef

reference type

Reference to the customer that placed the order.

modifiedDate

string
See date

Date the order was last updated in the Codat system.

sourceModifiedDate

string
See date

Date the order was last changed in the commerce or point of sale platform.

Order line items

Field

Type

Description

id

string

Identifier of the line item, unique to the order.

quantity

decimal

Number of units of the product sold.

taxPercentage

decimal

Percentage rate (from 0 to 100) of any sale tax applied to the unit amount.

totalAmount

decimal

Total price of the line item, including discounts, tax and minus any refunds.

totalTaxAmount

decimal

Total amount of tax applied to the line item.

unitPrice

decimal

Price per unit of goods or service.

productRef

reference type

Reference that links the line item to the correct product details.

productVariantRef

reference type

Reference that links the line item to the specific version of product that has been ordered.

discountAllocations

array
See discountAllocations.

Discounts applied to this line item.

Discount allocations

Details or any discounts applied to an order line item.

Field

Type

Description

name

string

Name of the discount in the commerce or point of sale platform.

totalAmount

decimal

Total amount of discount applied.

Payments

Details of a customer's payment for their order.
See payments.

Service charges

Details of any service charges applied to the order.

Field

Type

Description

description

string

Description of the service charge.

totalAmount

decimal

Total service charge, including taxes.

taxPercentage

decimal

Percentage rate (from 0 to 100) of any tax applied to the service charge.

taxAmount

decimal

Amount of the service charge that is tax.

quantity

integer

Number of times the service charge is applied to a purchase.

type

string

Type of service charge applied:

  • Unknown

  • Generic

  • Shipping

  • Overpayment

Example data

{
  "results": [
    {
      "id": "string",
      "orderNumber": "string",
      "country": "string",
      "currency": "string",
      "createdDate": "2021-04-21T10:02:05.037Z",
      "closedDate": "2021-04-21T10:02:05.037Z",
      "totalAmount": 0,
      "totalRefund": 0,
      "totalTaxAmount": 0,
      "totalDiscount": 0,
      "totalGratuity": 0,
      "orderLineItems": [
        {
          "id": "string",
          "quantity": 0,
          "taxPercentage": 0,
          "totalAmount": 0,
          "totalTaxAmount": 0,
          "unitPrice": 0,
          "productRef": {
            "id": "string",
            "name": "string"
          },
          "productVariantRef": {
            "id": "string",
            "name": "string"
          },
          "discountAllocations": [
            {
              "name": "string",
              "totalAmount": 0
            }
          ]
        }
      ],
      "payments": [
        {
          "id": "string",
          "amount": 0,
          "currency": "string",
          "type": "Unknown",
          "status": "Unknown",
          "dueDate": "2021-04-21T10:02:05.037Z",
          "createdDate": "2021-04-21T10:02:05.037Z",
          "modifiedDate": "2021-04-21T10:02:05.037Z",
          "sourceModifiedDate": "2021-04-21T10:02:05.037Z"
        }
      ],
      "serviceCharges": [
        {
          "description": "string",
          "totalAmount": 0,
          "taxPercentage": 0,
          "taxAmount": 0,
          "quantity": 0,
          "type": "Unknown"
        }
      ],
      "customerRef": {
        "id": "string",
        "name": "string"
      },
      "modifiedDate": "2021-04-21T10:02:05.037Z",
      "sourceModifiedDate": "2021-04-21T10:02:05.038Z"
    }
  ],

Did this page help you?