Skip to content

Discounts and coupons ​

Find available offers, evaluate offers for a shopping bag, and associate eligible discounts with the customer.

Access labels such as Origin + Brand key + Customer are defined in Headers and access. Each endpoint ends in a Try it console; set the host and keys once in its Settings tab or on the overview.

A discount is the platform's single offer entity (a discount row); there is no separate coupon object on the storefront API.

Show all discount banner ​

MethodURL pathRequired access
GET/api/v1/discount/bannerOrigin + Brand key

Request fields:

FieldTypeRequiredRules / meaning
query.hubIdnumberoptional—

Example:

bash
curl -X GET "$BASE_URL/api/v1/discount/banner" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:16 → showAllDiscountBanner; routes: routes/v1/discount_route.js:10; service: _showAllDiscountBanner (app/v1/service/discount_service.js:19).

Assign a one-time discount to the customer ​

Adds the discount to a verified customer as a one-time-use promotion (_createPromotionForUser). Although the method is GET, the call writes; do not prefetch it.

MethodURL pathRequired access
GET/api/v1/discount/reward/:discountIdOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
path.discountIdnumberyes—

Example:

bash
curl -X GET "$BASE_URL/api/v1/discount/reward/1" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:45 → createPromotionForUser; routes: routes/v1/discount_route.js:130; service: _createPromotionForUser (app/v1/service/discount_service.js:905).

Get all user rewards ​

MethodURL pathRequired access
GET/api/v1/user/discount/rewardOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
query.includeExpiredbooleanoptionalDefault (false)

includeExpired is true only when the query value is the string true or the boolean true. It defaults to false.

Example:

bash
curl -X GET "$BASE_URL/api/v1/user/discount/reward" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:292 → getAllUserRewards; routes: routes/v1/discount_route.js:140; service: _getAllUserRewards (app/v1/service/discount_service.js:2115).

Get applicable discounts ​

MethodURL pathRequired access
POST/api/v1/discount/applicableOrigin + Brand key
POST/api/v1/user/discount/applicableOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectoptional—
body.payload.bagarray of objectoptionalDefault ([ ])
body.payload.bag[].isPromotionalbooleanoptional—
body.payload.bag[].indexnumberoptional—
body.payload.bag[].hubProductIdnumberyes—
body.payload.bag[].quantitynumberyes—
body.payload.bag[].packageIdstringoptionalWhitespace trimmed
body.payload.addressIdnumberoptional—
query.hubIdstringoptionalNo controller schema
query.roomIdstringoptionalNo controller schema
query.userIdstringoptionalNo controller schema

A hub must be available in the tenant key or hubId query. Without an authenticated user, provide a non-empty bag. tenant hubId/roomId and authenticated userId take precedence over query values.

Example (first URL):

bash
curl -X POST "$BASE_URL/api/v1/discount/applicable" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{}}'

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:78 → getApplicableDiscounts; routes: routes/v1/discount_route.js:120; service: _getApplicableDiscounts (app/v1/service/discount_service.js:652).

Get products for discount ​

MethodURL pathRequired access
GET/api/v1/discount/:discountCodeOrigin + Brand key + Hub selected

Request fields:

FieldTypeRequiredRules / meaning
path.discountCodestringyesWhitespace trimmed

Example:

bash
curl -X GET "$BASE_URL/api/v1/discount/example" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:153 → getProductsForDiscount; routes: routes/v1/discount_route.js:60; service: _getProductsForDiscount (app/v1/service/discount_service.js:956).

Get discount by discount code ​

MethodURL pathRequired access
GET/api/v1/discount/detail/:discountCodeOrigin + Brand key
GET/api/v1/user/discount/detail/:discountCodeOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
path.discountCodestringyesWhitespace trimmed
query.userIdnumberoptional—

Example (first URL):

bash
curl -X GET "$BASE_URL/api/v1/discount/detail/example" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:186 → getDiscountByDiscountCode; routes: routes/v1/discount_route.js:89; service: _getDiscountByDiscountDetails (app/v1/service/discount_service.js:1311).

Check and create user discount ​

MethodURL pathRequired access
POST/api/v1/user/discount/check-user-discountOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
body.payloadobjectyes—
body.payload.discountIdnumberyes—

Example:

bash
curl -X POST "$BASE_URL/api/v1/user/discount/check-user-discount" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"payload":{"discountId":1}}'

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/discount_controller.js:259 → checkAndCreateUserDiscount; routes: routes/v1/discount_route.js:99; service: _checkAndCreateUserDiscount (app/v1/service/discount_service.js:2051).

Batch platform, Shopify app and API documentation