Skip to content

Manage discounts

Discounts are a marketing tool that allows merchants to offer promotions on products or orders. They help attract customers, increase conversion rates, and enable targeted promotional strategies for specific customer groups.

Genstore supports three types of discounts:

  • Product discounts – Applied to individual products.
  • Order discounts – Applied to entire orders.
  • Shipping discounts – Applied to shipping fees.

Discounts can be fixed-amount or percentage-based and can be triggered either automatically or via a discount code.

With the Genstore API, you can create, update, and manage discounts tied to products, orders, or specific customer segments.

Prerequisites

Before managing discounts via the API, ensure:

API overview

The following APIs allow you to create, update, and manage discounts:

API EndpointDescription
/api/202412/discountsCreate a new discount
/api/202412/discounts/{discountId}Retrieve, update, or delete a discount (determined by HTTP method)
/api/202412/discounts/{discountId}/statusActivate or deactivate a discount

Use case: Create discount

Overview

The Create discount API allows creation of discount. Before creating a discount, it's important to understand its key attributes:

  • Discount types:
    • PRODUCT_DISCOUNT – Discount applied to products.
    • ORDER_DISCOUNT – Discount applied to entire orders.
    • SHIPPING_DISCOUNT – Discount applied to shipping fees.
  • Discount value types:
    • FIXED_AMOUNT_OFF – A fixed monetary discount.
    • PERCENTAGE – A percentage-based discount.
  • Activation methods:
    • CODE_DISCOUNT – Customers must enter a discount code.
    • AUTOMATIC_DISCOUNT – The discount applies automatically.
  • Eligibility:
    • ALL – Available to all customers.
    • SEGMENT – Available only to specific customer groups.

Request:

POST /api/202412/discounts

json
curl -X POST \ 
"https://{shop}.genmystore.com/api/202412/discounts" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"discount":{
		"promotionType":{
			"categoryType":"PRODUCT_DISCOUNT",
			"generateType":{
				"discountCode":"71NLIYCH",
				"generateDiscountType":"CODE_DISCOUNT"
			},
			"discountType":"PRICE_REDUCTION"
		},
		"discounts":{
			"discountValueType":"FIXED_AMOUNT_OFF",
			"value":"10"
		},
		"name":"My Discount Simple",
		"usageSetting":{
			"combinations":[
				"PRODUCT",
				"ORDER"
			],
			"customerOneUse":"false",
			"customerScopeType":"ALL",
			"discountCodeUseCount":"11",
			"segments":[
				{
					"id":"1"
				}
			]
		},
		"startTime":"2024-11-11T10:05:19.421Z",
		"trigger":{
			"buyConditionValue":"10",
			"scopeType":"SPECIFIC_PRODUCTS",
			"freeShippingLimit":"12.6",
			"collectionList":[
				{
					"id":"123"
				}
			],
			"freeShippingCountryList":[
				"OA",
				"CN"
			],
			"buyConditionType":"MINIMUM_NO",
			"productList":[
				{
					"discountProductSkuLists":[
						{
							"id":"107362071756584"
						}
					],
					"id":"102744478756584"
				}
			]
		},
		"endTime":"2024-11-11T10:05:19.421Z",
		"appHandle":"myAppHandle"
	}
}'

Use case: Update discount

Overview

Merchants may need to adjust or modify an existing discount, including:

  • Changing the discount value.
  • Updating the applicable products or orders.
  • Adjusting the customer eligibility criteria.

The Update discount API allows modification of discount configurations.

Request:

PUT /api/202412/{discountId}

json
curl -X PUT \ 
"https://{shop}.genmystore.com/api/202412/discounts/{discountId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"discount":{
		"promotionType":{
			"categoryType":"PRODUCT_DISCOUNT",
			"generateType":{
				"discountCode":"71NLIYCH",
				"generateDiscountType":"CODE_DISCOUNT"
			},
			"discountType":"PRICE_REDUCTION"
		},
		"discounts":{
			"discountValueType":"FIXED_AMOUNT_OFF",
			"value":"10"
		},
		"name":"My Discount Simple",
		"usageSetting":{
			"combinations":[
				"PRODUCT",
				"ORDER"
			],
			"customerOneUse":"false",
			"customerScopeType":"ALL",
			"discountCodeUseCount":"11",
			"segments":[
				{
					"id":"123"
				}
			]
		},
		"startTime":"2024-11-11T10:05:19.421Z",
		"trigger":{
			"buyConditionValue":"10",
			"scopeType":"SPECIFIC_PRODUCTS",
			"freeShippingLimit":"12.6",
			"collectionList":[
				{
					"id":"123"
				}
			],
			"freeShippingCountryList":[
				"OA",
				"CN"
			],
			"buyConditionType":"MINIMUM_NO",
			"productList":[
				{
					"discountProductSkuLists":[
						{
							"id":"107362071756584"
						}
					],
					"name":"shoes",
					"id":"102744478756584"
				}
			]
		},
		"endTime":"2024-11-11T10:05:19.421Z",
		"discountId":"21003695070100"
	}
}'

Use case: Change discount status

Overview

Merchants may need to activate or deactivate a discount.

  • ACTIVE – The discount is available for use.
  • INACTIVE – The discount is temporarily disabled.

Use the Update discount status API to modify a discount's availability.

Change discount status

Request:

PUT /api/202412/{discountId}/status

json
curl -X PUT \ 
"https://{shop}.genmystore.com/api/202412/discounts/{discountId}/status" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"discount":{
		"operateType":"INACTIVE"
	}
}'

Webhook

To automate discount management, subscribe to the following webhook events for real-time notifications when discounts are created, updated, or deleted.

Webhook TopicDescription
discounts/createTriggered when a new discount is created
discounts/updateTriggered when a discount is updated
discounts/deleteTriggered when a discount is deleted