Current Promotion
In order to display a promotion banner and let your customers benefit from promotional discounts, you can use the following resource. Ideally, the resource is fetched when a customer visits your site and we recommend to cache the response for 30min. To redeem a coupon code, append a URL parameter "&couponCode=<code>" to the checkout URL that you redirect your customers to. The discounts will then be visible in the checkout UI.
All requests to the Public Shop API should be made from your server and not from the browser. This allows you to leverage caching, avoids CORS policy interference and keeps your API key secure.
Method | URL | Example |
---|---|---|
GET | /api/v1/shops/<shopId>/currentPromotion |
Returns HTTP 404 if there is no promotion running at the time of the request. Otherwise, HTTP 200 is returned with a payload like this:
"description": "5% off everything",
"validUntil": "2019-10-29T23:59:59",
"code": "88S1C3S73E"
}
Field | Description |
---|---|
description | A human-readable promotion text in the shop's language. Show this to the customer. |
validUntil | The last point in time when the current promotion is still valid. This timestamp is formatted according to ISO-8601 and always implicitly in UTC. |
code | The coupon code that can be used to redeem the current promotion (see paragraph above). |