Manage products

Product is an intentionally minimal concept in Brink Commerce API. Products require minimal information to create a successful transaction. Additional data can be populated for other reasons, such as campaign management and post-purchase processing.

Required

A product needs both a product and a productvariant to be sellable. See Product types

Best-practice

You need minimal information to create a product:

  • SKU/ID
  • Stock level
  • Price or promotional price
  • Type
  • Category

However, to create a better experience for customers, make sure to also add:

  • Image (for the checkout)
  • Display name (for the checkout, admin interface, loyalty systems, and PSPs)
  • The slug (for links)
  • Product attributes (for easy discount management in the checkout)

There are different ways you can use to create a product in Brink Commerce API. Here are some examples:

Create product

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/productv1/products \
  --header 'content-type: application/json' \
  --header 'x-api-key: ${product api key}' \
  --data '[{
    "id": "product-id",
    "name": "Black socks",
    "type": "product",
    "category": "Socks",
  }]'

Create productVariant related to the product

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/productv1/products \
  --header 'content-type: application/json' \
  --header 'x-api-key: ${product api key}' \
  --data '[{
    "id": "product-variant-id",
    "name": "Black socks size 9",
    "type": "productVariant",
    "category": "Socks",
    "price": [{
        "currencyUnit": "SEK",
        "amount": 20000
    }],
    "relatedProduct": "product-id"
  }]'

Create add-on

Important

addon links to product, not productVariant.

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/productv1/products \
  --header 'content-type: application/json' \
  --header 'x-api-key: ${product api key}' \
  --data '[{
    "id": "addon-id",
    "name": "Engraving",
    "type": "addon",
    "category": "Add-on",
    "price": [{
        "currencyUnit": "SEK",
        "amount": 5000
    }],
  }]'
Hint

It is also possible to link add-ons to a product after it has been created.

Updating a product

It's of course possible to update already created products in Brink Commerce API. You can also link Product-Addons to an existing product.

Update product

curl --request PUT \
  --url https://api.${env}.brinkcommerce.com/productv1/products \
  --header 'content-type: application/json' \
  --header 'x-api-key: ${product api key}' \
  --data '[
    {
      "id": "product-id",
      "slug": "/t-shirt"
    }
  ]'

Link add-ons to a product

curl --request PUT \
  --url https://api.${env}.brinkcommerce.com/productv1/products \
  --header 'content-type: application/json' \
  --header 'x-api-key: ${product api key}' \
  --data '[{
    "id": "product-id",
    "compatibleAddons": [ "addon-id" ]
  }]'
Hint

It is also possible to link add-ons to a product when first creating the product by adding the compatibleAddons field.

Continue reading

Next, we will look at searching for products