Products

These events are emitted by the Inventory API (btrz-api-inventory) when products are created or updated. Events are emitted from the product data service when a product is saved (POST) or updated (PUT).

Events

Action Event name Endpoint
Create a new product product.created POST /products
Update an existing product product.updated PUT /products/:productId

Payload example created

{
  "attemptId": "436b6372-f2ce-4c95-9669-82592fcd1e98",
  "created": 1623859265,
  "data": {
    "_id": "60ca203a10e7dd421be4a3bd",
    "accountId": "52a377ec430c7d4e220001fc",
    "availableChannels": {
      "inPerson": true,
      "online": false
    },
    "description": "",
    "icon": "fa-ship",
    "isBundle": false,
    "isFlexPass": false,
    "isParcel": false,
    "isPass": false,
    "lexiconKeys": {
      "description": "product-description-52a377ec430c7d4e220001fc-d2c86151-70a4-48ad-8a25-08bcbcc3120c",
      "name": "product-name-52a377ec430c7d4e220001fc-1afbceeb-8035-4e64-9aea-74c9764800df",
      "prodTypeName_paid in": "product-prodTypeName_paid in-52a377ec430c7d4e220001fc-f43702ea-1b24-4d05-ab14-6397cbc95d70",
      "terms": "product-terms-52a377ec430c7d4e220001fc-02050f2f-8ae1-4251-8d7d-88635113b1df"
    },
    "name": "ttt",
    "openReturn": false,
    "openReturnBundleId": "",
    "ord": 500,
    "products": [
      {
        "channels": {
          "backoffice": true,
          "websales": true
        },
        "expire": 0,
        "expireUnit": "days",
        "name": "Paid In",
        "priceAdjustment": {
          "times": 1,
          "type": "",
          "value": 0
        },
        "qty": {
          "max": 1,
          "min": 1
        },
        "returnDateDefault": false,
        "type": "paid in",
        "uses": 1
      }
    ],
    "readOnly": true,
    "taxProductFrom": "any",
    "terms": "",
    "type": "paid_in"
  },
  "event": "product.created",
  "id": "06b4e0c0-d125-4b16-b83e-21d023869d21",
  "livemode": true
}

Field descriptions — envelope and data (product.created)

Field Type Description
attemptId string Id of the delivery attempt.
created number Unix timestamp when the event was created.
event string Event name: product.created.
id string Unique id of the webhook event.
livemode boolean Whether the event is from live or test mode.
data object The product that was created (Product model).
data._id string Product id (24 hex characters).
data.accountId string Account (provider) id.
data.name string Name of the product.
data.type string Computer-friendly product type (e.g. paid_in).
data.ord number Order used to show the product in product pages.
data.availableChannels object Channels where the product is available (e.g. inPerson, online).
data.products array Child product types (ProductProducts).
data.lexiconKeys object Lexicon keys for translatable fields (name, description, terms, etc.).
data.icon string Font-awesome CSS class for the product icon.
data.description string Short description for the product.
data.terms string Terms and conditions.
data.taxProductFrom string How taxes are applied (e.g. origin, destination, any).
data.isBundle boolean Whether the product is a bundle.
data.isFlexPass boolean Whether the product is a flex pass.
data.isParcel boolean Whether the product is a parcel.
data.isPass boolean Whether the product is a pass.
data.readOnly boolean Whether the product can be shown but not purchased.
data.openReturn boolean
data.openReturnBundleId string

Payload example updated

{
  "attemptId": "8ed3162d-573b-4713-95c3-dec92b843ec1",
  "created": 1623859316,
  "data": {
    "_id": "60ca203a10e7dd421be4a3bd",
    "accountId": "52a377ec430c7d4e220001fc",
    "availableChannels": {
      "inPerson": true,
      "online": false
    },
    "comments": "",
    "createdAt": {
      "offset": 0,
      "value": "2021-06-16T16:01:08.552Z"
    },
    "daysInAdvance": "",
    "deleted": false,
    "description": "",
    "dow": "",
    "family": null,
    "icon": "fa-ship",
    "isBundle": false,
    "isParcel": false,
    "lexiconKeys": {
      "description": "product-description-52a377ec430c7d4e220001fc-d2c86151-70a4-48ad-8a25-08bcbcc3120c",
      "name": "product-name-52a377ec430c7d4e220001fc-1afbceeb-8035-4e64-9aea-74c9764800df",
      "prodTypeName_paid in": "product-prodTypeName_paid in-52a377ec430c7d4e220001fc-f43702ea-1b24-4d05-ab14-6397cbc95d70",
      "terms": "product-terms-52a377ec430c7d4e220001fc-02050f2f-8ae1-4251-8d7d-88635113b1df"
    },
    "name": "ttt",
    "notifications": "",
    "openReturn": false,
    "openReturnBundleId": "",
    "ord": 500,
    "pricingType": "",
    "products": [
      {
        "channels": {
          "backoffice": true,
          "websales": true
        },
        "expire": 0,
        "expireUnit": "days",
        "name": "Paid In",
        "priceAdjustment": {
          "times": 1,
          "type": "",
          "value": 0
        },
        "qty": {
          "max": 1,
          "min": 1
        },
        "returnDateDefault": false,
        "type": "paid in",
        "uses": 1
      }
    ],
    "readOnly": true,
    "requiredInsurance": "",
    "serviceTypes": "",
    "shipTrackIntegration": "",
    "shipTrackIntegrationParams": "",
    "taxProductFrom": "any",
    "terms": "terms",
    "type": "paid_in",
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-16T16:01:08.553Z"
    }
  },
  "event": "product.updated",
  "id": "04ffc07f-7c6c-49fe-8322-8ceeb5ac4c79",
  "livemode": true
}

Field descriptions — data (product.updated)

Same envelope fields as above. The data object is the updated Product; it may include additional fields such as:

Field Type Description
data.createdAt object BzDate: when the product was created.
data.updatedAt object BzDate: when the product was last updated.
data.deleted boolean Whether the product is marked deleted.
data.family string Product family.
data.pricingType string Pricing type.
data.comments string
data.daysInAdvance string
data.dow string
data.notifications string
data.requiredInsurance string
data.serviceTypes string
data.shipTrackIntegration string
data.shipTrackIntegrationParams string