Skip to main content

Discount

Omnitron offers a variety of promotions, including coupons, discount codes, and campaigns, to enhance the user experience. This guide provides comprehensive information about these discounts and how they are utilized by authenticated users.

GET Discounts Available for Authenticated Users

This method is used to list the discounts available for the authenticated user. The benefit_type parameter can take three values: fixed, percentage, and shipping_free. Note that for discounts, the benefit_type can only take fixed as a valid value.

Path: https://{commerce_url}/account/basket-offers/

Requirement: Authorization Token

Example Request

To retrieve information about discounts available for authenticated users, a GET request should be sent to the https://{commerce_url}/account/basket-offers/ endpoint. In the headers, set the Authorization header to include the api token for authentication. Here's an example of how to make the request using cURL:

import requests

url = "https://{commerce_url}/account/basket-offers/"

headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.text)

Example Response

This response provides detailed information about a Special Offer discount, offering a fixed reduction of 50 TL. This discount is valid until January 1, 2025.

{
"discounts": [
{
"label": "Special Offer",
"amount": 50,
"percentage": null,
"end_datetime": "2025-01-01T00:00:00Z",
"start_datetime": "2020-02-12T13:45:00Z",
"currency": {
"label": "TL",
"value": "try"
},
"voucher_code": null,
"offer_type": {
"label": "Coupon",
"value": "coupon"
},
"condition": {
"type": "Amount",
"value": null
},
"benefit_type": {
"label": "Fixed",
"value": "fixed"
}
}
],
"total_discount": 50,
"all_discounts": [
{
"label": "Special Offer",
"amount": 50,
"percentage": null,
"end_datetime": "2025-01-01T00:00:00Z",
"start_datetime": "2020-02-12T13:45:00Z",
"currency": {
"label": "TL",
"value": "try"
},
"voucher_code": null,
"offer_type": {
"label": "Coupon",
"value": "coupon"
},
"condition": {
"type": "Amount",
"value": null
},
"benefit_type": {
"label": "Fixed",
"value": "fixed"
}
}
]
}

GET Discounts to be Active in Future

This method is used to list discounts available for authenticated user that will be activated in the future. The benefit_type parameter can take three values: fixed, percentage, and shipping_free.

Path: https://{commerce_url}/account/future-basket-offers/

Requirement: Authorization Token

Example Request

To retrieve information about discounts available for authenticated users that will be activated in the future, a GET request should be sent to the https://{commerce_url}/account/future-basket-offers/ endpoint. In the headers, set the Authorization header to include the api token for authentication. Here's an example of how to make the request using cURL:

import requests

url = "https://{commerce_url}/account/future-basket-offers/"

headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.text)

Example Response

This response indicates a Special Offer coupon that offers a 50% discount on purchases over 500 TL (Turkish Lira). This offer is valid from July 31, 2023, until July 3, 2024.

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"label": "Special Offer",
"amount": 0,
"percentage": 50,
"end_datetime": "2024-07-03T12:52:58.438000Z",
"start_datetime": "2023-07-31T12:52:55.914000Z",
"currency": {
"value": "try",
"label": "TL"
},
"voucher_code": null,
"offer_type": {
"value": "coupon",
"label": "Coupon"
},
"condition": {
"type": "Amount",
"value": 500
},
"benefit_type": {
"value": "percentage",
"label": "Percentage"
}
}
]
}

GET Expired Discounts for Authenticated User

This method is used to list expired discounts for authenticated user. The benefit_type parameter can take three values: fixed, percentage, and shipping_free.

Path: https://{commerce_url}/account/expired-basket-offers/

Requirement: Authorization Token

Example Request

To retrieve information about expired discounts for authenticated users, a GET request should be sent to the https://{commerce_url}/account/expired-basket-offers/ endpoint. In the headers, set the Authorization header to include the api token for authentication. Here's an example of how to make the request using cURL:

import requests

url = "https://{commerce_url}/account/expired-basket-offers/"

headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.text)

Example Response

This response provides details about a previous Special Offer coupon that granted a 30% discount on purchases over 500 TL (Turkish Lira). However, this offer has now expired.

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"label": "Special Offer",
"amount": 0,
"percentage": 30,
"end_datetime": "2023-07-25T13:16:28.155000Z",
"start_datetime": "2023-07-25T13:12:53.936000Z",
"currency": {
"value": "try",
"label": "TL"
},
"voucher_code": null,
"offer_type": {
"value": "coupon",
"label": "Coupon"
},
"condition": {
"type": "Amount",
"value": 500
},
"benefit_type": {
"value": "percentage",
"label": "Percentage"
}
}
]
}

GET Discounts Used in Checkout Step

This method is used to list discounts used in the authenticated user's checkout step.

Path: https://{commerce_url}/account/discount-items/

Requirement: Authorization Token

Example Request

To retrieve information about discounts used in the authenticated user's checkout step, a GET request should be sent to the https://{commerce_url}/account/discount-items/ endpoint. In the headers, set the Authorization header to include the api token for authentication. Here's an example of how to make the request using cURL:

import requests

url = "https://{commerce_url}/account/discount-items/"

headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)

print(response.text)

Example Response

This response indicates a Special Offer with a discount amount of 127.97 TL (Turkish Lira). This offer was created on March 18, 2021, and the discount was applied to the order with the number "1608355573012183".

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"amount": "127.97",
"created_date": "2021-03-18T08:53:07.888096Z",
"currency": {
"label": "TL",
"value": "try"
},
"name": "Special Offer",
"order_number": "1608355573012183"
}
]
}