Skip to main content

Working with Products and Categories

Product Cart and Product Categories

For ease of integration and further work with the loyalty program, mechanisms for loading and managing product nomenclature have been implemented in the Sailplay API, allowing you to transfer the product structure organized within your system.

As the main identifier when working with products, you must pass the SKU parameter — the identifier used in your inventory system.

For each category or product, you can specify:

  • Identifier (SKU) (mandatory)
  • Product / product category name
  • Conversion coefficient of rubles to points for purchasing this product or purchasing a product from this category

Product Categories

By default, a root category is created in the Sailplay account, within which nested categories can be created.

In all requests, in addition to application authorization data, you must pass:

  • category name
  • category SKU

If necessary, you can specify a conversion coefficient of rubles to points for a category by passing it in the points_rate parameter.

To create a nested category, you must pass the parent category SKU in the parent_sku parameter.

  • Creating a category: /reference/basket-categories-add
  • Editing a category: /reference/basket-categories-edit
  • Getting a list of categories: /reference/basket-categories-list

To "reset" a parameter value (e.g., conversion coefficient), it is enough to pass an empty string.


Products

API methods for working with products provide the same capabilities as for categories:

  • Creating a product: /reference/basket-products-add
  • Editing a product: /reference/basket-products-edit
  • Getting a list of products: /reference/basket-products-list

The main difference is the need to link the product to a category — the category_sku parameter is used for this.


Important

When passing product or category SKUs in requests for:

  • purchase creation (/reference/purchases-new)
  • promotion calculation (/reference/marketing-actions-calc)

if they are missing in Sailplay, the following rules apply:

  • Products with unknown SKUs are created automatically (without name and attributes).
  • If a product does not have its own conversion coefficient, the category coefficient is used.
  • If no coefficient is set for either the product or the category, the standard account coefficient is applied.
  • If the same product is passed in the cart several times, its amounts are preliminary summed up.