Currency & Akifast Operations
POST
Activate Currency
Sets the active currency for the user's session. This currency will be used for pricing, discounts, and campaigns across the shop.
Commerce supports multiple currencies. By allowing customers to select their preferred currency, the system dynamically adapts product prices, discounts, campaigns, and payment processes to align with the active currency throughout their session.
The multi-currency feature can be managed in two ways: session-based or request-based. A dynamic setting called READ_CURRENCY_FROM_HEADER
determines the behavior, with its default value set to False
. When this setting is switched to True
, the active currency must be provided in the request header using the key x-currency
.
The default active currency is determined by the DEFAULT_CURRENCY
dynamic setting and is used as a fallback when neither session-based nor request-based methods are applicable.
Path: /users/activate-currency/
Authentication Required: No
Headers:
Content-Type: application/json
Accept-Language: <iso_language_code>
x-csrftoken: <token>
Body Parameters
Property | Data Type | Required | Description |
---|---|---|---|
currency_code | String | True | Specifies the currency to activate. |
Request Body
{
"currency_code": "<CURRENCY_TYPE"
}
The currency_code
must be included in the AVAILABLE_CURRENCIES
dynamic setting, which can contain the following currencies: tr
, eu
, usd
, egp
, gbp
, mad
, pln
, sar
, ron
, uah
, czk
, huf
, rub
, bgn
, iqd
, kwd
, bhd
, omr
, qar
, aed
, ngn
, inr
, lei
, kzt
, jod
, rsd
.
Example Request
import requests
import json
url = "http://{commerce_url}/users/activate-currency/"
headers = {
'Content-Type': 'application/json',
'Accept-Language': '<iso_language_code>'
'x-csrftoken': '<token>'
}
payload = json.dumps({
"currency_code": "try"
})
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)
Example Response (204 No Content)
Successfully activated currency.
Example Response (400 Bad Request)
{
"currency_code": [
"\"invalid\" is not a valid choice."
]
}
POST
User Create Akifast Guest User Permissions
This endpoint is used to store the necessary communication permissions for users who are using Akifast as guests on the payment screen. The entered data is initially stored in the cache and later used when creating a user record in the Commerce.
Path: /users/permissions/
Authentication Required: No
Headers:
Content-Type: application/json
Accept-Language: <iso_language_code>
x-csrftoken: <token>
Body Parameters
Property | Data Type | Required | Description |
---|---|---|---|
uid | String | True | A unique identifier (UUID). |
basket | Integer | True | ID of the basket (BasketStatus must be active ). |
sms_allowed | Boolean | False | A value indicating that SMS sending is allowed. |
call_allowed | Boolean | False | A value indicating that calling is allowed. |
email_allowed | Boolean | False | A value indicating that email sending is allowed. |
Request Body
{
"uid": "ca6851c94d857ef40f60763",
"basket": <Basket.id>,
"email_allowed": <boolean>,
"call_allowed": <boolean>,
"sms_allowed": <boolean>,
}
Example Request
import requests
import json
url = "https://{commerce_url}/users/permissions/"
headers = {
'Content-Type': 'application/json',
'Accept-Language': '<iso_language_code>',
'x-csrftoken': '<token>'
}
payload = json.dumps({
"uid": "ca6851c94d857ef40f60763",
"basket": 3606,
"email_allowed": True,
"call_allowed": False,
"sms_allowed": True,
})
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Example Response (200 OK)
{}
Example Response (400 Bad Request)
When a request is sent with a basket whose status is not active
,
{
"basket": [
"Invalid pk \"3606\" - object does not exist."
]
}