In this topic:

Related products

You can associate products in a number of ways, such as recommended, dependable, incompatible, and so on. For example, you can mark one product as recommended for another one, as your customers may be interested in purchasing this one too.

Here are the types of product relations that you can create with Billing API.

  • CHILD, PARENT—the related product is a "child" Product to a primary "parent" Product and is NOT a stand-alone product.
  • INCOMPATIBLE—the related product is incompatible with the primary Product and the customer should not make the mistake of purchasing the secondary related product to use with the primary one.
  • RECOMMENDED—the related product is recommended, but not required when purchasing the primary one.
  • DEPENDENT—products are depended on each other, for example product of the same series, but they can be bought separately, if needed.
  • REQUIRED—the products which customers cannot buy separately, ones that always go together.
  • ADDON—one product is an add-on of another product of the subscription type which is its parent one. With add-ons, you can define additional services for base ones.

To see how it works, let’s use two following products and associate them:

  • Product 1 with ID=24362
  • Product 2 with ID=24364

Associating related products

To associate the related products, use the following endpoint specifying the desired type and scope of relation in the request payload. Products can be related in the scope of an order or account. When you indicate the "order" scope of product relation, products that you want to relate should be in the same order. While "account" relation scope means that products should belong to the same billing account but can be in different orders.

POST https://example-tract-api.com/billing/2/products/{id}/relations

Request

{
  "product": 
  {
    "id": "24364"
  },	
 "product_relation_type": "REQUIRED",
 "scope": "ACCOUNT"
}

Response


{
  "id": "30866",
  "product": {
     "product_type": "customer-subscription",
     "id": "24364",
     "name": "Product 2"
   },
   "product_relation_type": "REQUIRED",
   "scope": "ACCOUNT"
}

Removing product association

To remove the product relation that you no longer need, use the following endpoint:

DELETE https://example-tract-api.com/billing/2/products/{id}/relations

Top