At this point, it is possible to set many different pricing, such as, for example, disscount price, and it is also possible to set according to which criteria the price should be calculated. In addition, we can receive information about the currently functioning pricing and criteria according to which the price is calculated, and we can download the ID of the main catalog on the basis of which it is possible to set the catalog price for products
Table of contents
Table of contentsGlossaryPOST - create new pricingGET mainCatalogIdPOST - create new pricing (purchase)
Glossary
Name | Explanation |
mainCatalogId | it is the identifier of the main directory thanks to which we can set the catalog price for the product in another endpoint |
type | "PERCENT_MULTIPLICATIVE" "PERCENT_ADDITIVE" "FLAT_VALUEβ |
conditions :
type
start
end |
It is now possible to select one condition as TIME_RANGE. The condition defines the time period in which the pricing will be active
Pricing start date. Possible to set year, month, day, hour, minute, second
Pricing end date. Possible to set year, month, day, hour, minute, second |
global | Whether the condition is global - true or false |
priority | The assigned priority is important when several pricings apply to a given product |
name | name of pricing |
defaultDiscount
type
value | default terms of the discount, which will apply if no other discount is assigned to the price covered by the discount
Type of discount. Possible to choose PERCENT_MULTIPLICATIVE , PERCENT_ADDITIVE , FLAT_VALUE
PERCENT_MULTIPLICATIVE - the multiplied percentage that reduce the sale price
PERCENT_ADDITIVE - the added percentage that reduce the sale price
FLAT_VALUE - numerical value that reduces the sale price
discount type value |
POST - create new pricing
In order to create new discount pricing use POST
/api/v1/pricing/integrations/auth-required/pricing/discount
. The sequence diagram below shows the process:
Example request:
jsoncurl -X POST "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/pricing/discount" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "{ "conditions": [ { "type": "TIME_RANGE", "start": [ 2019, 3, 13, 12, 57, 50 ], "end": [ 2039, 3, 13, 12, 57, 50 ] } ], "global": true, "priority": 1, "name": "new_discount_10%", "defaultDiscount": { "type": "PERCENT_MULTIPLICATIVE", "value": 10 } }
In response you will receive
pricingId
which should be saved.Example response:
json{ "pricingId": "f1626c3f-d559-4713-95d5-7890c94a0f1b" }
If you need to create different levels of discounts for a product or group of products, use this endpoint.
GET mainCatalogId
In order to get
mainCatalogId
(ID needed to set the catalog price for the selected product) use GET /api/v1/pricing/integrations/auth-required/pricing/main-catalog-id
. The diagram below shows the dependence of communicating with the API:
Example request:
jsoncurl -X GET "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/pricing/main-catalog-id" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}"
In response you will receive
mainCatalogId
Example response:
json{ "pricingId": "5f57db21-9124-418b-9abf-4be6e1c47f34" }
POST - create new pricing (purchase)
In order to create new purchase pricing (needed to set markup) use POST
/api/v1/pricing/integrations/auth-required/pricing/purchase
. The sequence diagram below shows the process:
Example request:
jsoncurl -X POST "https://api-preprod.one.unity.pl/api/v1/pricing/integrations/auth-required/pricing/purchase" -H "accept: */*" -H "one-tenant: {tenant}" -H "ApiAuth: {apiKey}" -d "{ "conditions": [ { "type": "TIME_RANGE", "start": [ 2019, 3, 13, 12, 57, 50 ], "end": [ 2039, 3, 13, 12, 57, 50 ] } ], "global": true, "priority": 0, "name": "purchaseprice" }
In response you will receive
pricingId
which should be saved.Example response:
json{ "pricingId": "2a2bebb7-1bdf-4b9e-bdaa-21fa9b3c03a2" }