curl --location --request POST 'https://api.stateset.com/v1/pricing-rules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"category_ids": ["cat_electronics"],
"quantity_breaks": [
{
"min_quantity": 10,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z"
},
"status": "active"
}'
const pricingRule = await stateset.pricingRules.create({
name: "B2B Volume Pricing - Electronics",
type: "volume_based",
priority: 10,
price_adjustment: {
method: "percentage_discount",
round_to: 99,
minimum_margin: 15
},
conditions: {
customer_segments: ["wholesale", "distributor"],
category_ids: ["cat_electronics"],
quantity_breaks: [
{
min_quantity: 10,
adjustment: {
method: "percentage_discount",
value: 10
}
},
{
min_quantity: 50,
adjustment: {
method: "percentage_discount",
value: 15
}
},
{
min_quantity: 100,
adjustment: {
method: "percentage_discount",
value: 20
}
}
]
},
validity: {
start_date: "2024-01-01T00:00:00Z"
},
status: "active"
});
{
"id": "pr_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "pricing_rule",
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"customer_ids": [],
"product_ids": [],
"category_ids": ["cat_electronics"],
"sku_patterns": [],
"channels": [],
"quantity_breaks": [
{
"min_quantity": 10,
"max_quantity": 49,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"max_quantity": 99,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"max_quantity": null,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z",
"end_date": null,
"is_active": true,
"schedule": null
},
"currency": "USD",
"status": "active",
"created_at": "2024-01-20T13:00:00Z",
"updated_at": "2024-01-20T13:00:00Z",
"created_by": "user_123",
"statistics": {
"times_applied": 0,
"total_discount_given": 0,
"affected_orders": 0,
"last_applied": null
}
}
Create Pricing Rule
Create a dynamic pricing rule for products or customer segments
POST
/
v1
/
pricing-rules
curl --location --request POST 'https://api.stateset.com/v1/pricing-rules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"category_ids": ["cat_electronics"],
"quantity_breaks": [
{
"min_quantity": 10,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z"
},
"status": "active"
}'
const pricingRule = await stateset.pricingRules.create({
name: "B2B Volume Pricing - Electronics",
type: "volume_based",
priority: 10,
price_adjustment: {
method: "percentage_discount",
round_to: 99,
minimum_margin: 15
},
conditions: {
customer_segments: ["wholesale", "distributor"],
category_ids: ["cat_electronics"],
quantity_breaks: [
{
min_quantity: 10,
adjustment: {
method: "percentage_discount",
value: 10
}
},
{
min_quantity: 50,
adjustment: {
method: "percentage_discount",
value: 15
}
},
{
min_quantity: 100,
adjustment: {
method: "percentage_discount",
value: 20
}
}
]
},
validity: {
start_date: "2024-01-01T00:00:00Z"
},
status: "active"
});
{
"id": "pr_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "pricing_rule",
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"customer_ids": [],
"product_ids": [],
"category_ids": ["cat_electronics"],
"sku_patterns": [],
"channels": [],
"quantity_breaks": [
{
"min_quantity": 10,
"max_quantity": 49,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"max_quantity": 99,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"max_quantity": null,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z",
"end_date": null,
"is_active": true,
"schedule": null
},
"currency": "USD",
"status": "active",
"created_at": "2024-01-20T13:00:00Z",
"updated_at": "2024-01-20T13:00:00Z",
"created_by": "user_123",
"statistics": {
"times_applied": 0,
"total_discount_given": 0,
"affected_orders": 0,
"last_applied": null
}
}
This endpoint creates a new pricing rule that automatically adjusts product prices based on various conditions like customer type, quantity, date ranges, or inventory levels.
Authentication
This endpoint requires a valid API key withpricing:write permissions.
Authorization: Bearer YOUR_API_KEY
Request Body
string
required
Pricing rule name
string
required
Rule type: “customer_specific”, “volume_based”, “time_based”, “channel_based”, “dynamic”
integer
required
Rule priority (lower numbers take precedence)
object
required
Price adjustment configuration
Show Price adjustment properties
Show Price adjustment properties
string
required
Adjustment method: “fixed_price”, “percentage_discount”, “fixed_discount”, “markup”, “formula”
number
Adjustment value (percentage for percentage methods, cents for fixed methods)
string
Pricing formula (for formula method)
integer
Round final price to nearest value in cents
number
Minimum margin percentage to maintain
object
required
Conditions for rule application
Show Condition properties
Show Condition properties
array
Applicable customer segment IDs
array
Specific customer IDs
array
Applicable product IDs
array
Applicable category IDs
array
SKU patterns (supports wildcards)
array
Sales channels: “web”, “pos”, “b2b”, “marketplace”
array
object
required
string
Currency code (defaults to account currency)
string
Rule status: “active”, “scheduled”, “inactive”
object
Additional custom fields
Response
Returns the created pricing rule object.curl --location --request POST 'https://api.stateset.com/v1/pricing-rules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"category_ids": ["cat_electronics"],
"quantity_breaks": [
{
"min_quantity": 10,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z"
},
"status": "active"
}'
const pricingRule = await stateset.pricingRules.create({
name: "B2B Volume Pricing - Electronics",
type: "volume_based",
priority: 10,
price_adjustment: {
method: "percentage_discount",
round_to: 99,
minimum_margin: 15
},
conditions: {
customer_segments: ["wholesale", "distributor"],
category_ids: ["cat_electronics"],
quantity_breaks: [
{
min_quantity: 10,
adjustment: {
method: "percentage_discount",
value: 10
}
},
{
min_quantity: 50,
adjustment: {
method: "percentage_discount",
value: 15
}
},
{
min_quantity: 100,
adjustment: {
method: "percentage_discount",
value: 20
}
}
]
},
validity: {
start_date: "2024-01-01T00:00:00Z"
},
status: "active"
});
{
"id": "pr_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "pricing_rule",
"name": "B2B Volume Pricing - Electronics",
"type": "volume_based",
"priority": 10,
"price_adjustment": {
"method": "percentage_discount",
"round_to": 99,
"minimum_margin": 15
},
"conditions": {
"customer_segments": ["wholesale", "distributor"],
"customer_ids": [],
"product_ids": [],
"category_ids": ["cat_electronics"],
"sku_patterns": [],
"channels": [],
"quantity_breaks": [
{
"min_quantity": 10,
"max_quantity": 49,
"adjustment": {
"method": "percentage_discount",
"value": 10
}
},
{
"min_quantity": 50,
"max_quantity": 99,
"adjustment": {
"method": "percentage_discount",
"value": 15
}
},
{
"min_quantity": 100,
"max_quantity": null,
"adjustment": {
"method": "percentage_discount",
"value": 20
}
}
]
},
"validity": {
"start_date": "2024-01-01T00:00:00Z",
"end_date": null,
"is_active": true,
"schedule": null
},
"currency": "USD",
"status": "active",
"created_at": "2024-01-20T13:00:00Z",
"updated_at": "2024-01-20T13:00:00Z",
"created_by": "user_123",
"statistics": {
"times_applied": 0,
"total_discount_given": 0,
"affected_orders": 0,
"last_applied": null
}
}
⌘I