openapi: 3.1.0
servers:
  - description: Production
    url: https://api.codat.io
info:
  contact:
    email: support@codat.io
    name: Codat
  description: |-
    Codat's Commerce API allows you to access standardised data from over 11 commerce and POS systems.

    Standardize how you connect to your customers’ payment, PoS, and eCommerce systems. Retrieve orders, payouts, payments, and product data in the same way for all the leading commerce platforms.

    [Read more...](https://docs.codat.io/commerce-api/overview)

    [See our OpenAPI spec](https://github.com/codatio/oas) 
  summary: "Codat's standardized API for accessing commerce data "
  termsOfService: https://www.codat.io/legals/
  title: Commerce API
  version: 2.1.0
  x-apisguru-categories:
    - ecommerce
  x-logo:
    url: https://static.codat.io/public/branding/codat-icon-blue.svg
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/codatio/oas/main/json/Codat-Commerce.json
      version: "3.1"
  x-providerName: codat.io
  x-serviceName: commerce
security:
  - auth_header: []
tags:
  - description: Retrieve standardized data from linked commerce platforms.
    name: Customers
  - description: Retrieve standardized data from linked commerce platforms.
    name: Disputes
  - description: Retrieve standardized data from linked commerce platforms.
    name: Company info
  - description: Retrieve standardized data from linked commerce platforms.
    name: Locations
  - description: Retrieve standardized data from linked commerce platforms.
    name: Orders
  - description: Retrieve standardized data from linked commerce platforms.
    name: Payments
  - description: Retrieve standardized data from linked commerce platforms.
    name: Products
  - description: Retrieve standardized data from linked commerce platforms.
    name: Tax components
  - description: Retrieve standardized data from linked commerce platforms.
    name: Transactions
paths:
  "/companies/{companyId}/connections/{connectionId}/data/commerce-customers":
    get:
      description: List all commerce customers for the given company and data connection
      operationId: list-customers
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              examples:
                Customers:
                  value:
                    _links:
                      current:
                        href: ../dictionary
                      next:
                        href: ../dictionary
                      previous:
                        href: ../dictionary
                      self:
                        href: ../dictionary
                    pageNumber: 0
                    pageSize: 0
                    results:
                      - amount: 194.12
                        createdDate: 2019-08-24T14:15:22Z
                        currency: GBP
                        dueDate: 2019-08-24T14:15:22Z
                        id: 13d946f0-c5d5-42bc-b092-97ece17923ab
                        modifiedDate: 2019-08-24T14:15:22Z
                        paymentMethodRef:
                          id: EILBDVJVNUAGVKRQ
                          name: AliPay
                        paymentProvider: Amazon Pay
                        sourceModifiedDate: 2019-08-24T14:15:22Z
                        status: Pending
                    totalResults: 0
              schema:
                $ref: "#/components/schemas/Customers"
          description: OK
      summary: List customers
      tags:
        - Customers
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-disputes":
    get:
      description: List commerce disputes
      operationId: list-disputes
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  value:
                    _links:
                      current:
                        href: ../dictionary
                      next:
                        href: ../dictionary
                      previous:
                        href: ../dictionary
                      self:
                        href: ../dictionary
                    pageNumber: 0
                    pageSize: 0
                    results:
                      - createdDate: 2019-08-24T14:15:22Z
                        currency: GBP
                        disputedTransactions:
                          id: 13d946f0-c5d5-42bc-b092-97ece17923ab
                          type: Fee
                        dueDate: 2021-03-29T14:39:55
                        id: 13d946f0-c5d5-42bc-b092-97ece17923ab
                        modifiedDate: 2019-08-24T14:15:22Z
                        reason: Unhappy with product
                        sourceModifiedDate: 2019-08-24T14:15:22Z
                        status: Won
                        totalAmount: 194.12
                    totalResults: 0
              schema:
                $ref: "#/components/schemas/Disputes"
          description: OK
      summary: List disputes
      tags:
        - Disputes
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-info":
    get:
      description: |-
        Retrieve information about the company, as seen in the commerce platform.

        This may include information like addresses, tax registration details and social media or website information.
      operationId: get-company-info
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CompanyInfo"
          description: OK
      summary: Get company info
      tags:
        - Company info
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-locations":
    get:
      description: |-
        Retrieve a list of locations as seen in the commerce platform.

        A `location` is a geographic place at which stocks of products may be held, or from where orders were placed.
      operationId: list-locations
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  value:
                    _links:
                      current:
                        href: ../dictionary
                      next:
                        href: ../dictionary
                      previous:
                        href: ../dictionary
                      self:
                        href: ../dictionary
                    pageNumber: 0
                    pageSize: 0
                    results:
                      - address:
                          city: string
                          country: string
                          line1: string
                          line2: string
                          postalCode: string
                          region: string
                          type: Billing
                        id: 13d946f0-c5d5-42bc-b092-97ece17923ab
                        modifiedDate: 2019-08-24T14:15:22Z
                        name: string
                        sourceModifiedDate: 2019-08-24T14:15:22Z
                    totalResults: 0
              schema:
                $ref: "#/components/schemas/LocationsResponse"
          description: OK
      summary: List locations
      tags:
        - Locations
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-orders":
    get:
      description: Get a list of orders placed or held on the linked commerce platform
      operationId: list-orders
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Orders"
              x-speakeasy-usage-example: true
          description: OK
      summary: List orders
      tags:
        - Orders
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods":
    get:
      description: Retrieve a list of payment methods, such as card, cash or other online payment methods, as held in the linked commerce platform.
      operationId: list-payment-methods
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentMethods"
          description: OK
      summary: List payment methods
      tags:
        - Payments
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-payments":
    get:
      description: List commerce payments for the given company & data connection.
      operationId: list-payments
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Payments"
          description: OK
      summary: List payments
      tags:
        - Payments
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-productCategories":
    get:
      description: Product categories are used to classify a group of products together, either by type (eg "Furniture"), or sometimes by tax profile.
      operationId: list-product-categories
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductCategories"
          description: OK
      summary: List product categories
      tags:
        - Products
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-products":
    get:
      description: The Products data type provides the company's product inventory, and includes the price and quantity of all products, and product variants, available for sale.
      operationId: list-products
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Products"
          description: OK
      summary: List products
      tags:
        - Products
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-taxComponents":
    get:
      description: This endpoint returns a lits of tax rates from the commerce platform, including tax rate names and values. This supports the mapping of tax rates from the commerce platform to the accounting platform.
      operationId: get-tax-components
      responses:
        "200":
          content:
            application/json:
              examples:
                Example:
                  value:
                    taxComponents:
                      - id: 85b32439-37a0-4085-b710-054732bbcea2
                        isCompound: false
                        modifiedDate: 2021-08-06T06:00:27
                        name: Sales Tax (10%)
                        rate: 0.1
                        sourceModifiedDate: 2021-08-06T06:00:27
                      - id: 687e67ae-80f2-44e0-b17a-6a3e1f9c00f9
                        isCompound: false
                        modifiedDate: 2021-08-06T06:00:27
                        name: Sales Tax (15%)
                        rate: 0.15
                        sourceModifiedDate: 2022-04-25T02:45:27
              schema:
                $ref: "#/components/schemas/TaxComponents"
          description: OK
      summary: List tax components
      tags:
        - Tax components
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/companies/{companyId}/connections/{connectionId}/data/commerce-transactions":
    get:
      description: Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees.
      operationId: list-transactions
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transactions"
          description: OK
      summary: List transactions
      tags:
        - Transactions
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
components:
  parameters:
    companyId:
      in: path
      name: companyId
      required: true
      schema:
        description: Unique identifier for your SMB in Codat.
        example: 8a210b68-6988-11ed-a1eb-0242ac120002
        format: uuid
        type: string
    connectionId:
      in: path
      name: connectionId
      required: true
      schema:
        description: Unique identifier for a company's data connection.
        example: 2e9d2c44-f675-40ba-8049-353bfcb5e171
        format: uuid
        type: string
    orderBy:
      description: Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).
      in: query
      name: orderBy
      required: false
      schema:
        example: -modifiedDate
        type: string
      x-stoplight:
        id: 4je9lwo02netu
    page:
      description: Page number. [Read more](https://docs.codat.io/using-the-api/paging).
      in: query
      name: page
      required: true
      schema:
        default: 1
        example: 1
        format: int32
        minimum: 0
        type: integer
      x-stoplight:
        id: 1318joqblpp4e
    pageSize:
      description: Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).
      in: query
      name: pageSize
      schema:
        default: 100
        example: 100
        format: int32
        maximum: 5000
        minimum: 1
        type: integer
      x-stoplight:
        id: s2ika6rltk5y6
    query:
      description: Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).
      in: query
      name: query
      required: false
      schema:
        type: string
      x-stoplight:
        id: gupdb9kt30hfq
  schemas:
    Address:
      definitions:
        addressType:
          description: The type of the address
          enum:
            - Billing
            - Delivery
            - Order
            - Inventory
            - Unknown
          type: string
      properties:
        city:
          description: The third line of the address, or city
          type: string
        country:
          description: The country for the address
          type: string
        line1:
          description: The first line of the address
          type: string
        line2:
          description: The second line of the address
          type: string
        postalCode:
          description: The postal (or zip) code for the address
          type: string
        region:
          description: The fourth line of the address, or region
          type: string
        type:
          $ref: "#/components/schemas/Address/definitions/addressType"
      title: Address
      type: object
      x-internal: true
    CompanyInfo:
      allOf:
        - properties:
            accountBalances:
              description: The available and current cash balances for the company's accounts
              items:
                $ref: "#/components/schemas/CompanyInfo/definitions/accountBalance"
              type: array
            addresses:
              description: Addresses associated with the company
              items:
                $ref: "#/components/schemas/Address"
              type: array
            baseCurrency:
              $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
            commercePlatformRef:
              description: Identifier or reference for the company in the commerce platform
              type: string
            companyLegalName:
              description: The full legal name of the company
              example: Codat Limited
              type: string
            companyName:
              description: The name of the company
              example: Codat
              type: string
            phoneNumbers:
              description: Phone numbers associated with the company
              items:
                $ref: "#/components/schemas/PhoneNumber"
              type: array
            registrationNumber:
              description: The registration number of the company
              examples:
                - 10480375
              type: string
            sourceUrls:
              additionalProperties:
                type: string
              description: URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system
              example:
                url1: https://connect.sandbox.com/v2/customers
                url2: https://connect.sandbox.com/v2/disputes
              type: object
            webLinks:
              description: Weblinks associated with the company
              items:
                description: Weblink associated with the company.
                example:
                  type: Website
                  url: https://codat.io
                properties:
                  type:
                    description: The type of the weblink.
                    enum:
                      - Website
                      - Social
                      - Unknown
                    type: string
                  url:
                    description: The full URL for the weblink.
                    format: url
                    type: string
                title: Weblink
                type: object
              type: array
          type: object
        - $ref: "#/components/schemas/CreatedDate"
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        accountBalance:
          properties:
            available:
              description: The account's current balance
              format: decimal
              type: number
            currency:
              allOf:
                - $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
              description: The currency of the account
            pending:
              description: Funds that are not yet available in the balance
              format: decimal
              type: number
            reserved:
              description: Funds reserved as holdings
              format: decimal
              type: number
          title: Account Balance
          type: object
          x-internal: true
      description: |
        In the Codat system, company information includes standard commercial details about 
        a linked company, such as their address, phone number, and company registration.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=companyInfo) for this data type.
      title: Company Info
      type: object
    CreatedDate:
      properties:
        createdDate:
          $ref: "#/components/schemas/DateTime"
          description: The date the entity was created.
      type: object
      x-internal: true
    Customer:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            addresses:
              description: Addresses of the customer
              items:
                $ref: "#/components/schemas/Address"
              type: array
            customerName:
              description: Name of the customer
              example: Fred Smith
              type: string
            defaultCurrency:
              allOf:
                - description: |
                    Default currency of any transactional data for the customer, 
                    for example, orders or payments
                - $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
            emailAddress:
              description: Email address of the customer
              example: fred.smith@myCompany.com
              type: string
            note:
              description: Any additional information about the customer
              type: string
            phone:
              $ref: "#/components/schemas/PhoneNumber/properties/number"
          type: object
        - $ref: "#/components/schemas/CreatedDate"
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        customerRef:
          description: Reference to the customer that placed the order.
          properties:
            id:
              description: The unique identitifer of the customer being referenced
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
            name:
              description: Name of the customer being referenced.
              type: string
          required:
            - id
            - name
          type: object
      description: |-
        When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-customers) for this data type.
      examples:
        - customers:
            - addresses:
                - city: London
                  country: United Kingdom
                  line1: 301 Duck Pond
                  line2: 28 Green Street
                  postalCode: WX1X 0BE
                  region: England
                  type: billing
                - city: Paris
                  country: France
                  line1: Bread Street
                  line2: Bird Avenue
                  postalCode: WDF 123
                  region: France
                  type: delivery
              createdDate: 0001-01-01T00:00:00
              customerName: Daffy Duck
              defaultCurrency: GBP
              emailAddress: d.duck@warnerbros.com
              id: "15"
              modifiedDate: null
              note: Regular customer
              phone: (877) 492-8687
              sourceModifiedDate: 2020-09-15T23:52:28
            - addresses:
                - city: London
                  country: United Kingdom
                  line1: 101 Fire Rooms
                  line2: Engine Street
                  postalCode: WC1X 0BE
                  region: England
                  type: billing
              createdDate: 0001-01-01T00:00:00
              customerName: Tasmanian Devil
              defaultCurrency: GBP
              emailAddress: t.devil@warnerbros.com
              id: "18"
              modifiedDate: null
              note: Handle with care
              phone: +1-202-555-0181
              sourceModifiedDate: 2020-04-16T02:41:52
            - addresses:
                - city: Yorkshire
                  country: United Kingdom
                  line1: 301 Carrot Street
                  line2: Orange Town
                  postalCode: WF1X 0BE
                  region: England
                  type: billing
                - city: Paris
                  country: France
                  line1: 424 Field Street
                  line2: The Meadow
                  postalCode: WDF 123
                  region: France
                  type: delivery
              createdDate: 0001-01-01T00:00:00
              customerName: Bugs Bunny
              defaultCurrency: GBP
              emailAddress: b.bunny@warnerbros.com
              id: a99f5e0c-a4db-452f-8d2c-8fd15482b384
              modifiedDate: null
              note: Regular customer
              phone: ""
              sourceModifiedDate: 2020-08-12T14:37:37
      title: Customer
      type: object
    Customers:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Customer"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    DateTime:
      description: |-
        In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:

        ```
        2020-10-08T22:40:50Z
        2021-01-01T00:00:00
        ```



        When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

        - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
        - Unqualified local time: `2021-11-15T01:00:00`
        - UTC time offsets: `2021-11-15T01:00:00-05:00`

        > Time zones
        > 
        > Not all dates from Codat will contain information about time zones.  
        > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
      example: 2022-10-23T00:00:00Z
      title: Date time
      type: string
    Dispute:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            currency:
              $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
              description: Currency of the disputed transaction.
            disputedTransactions:
              $ref: "#/components/schemas/Transaction/definitions/transactionSourceRef"
              description: Link to the source event which triggered this transaction.
            dueDate:
              $ref: "#/components/schemas/DateTime"
              description: Date when the next action in the dispute resolution is due
            reason:
              description: Reason for the dispute
              examples:
                - Unhappy with product
              type: string
            status:
              $ref: "#/components/schemas/Dispute/definitions/disputeStatus"
            totalAmount:
              description: Total transaction amount that is under dispute.
              examples:
                - 194.12
                - -283.56
                - 0
              type: number
          required:
            - currency
          type: object
        - $ref: "#/components/schemas/CreatedDate"
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        disputeStatus:
          description: Current status of the dispute
          enum:
            - Won
            - Lost
            - Accepted
            - Processing
            - ChargeRefunded
            - EvidenceRequired
            - InquiryEvidenceRequired
            - InquiryProcessing
            - InquiryClosed
            - WaitingThirdParty
            - Unknown
          example: EvidenceRequired
          type: string
          x-internal: true
      description: |-
        A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example:  
        - They didn't receive an order.  
        - The product they received was different to the commerce store's description.  
        - They've been the victim of online fraud.  

        You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-disputes) for this data type.
      examples:
        - createdDate: 2021-03-22T14:39:55
          currency: GBP
          disputedTransactions:
            - id: e63ad857-7e12-4e64-9185-cdfd7c45d09d
              type: Order
          dueDate: 2021-03-29T14:39:55
          id: 03e608e3-bd1c-454f-8c2b-fb0133e43b95
          modifiedDate: 2022-02-02T11:02:45Z
          reason: Unhappy with product
          sourceModifiedDate: 2021-03-22T14:39:55
          status: InquiryEvidenceRequired
          totalAmount: -47.66
      title: Dispute
      type: object
    Disputes:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Dispute"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    HRef:
      properties:
        href:
          format: uri-reference
          type: string
      title: Hypertext reference
      type: object
      x-internal: true
    Links:
      examples:
        - current:
            href: /companies/{id}/data/{dataType}?page=1&pageSize=10
          self:
            href: /companies/{id}/data/{dataType}
      properties:
        current:
          $ref: "#/components/schemas/HRef"
        next:
          $ref: "#/components/schemas/HRef"
        previous:
          $ref: "#/components/schemas/HRef"
        self:
          $ref: "#/components/schemas/HRef"
      required:
        - self
        - current
      type: object
      x-internal: true
    Locations:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            address:
              $ref: "#/components/schemas/Address"
              description: Address associated with the location
            name:
              description: Name of this location
              type: string
          type: object
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        locationRef:
          description: Reference to the geographic location where the order was placed.
          properties:
            id:
              description: The unique identitifer of the location being referenced.
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
            name:
              description: Name of the location being referenced.
              type: string
          required:
            - id
            - name
          type: object
      description: |-
        The Locations datatype holds information on geographic locations at which stocks of products may be held, as referenced in the Products data type.

        Locations also holds information on geographic locations where orders were placed, as referenced in the Orders data type.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-locations) for this data type.
      examples:
        - address:
            city: London
            country: United Kingdom
            line1: Warner House
            line2: 98 Theobald's Road
            postalCode: WC1X 8WB
            region: ""
            type: Inventory
          id: "15"
          modifiedDate: 2020-08-12T14:37:37
          name: London Warehouse
          sourceModifiedDate: 2020-08-12T14:37:37
      title: Locations
      type: object
    LocationsResponse:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Locations"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    ModifiedDates:
      allOf:
        - properties:
            modifiedDate:
              $ref: "#/components/schemas/DateTime"
              description: The date on which this record was last modified in Codat.
          title: ModifiedDate
          type: object
          x-internal: true
        - properties:
            sourceModifiedDate:
              $ref: "#/components/schemas/DateTime"
              description: The date on which this record was last modified in the originating system
          title: Source Modified Date
          type: object
          x-internal: true
      x-internal: true
    Order:
      allOf:
        - properties:
            id:
              description: A unique, persistent identifier for this record
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
              x-codat-validation:
                - validator: UniqueWithinConnection
          required:
            - id
          type: object
          x-stoplight:
            id: 516bf0ecc4907
        - properties:
            closedDate:
              $ref: "#/components/schemas/DateTime"
              description: Date on which order was closed after the product was shipped, paid for, and any refund period had elapsed.
            country:
              description: |-
                The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part.

                Depending on the platform the value of this property will either be an <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes" target="_blank">ISO 3166</a> code (2-alpha or 3-alpha) or free-form text returned as a string name in our model. 

                For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/codat-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint.
              examples:
                - GBR
                - USA
                - ABW
              format: ISO3166 Alpha-3
              type: string
            currency:
              allOf:
                - $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
                - description: Currency in which the order was placed.
            customerRef:
              $ref: "#/components/schemas/Customer/definitions/customerRef"
            locationRef:
              $ref: "#/components/schemas/Locations/definitions/locationRef"
            orderLineItems:
              items:
                $ref: "#/components/schemas/Order/definitions/orderLineItem"
              type: array
            orderNumber:
              description: Friendly reference for the order in the commerce or point of sale platform.
              type: string
            payments:
              items:
                $ref: "#/components/schemas/Payment/definitions/paymentRef"
              type: array
            serviceCharges:
              items:
                $ref: "#/components/schemas/Order/definitions/serviceCharge"
              type: array
            totalAmount:
              description: Total amount of the order, including tax, net of any discounts and refunds.
              type: number
            totalDiscount:
              description: Total amount of discount applied to the order.
              type: number
            totalGratuity:
              description: Extra amount added to a bill.
              type: number
            totalRefund:
              description: Total amount refunded issued by a merchant on an order (always a negative value).
              type: number
            totalTaxAmount:
              description: Total amount of tax applied to the order.
              type: number
          type: object
        - $ref: "#/components/schemas/CreatedDate"
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        orderDiscountAllocation:
          properties:
            name:
              description: Name of the discount in the commerce or point of sale platform.
              example: Promotional Discount
              type: string
            totalAmount:
              description: Total amount of discount applied.
              example: 15.25
              type: number
          type: object
          x-internal: true
        orderLineItem:
          allOf:
            - $ref: "#/components/schemas/Order/allOf/0"
            - properties:
                discountAllocations:
                  items:
                    $ref: "#/components/schemas/Order/definitions/orderDiscountAllocation"
                  type: array
                productRef:
                  $ref: "#/components/schemas/Product/definitions/productRef"
                productVariantRef:
                  $ref: "#/components/schemas/Product/definitions/productVariantRef"
                quantity:
                  description: |
                    Number of units of the product sold.
                    For refunds, quantity is a negative value.
                  type: number
                taxPercentage:
                  description: Percentage rate (from 0 to 100) of any sale tax applied to the unit amount.
                  examples:
                    - 0
                    - 12.5
                    - "45.00"
                  type: number
                taxes:
                  description: Taxes breakdown as applied to order lines.
                  items:
                    $ref: "#/components/schemas/TaxComponent/definitions/taxComponentAllocation"
                  type: array
                totalAmount:
                  description: Total price of the line item, including discounts, tax and minus any refunds.
                  type: number
                totalTaxAmount:
                  description: Total amount of tax applied to the line item.
                  type: number
                unitPrice:
                  description: Price per unit of goods or service.
                  type: number
              type: object
        serviceCharge:
          properties:
            description:
              description: Service charges for this order.
              example: A service charge
              type: string
            quantity:
              description: The number of times the charge is charged.
              examples:
                - 1
                - 12
                - 45
              type: integer
            taxAmount:
              description: Amount of the service charge that is tax.
              examples:
                - 0
                - 12.5
                - 45
              type: number
            taxPercentage:
              description: Percentage rate (from 0 to 100) of any tax applied to the service charge.
              examples:
                - 0
                - 12.5
                - 45
              type: number
            taxes:
              description: Taxes breakdown as applied to service charges.
              items:
                $ref: "#/components/schemas/TaxComponent/definitions/taxComponentAllocation"
              type: array
            totalAmount:
              description: Total service charge, including taxes.
              examples:
                - 0
                - 12.5
                - 45
              type: number
            type:
              $ref: "#/components/schemas/Order/definitions/serviceChargeType"
          type: object
          x-internal: null
        serviceChargeType:
          description: The type of the service charge.
          enum:
            - Generic
            - Shipping
            - Overpayment
            - Unknown
          example: Overpayment
          type: string
          x-internal: true
      description: |
        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. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR).

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-orders) for this data type.
      examples:
        - country: CAN
          createdDate: 2021-03-28T03:00:14
          currency: CAD
          customerRef:
            id: 2634d180-7205-43f0-a73d-84af6443a005
            name: Emmy Roberts
          id: 01e63721-1205-478e-8503-9d8bf8a93f44
          locationRef:
            id: 47bbffc7-c045-4b0f-a3bb-ecf1f669edfa
          modifiedDate: 2022-02-02T11:02:45Z
          orderLineItems:
            - discountAllocations: []
              id: 116113a6-54d3-4624-ba73-26a77a5ffd51
              productRef:
                id: ac186646-41f2-4280-afea-1012c59459ab
                name: Intelligent Concrete Salad
              productVariantRef:
                id: f9ca9de5-9e31-460d-ac81-368f4e7c8fc0
                name: Small Incredible Wooden Soap
              quantity: 1
              taxPercentage: 20
              taxes:
                - taxAmount: ""
                  taxComponentRef:
                    id: "72"
                    name: Sales Tax
                - taxAmount: ""
                  taxComponentRef:
                    id: "72"
                    name: City Tax
              totalAmount: 12
              totalTaxAmount: 2
              unitPrice: 10
          orderNumber: "99123956"
          payments:
            - amount: 12
              createdDate: 2021-03-28T03:00:14
              currency: CAD
              dueDate: 2021-04-04T03:00:14
              id: defdceb6-83a3-4b7d-a74e-e9ef947d5f48
              modifiedDate: 2022-02-02T11:02:45
              status: Unknown
              type: Paypal
          serviceCharges:
            - description: Service Charge
              quantity: 1
              taxAmount: 0.2
              taxPercentage: 20
              taxes:
                - taxAmount: ""
                  taxComponentRef:
                    id: "72"
                    name: Service Tax
              totalAmount: 1.2
              type: Generic
          sourceModifiedDate: 2021-03-28T03:00:14
          totalAmount: 12
          totalDiscount: 0
          totalGratuity: 1
          totalRefund: 0
          totalTaxAmount: 2
      title: Order
      type: object
    Orders:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Order"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    PagingInfo:
      examples:
        - _links:
            current:
              href: /companies/{id}/data/{dataType}?page=1&pageSize=10
            pageNumber: 1
            pageSize: 10
            self:
              href: /companies/{id}/data/{dataType}
            totalResults: 1
      properties:
        _links:
          $ref: "#/components/schemas/Links"
        pageNumber:
          type: integer
        pageSize:
          type: integer
        totalResults:
          type: integer
      required:
        - pageNumber
        - pageSize
        - totalResults
        - _links
      type: object
      x-internal: true
    Payment:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            amount:
              description: Payment Amount (including gratuity)
              examples:
                - 194.12
                - -283.56
                - 0
              type: number
            currency:
              $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
              description: Currency in which the payment was made
            dueDate:
              $ref: "#/components/schemas/DateTime"
              description: Date by which payment must be made
            paymentMethodRef:
              $ref: "#/components/schemas/PaymentMethod/definitions/paymentMethodRef"
            paymentProvider:
              description: Service provider of the payment, if applicable.
              examples:
                - Amazon Pay
                - Checkout.com
                - SagePay
              type: string
            status:
              $ref: "#/components/schemas/Payment/definitions/paymentStatus"
          type: object
        - $ref: "#/components/schemas/CreatedDate"
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        paymentRef:
          allOf:
            - $ref: "#/components/schemas/Order/allOf/0"
            - properties:
                amount:
                  description: Payment Amount (including gratuity).
                  examples:
                    - 194.12
                    - -283.56
                    - 0
                  nullable: true
                  type: number
                currency:
                  $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
                  description: Currency in which the payment was made.
                dueDate:
                  $ref: "#/components/schemas/DateTime"
                  description: Date by which payment must be made
                paymentProvider:
                  description: Service provider of the payment, if applicable.
                  examples:
                    - Amazon Pay
                    - Checkout.com
                    - SagePay
                  type: string
                status:
                  $ref: "#/components/schemas/Payment/definitions/paymentStatus"
                type:
                  $ref: "#/components/schemas/Payment/definitions/paymentType"
              type: object
            - $ref: "#/components/schemas/CreatedDate"
            - $ref: "#/components/schemas/ModifiedDates"
          x-internal: true
        paymentStatus:
          description: Status of the payment
          enum:
            - Pending
            - Authorized
            - Paid
            - Failed
            - Cancelled
            - Unknown
          type: string
          x-internal: true
        paymentType:
          description: Status of the payment
          enum:
            - Cash
            - Card
            - Invoice
            - OnlineCard
            - Swish
            - Vipps
            - Mobile
            - StoreCredit
            - Paypal
            - Custom
            - Prepaid
            - Unknown
          example: Cash
          nullable: true
          type: string
          x-internal: true
      description: |-
        Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status.

        Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`.

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

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-payments) for this data type.
      title: Payment
      type: object
    PaymentMethod:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            name:
              description: The name of the PaymentMethod
              example: Alipay
              type: string
            status:
              $ref: "#/components/schemas/PaymentMethod/definitions/paymentMethodStatus"
          type: object
        - $ref: "#/components/schemas/ModifiedDates"
      definitions:
        paymentMethodRef:
          description: The payment method the payment is linked to in the commerce platform.
          example:
            id: EILBDVJVNUAGVKRQ
            name: AliPay
          properties:
            id:
              description: The unique identitifer of the location being referenced.
              type: string
            name:
              description: Name of the location being referenced.
              type: string
          required:
            - id
            - name
          type: object
        paymentMethodStatus:
          description: Status of the Payment Method
          enum:
            - Active
            - Archived
            - Unknown
          example: Active
          type: string
      description: |-
        A Payment Method represents the payment method(s) used to make payments.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-paymentMethods) for this data type.
      title: Payment Method
      type: object
    PaymentMethods:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/PaymentMethod"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    Payments:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Payment"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    PhoneNumber:
      definitions:
        phoneNumberType:
          description: The type of phone number
          enum:
            - Primary
            - Landline
            - Mobile
            - Fax
            - Unknown
          type: string
      properties:
        number:
          description: A phone number.
          examples:
            - +44 25691 154789
            - (877) 492-8687
            - 01224 658 999
          nullable: true
          type: string
        type:
          $ref: "#/components/schemas/PhoneNumber/definitions/phoneNumberType"
      required:
        - number
        - type
      title: Phone
      type: object
      x-internal: true
    Product:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            categorization:
              description: Retail category that the product is assigned to
              examples:
                - Hardware
                - Software
                - Support Services
              type: string
            description:
              description: Description of the product recorded in the commerce or point of sale platform.
              examples:
                - 1tb Western Digital Hard Drive
                - Install of Windows 11 (Professional Edition)
                - 1 hour of support from an agent (phone or remote)
              type: string
            isGiftCard:
              description: |
                Whether the product represents a gift card or voucher that
                can be redeemed in the commerce or POS platform
              type: boolean
            name:
              description: Name of the product in the commerce or POS system
              examples:
                - Hard Drive
                - Windows Installation
                - Software Support (Hourly)
              type: string
            variants:
              items:
                $ref: "#/components/schemas/Product/definitions/productVariant"
              type: array
          type: object
      definitions:
        productInventory:
          properties:
            locations:
              items:
                $ref: "#/components/schemas/Product/definitions/productInventoryLocation"
              type: array
            totalQuantity:
              nullable: true
              type: number
          title: Product Inventory
          type: object
          x-internal: true
        productInventoryLocation:
          properties:
            locationRef:
              $ref: "#/components/schemas/Locations/definitions/locationRef"
            quantity:
              type: number
          title: Product Inventory Location
          type: object
          x-internal: true
        productPrice:
          properties:
            currency:
              $ref: "#/components/schemas/Transaction/allOf/1/properties/currency"
              nullable: true
            unitPrice:
              type: number
          title: Product Price Variant
          type: object
          x-internal: true
        productRef:
          description: Reference that links the line item to the correct product details.
          properties:
            id:
              description: The unique identitifer of the product being referenced.
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
            name:
              description: Name of the product being referenced.
              type: string
          required:
            - id
            - name
          type: object
        productVariant:
          allOf:
            - $ref: "#/components/schemas/Order/allOf/0"
              description: Identifier of the product variant, unique to the company.
            - properties:
                barcode:
                  description: Unique product number of the variant. This might be a barcode, UPC, ISBN, etc.
                  examples:
                    - "564158468416486458646886484"
                    - CSE370
                  type: string
                inventory:
                  description: Information about the total inventory as well as the locations inventory is in.
                  items:
                    $ref: "#/components/schemas/Product/definitions/productInventory"
                  type: array
                isTaxEnabled:
                  description: Whether sales taxes are enabled for this product variant.
                  type: boolean
                name:
                  description: Name of the product recorded in the commerce or point of sale platform.
                  examples:
                    - Red Coat
                    - Black Coat
                    - Large Brown Hat
                  type: string
                prices:
                  description: Prices for the product variants in different currencies.
                  items:
                    $ref: "#/components/schemas/Product/definitions/productPrice"
                  type: array
                shippingRequired:
                  description: Indicates whether or not the product requires physical delivery.
                  type: boolean
                sku:
                  description: SKU (stock keeping unit) of the variant, as defined by the merchant.
                  examples:
                    - Coat-Red-Lrg
                    - Coat-Black-Md
                    - LargeBrownHat
                    - A725BA2
                  type: string
                status:
                  $ref: "#/components/schemas/Product/definitions/productVariantStatus"
                unitOfMeasure:
                  description: Unit of measure for the variant, such as `kg` or `meters`.
                  examples:
                    - kg
                    - m
                    - meters
                  type: string
                vatPercentage:
                  description: VAT rate for the product variant if sales taxes are enabled.
                  examples:
                    - 12.5
                    - 0
                    - 20
                  type: number
            - $ref: "#/components/schemas/CreatedDate"
            - $ref: "#/components/schemas/ModifiedDates"
          description: |
            Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors.
          title: Product Variant
          x-internal: true
        productVariantRef:
          description: Reference that links the line item to the specific version of product that has been ordered.
          properties:
            id:
              description: The unique identitifer of the product variant being referenced.
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
            name:
              description: Name of the product variant being referenced.
              type: string
          required:
            - id
            - name
          title: Product Variant Ref
          type: object
        productVariantStatus:
          enum:
            - Unknown
            - Published
            - Unpublished
          type: string
          x-internal: true
      description: |
        A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-products) for this data type.
      title: Product
      type: object
    ProductCategories:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/ProductCategory"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    ProductCategory:
      allOf:
        - properties:
            ancestorRefs:
              description: A collection of parent product categories implicitly ordered with the immediate parent last in the list.
              items:
                $ref: "#/components/schemas/RecordRef"
              type: array
            hasChildren:
              description: A boolean indicating whether there are other product categories beneath this one in the hierarchy.
              type: boolean
            id:
              description: The unique identifier of the product category
              example: '"102"'
              type: string
            name:
              description: The name of the product category
              example: Entertainment
              type: string
          type: object
        - $ref: "#/components/schemas/ModifiedDates"
      description: |-
        Product categories are used to classify a group of products together, either by type (e.g. "Furniture"), or sometimes by tax profile.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-productCategories) for this data type.
      examples:
        - productCategories:
            - ancestorRefs: []
              hasChildren: true
              id: "100"
              modifiedDate: 2022-01-01T12:00:00Z
              name: Entertainment
              sourceModifiedDate: 2021-10-01T12:53:21Z
            - ancestorRefs:
                - id: "100"
                  name: Entertainment
              hasChildren: true
              id: "101"
              modifiedDate: 2022-01-01T12:00:00Z
              name: Cinema
              sourceModifiedDate: 2021-10-01T12:55:02Z
            - ancestorRefs:
                - id: "100"
                  name: Entertainment
                - id: "101"
                  name: Cinema
              hasChildren: false
              id: "102"
              modifiedDate: 2022-01-01T12:00:00Z
              name: Movie
              sourceModifiedDate: 2021-12-25T12:00:00Z
      title: Product Category
      type: object
    Products:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Product"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    RecordRef:
      description: ""
      properties:
        id:
          description: The unique identitifer of the record being referenced
          examples:
            - 13d946f0-c5d5-42bc-b092-97ece17923ab
            - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
            - 7110701885
            - EILBDVJVNUAGVKRQ
          type: string
        type:
          description: The type of record being referenced.
          type: string
      required:
        - id
        - type
      title: Record Ref
      type: object
      x-internal: true
    TaxComponent:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            isCompound:
              description: The Boolean flag to indicate when a Tax Rate Component compounds on a sale.
              examples:
                - true
                - false
              type: boolean
            name:
              description: Name of the Tax Rate Component in the source commerce platform.
              example: Sales Tax
              type: string
            rate:
              description: Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00).
              examples:
                - 0.15
                - 0.2
              format: float
              type: number
          type: object
        - $ref: "#/components/schemas/ModifiedDates"
          required:
            - name
      definitions:
        taxComponentAllocation:
          properties:
            rate:
              description: Tax amount on order line sale as available from source commerce platform.
              nullable: true
              type: number
            taxComponentRef:
              $ref: "#/components/schemas/TaxComponent/definitions/taxComponentRef"
          title: Tax Component Allocation
          type: object
        taxComponentRef:
          description: Taxes rates reference object depending on the rates being available on source commerce package.
          properties:
            id:
              description: The unique identitifer of the tax component being referenced.
              examples:
                - 13d946f0-c5d5-42bc-b092-97ece17923ab
                - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                - 7110701885
                - EILBDVJVNUAGVKRQ
              type: string
            name:
              description: Name of the tax component being referenced.
              type: string
          required:
            - id
            - name
          type: object
      description: |-
        The Tax Components endpoints return tax rates data from the commerce platform, including tax rate names and values. This is to support the mapping of tax rates from the commerce platform to those in the accounting platform.

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-disputes) for this data type.
      examples:
        - id: 13d946f0-c5d5-42bc-b092-97ece17923ab
          isCompound: true
          modifiedDate: 2022-10-23T00:00:00Z
          name: Sales Tax (15%)
          rate: 0.15
          sourceModifiedDate: 2022-10-23T00:00:00Z
      title: Tax Component
      type: object
    TaxComponents:
      properties:
        taxComponents:
          items:
            $ref: "#/components/schemas/TaxComponent"
          type: array
      type: object
      x-internal: true
    Transaction:
      allOf:
        - $ref: "#/components/schemas/Order/allOf/0"
        - properties:
            currency:
              description: |-
                The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

                ## Unknown currencies

                In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. 

                There are only a very small number of edge cases where this currency code is returned by the Codat system.
              examples:
                - GBP
                - USD
                - EUR
              format: ISO4217
              title: Currency
              type: string
              x-internal: true
            subType:
              description: Non-standardised transaction type data from the commerce platform
              examples:
                - CardPayment
                - Invoice payment
              type: string
            totalAmount:
              description: The total transaction amount
              examples:
                - 194.12
                - -283.56
                - 0
              type: number
            transactionSourceRef:
              allOf:
                - $ref: "#/components/schemas/Transaction/definitions/transactionSourceRef"
              description: Link to the source event which triggered this transaction
            type:
              $ref: "#/components/schemas/Transaction/definitions/transactionType"
          type: object
        - allOf:
            - allOf:
                - $ref: "#/components/schemas/CreatedDate"
                - properties:
                    sourceCreatedDate:
                      $ref: "#/components/schemas/DateTime"
                      description: The date on which this record was created in the originating system
                  type: object
                  x-stoplight:
                    id: gdyjg7bg783br
              type: object
              x-stoplight:
                id: c590b4405180f
            - $ref: "#/components/schemas/ModifiedDates"
          x-stoplight:
            id: 9e815c1766554
      definitions:
        transactionSourceRef:
          allOf:
            - $ref: "#/components/schemas/RecordRef"
            - properties:
                type:
                  $ref: "#/components/schemas/Transaction/definitions/transactionSourceType"
              type: object
          title: Transaction Source Reference
          x-internal: true
        transactionSourceType:
          enum:
            - Fee
            - Order
            - Payment
            - ServiceCharge
            - Unknown
          type: string
          x-internal: true
        transactionType:
          description: |-
            The type of the platform transaction:  
            - `Unknown`  
            - `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account.  
            - `Payment` — Credit and debit card payments.  
            - `PaymentFee` — Payment provider's fee on each card payment.  
            - `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller.  
            - `Payout` — Transfer of funds from the seller's merchant account to their bank account.  
            - `Refund` — Refunds to a customer's credit or debit card.  
            - `Transfer` — Secure transfer of funds to the seller's bank account.  
          enum:
            - Payment
            - Refund
            - Payout
            - FailedPayout
            - Transfer
            - PaymentFee
            - PaymentFeeRefund
            - Unknown
          type: string
          x-iternal: true
      description: |-
        Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees.

        You can use data from the Transactions endpoints to calculate key metrics, such as:  
        - Transaction volumes  
        - Average transaction volume  
        - Average transaction value  
        - Returns  
        - Payouts

        Explore our [data coverage](https://knowledge.codat.io/supported-features/commerce?view=tab-by-data-type&dataType=commerce-transactions) for this data type.
      examples: []
      title: Transaction
      type: object
    Transactions:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/Transaction"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
  securitySchemes:
    auth_header:
      description: The word "Basic" followed by a space and your API Key, base64 encoded, which can be found [here](https://app.codat.io/developers/api-keys)
      in: header
      name: Authorization
      type: apiKey
x-speakeasy-retries:
  backoff:
    exponent: 1.5
    initialInterval: 500
    maxElapsedTime: 3600000
    maxInterval: 60000
  retryConnectionErrors: true
  statusCodes:
    - 408
    - 429
    - 5XX
  strategy: backoff
x-stoplight:
  id: 32pxuah6hmb9a
