Weblutions Documentation
Weblutions Main Site Contact Us Our Discord
FaxStore IconFaxStore

Weblutions Documentation / FaxStore / Discounts API

Updated

Discounts API

By Josh M. 4 mins 53

The Discounts API for FaxStore enables seamless management of promotional offers by supporting the creation, deletion, modification, and retrieval of discount codes. This streamlined interface helps maintain and update discount information effortlessly across your e-commerce platform.

Table of Contents


Get All Discounts

GET/api/discounts
Returns all promotional codes on the store.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Responses
200OKjson
View response body
[
  {
    "id": 1,
    "code": "flash",
    "discount": "50",
    "createdAt": "1652928195141",
    "uses": 0,
    "maxlimit": "-1",
    "reqRoles": "",
    "expire": "1652928315141",
    "whitelist": null,
    "paused": null
  },
  ...
]
404Not Foundplaintext
View response body
Discounts not found.

Get Single Discount

GET/api/discount/:id
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Path parameters
NameTypeRequiredDescription
idStringrequiredThe ID of the discount code
Responses
200OKjson
View response body
{
  "id": 1,
  "code": "flash",
  "discount": "50",
  "createdAt": "1652928195141",
  "uses": 0,
  "maxlimit": "-1",
  "reqRoles": "",
  "expire": "1652928315141",
  "whitelist": null,
  "paused": null
}
404Not Foundplaintext
View response body
Discount not found.

Create Discount

POST/api/discount
Creates a promotional code / discount code on the store.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Request body
NameTypeRequiredDescription
codeStringrequiredThe discount code used at checkout.
discountMixedrequiredThe discount amount. A plain number is used as a percentage while a number prefixed with a minus symbol indicates a fixed amount.
limitIntegeroptionalThe max amount of uses for the code. Defaults to unlimited (0).
rolesStringoptionalDiscord server roles required to use the discount code. Multiple roles can be specified by a comma seperated list.
expireTimestampoptionalA timestamp in MS of when the discount code will expire.
pausedBooleanoptionalPauses the discount code from use. Defaults to false.
Responses
200OKjson
View response body
{
  "id": 11,
  "code": "testcodelol",
  "discount": "50",
  "createdAt": "1723779824782",
  "uses": 0,
  "maxlimit": "0",
  "reqRoles": "",
  "expire": "",
  "whitelist": null,
  "paused": 0
}
400Invalid Requestplaintext
View response body
Missing required body items - code and discount are required.
404Not Foundplaintext
View response body
Discount ID not found after creation.

Delete Discount

DELETE/api/discount/:id
Deletes the provided discount.
Authorization
NameTypeRequiredDescription
authorizationStringrequired
Path parameters
NameTypeRequiredDescription
idStringrequiredThe database ID of the discount
Responses
201OKjson
View response body
(no content)
404Not Foundplaintext
View response body
Discount not found.

Document History

Loading version history...