Content >

Get Sale History

Get Sale History

Feature Feature: Sales
Editions Editions: Cloud, Corporate


The sales endpoint can be queried to retrieve a history of sale transactions made through the Fusion Register and Fusion POS.

Unless otherwise noted, results obtained through this endpoint are ordered by transaction ID (id).

The endpoint requires ViewSales permissions to access.

Examples

Data Sync

The endpoint supports data synchronization using since and until parameters. See Since & Until parameters for more information. Results obtained through the since parameter are sorted by modification date.

Contact Fusion Support if you are writing an integration to post Fusion sales data to an ERP or accounting system. There may be some additional items to consider for optimizing how your integration can handle record modifications and updating posting status.

List Sales for Customer

Return a list of sales by customer:

query MyQuery {
  sale(customerId: "03945153273576554615") {
    hasMoreResults
    results {
      id
      registerCode
      tranNo
      customerId
    }
  }
}

The hasMoreResults value indicates whether more results are available, which you set the skip and first parameters to get the next page of data. This example would get the next page of data, assuming a page size of 20 rows:

query MyQuery {
  sale(
    customerId: "03945153273576554615",
    skip: 20,
    first: 20
  ) {
    hasMoreResults
    results {
      id
      registerCode
      tranNo
      customerId
    }
  }
}

List Sales by Date Range

Return a list of sales for a specific date:

query MyQuery {
  sale(fromDate: "2020-08-01", toDate: "2020-09-01") {
    hasMoreResults
    results {
      id
      registerCode
      tranNo
      customerId
      saleDate
    }
  }
}

Note:

  • fromDate is inclusive, and toDate is exclusive – this query will return transactions for all of August 2020.
  • Results are sorted by transaction ID.
  • Sales transactions from the Fusion Register are entered with just the date component, as a local date. POS will report dates as UTC. For this reason, you may see a time zone offset in your date results.

Get Sale by ID

Return a sale by its transaction ID, with most of the possible fields specified in the query:

query AllCustomers {
  sale(id: "3945153273576554499") {
    results {
      id
      warehouseCode
      registerCode
      tranNo
      type
      saleDate
      channelCode
      clerkCode
      postStatus
      extDocType
      extDocNo
      subTotal
      tax
      taxExempt
      customerId
      customer {
        firstName
        lastName
        contactPhone {
          display
        }
        email
        classCode
      }
      depositTotal
      deposits {
        amount
        order {
          id
        }
      }
      discountTotal
      discounts {
        name
        flatAmount
        percentAmount
      }
      lineItems {
        lineNumber
        sku
        name
        quantity
        uom
        unitPrice
        extPrice
        isRefund
        shipViaCode
        unitCost
        warehouseCode
        itemDiscountAllocated
        saleDiscountAllocated
        discounts {
          name
          flatAmount
          percentAmount
        }
        attributes {
          comment
          serialLotNo
        }
        tax {
          scheduleCode
          itemCode
          rate
          amount
        }
        commissions {
          salespersonCode
          rate
        }
      }
      shipments {
        customerName
        phone {
          display
        }
        attention
        address {
          addressLine1
          addressLine2
          addressLine3
          city
          stateCode
          state
          countryCode
          country
          zip
        }
      }
      payments {
        payTypeCode
        tenderAmount
        changeTypeCode
        changeAmount
      }
    }
  }
}

This example shows how a rich set of nested information can be returned in the query results. In particular, note how customer and deposits/order refer to other entities outside the transaction.

Other

The above examples are not an exhaustive list of the types of queries that can be performed against this endpoint. Additional parameters are available in the online documentation (accessed through the GraphiQL tool built into POS).