Setting up the Brink environment

First, we must set up a Store and Inventory. The Store is easiest to set up in the Brink Merchant Portal. Brink Merchant Portal is just an interface we've created to cover operations you seldom do and give you a view of what you've created in Brink Commerce API.

Brink Merchant Portal uses Brink Commerce API to perform all operations, so the same end-points are therefore available to you if you rather do the setup through API calls.

Login to the Brink Merchant Portal for the assigned environment https://admin.{environmentName}.brinkcommerce.com/admin with the provided login credentials.

Brink Merchant Portal - Login screen

Brink Merchant Portal - Login


Create a store

To create a Store, navigate to Configurations -> Stores -> + Add. We use ISO-standards for the following input data:

Brink Merchant Portal - Add store

Brink Merchant Portal - Add store

Authentication

Brink Commerce API requires a custom HTTP header, x-api-key, for authentication in every API request.

GET /products HTTP/1.1
header 'content-type: application/json'
header 'x-api-key: ${authorisation-key-supplied-by-Brink}'

Create an inventory

You need to create the Inventory through Brink Commerce API, with an HTTP POST towards /stockv2/inventories

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/stockv2/inventories \
  --header 'x-api-key: ${api-key}' \
  --data '{
    "name": "Global warehouse",
    "id": "global_warehouse_id"
  }'

You also need to assign the Inventory to the Store with a HTTP POST towards /stockv2/stores/{storeId}/inventories

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/stockv2/stores/${storeId}/inventories \
  --header 'x-api-key: ${api-key}' \
  --data '{
    "inventoryId": "global_warehouse_id",
    "priority": 0
  }'

Create a shipping option

The fastest way to create a shipping option is through Brink Merchant Portal, by navigating to Configurations -> Shipping options -> + Add.

Brink Merchant Portal - Add shipping option

Brink Merchant Portal - Add shipping option

For each Shipping option, there are translation options for name/description, and also different prices for each currency.

Currently, there is no support for uploading an image/logo/icon for each Shipping option, but you can provide a URL to the image, and it will be used in the Checkout representing the option provider.


Create a product

The create a fully purchasable product we need to first create a product and a productVariant. You can read more about the different product types here.

To create a product with the type product we make a HTTP POST towards /productv1/products

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

The productVariant is created towards the same end-point as above.

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

The price amount in Brink Commerce API is defined as an integer and represents the currency with an exponent of 2, e.g. $5 is specified as "amount": 500.


Set stock

The stock is set on the purchasable product with the type productVariant and for a specific inventory, through a HTTP POST towards /stockv2/products/{productId}/inventories/{inventoryId}

curl --request POST \
  --url https://api.${env}.brinkcommerce.com/stockv2/products/${productId}/inventories/${inventoryId} \
  --header 'x-api-key: ${api-key}' \
  --data '{
    "quantity": 0
  }'

Next step: Make a purchase

With your Brink environment set up, it's time to start integrating with the API and create your first order.