Shipping Related
This document covers all services for setting delivery details for an order, including the requests and responses associated with these services.
NOTE
Authenticated Endpoints
Accessing authenticated endpoints requires users to establish a session through Session Authentication. To do this:
- Users must log in using their credentials (e.g., username and password) via a designated authentication endpoint.
- Upon successful login, the server will generate and return a session cookie to the client.
- This session cookie must be included in subsequent API requests as part of the headers. The session cookie serves as proof of authentication and ensures secure access to protected resources.
GET
Get Delivery Options
This method is used to get the available delivery options, if any.
Path: https://{commerce_url}/orders/checkout/
The response could be one of the following pages:
- DeliveryOptionSelectionPage
(if any delivery option available)
- SlotSelectionPage
(if scheduled delivery is active)
- AddressSelectionPage
(if none of above is available)
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/"
payload = {}
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Example Response
{
"context_list": [
{
{
"page_context": {
"is_user_logged_in": true,
"can_guest_purchase": true,
"has_gift_box": false
},
"page_name": "IndexPage",
"page_slug": "indexpage"
},
{
"page_context": {
"addresses": [],
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
}
},
"page_name": "AddressSelectionPage",
"page_slug": "addressselectionpage"
}
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Set Delivery Option
This method is used to set the selected delivery option to the current pre-order.
Path: https://{commerce_url}/orders/checkout/?page=DeliveryOptionSelectionPage
The response can vary depending on the services in use:
- If the scheduled delivery feature is enabled, the response is "SlotSelectionPage".
- If the scheduled delivery feature is disabled, the response depends on the selected delivery option:
- If the selected delivery option is a pickup location, the response is "PickupLocationSelectionPage".
- If the selected delivery option is a retail store, the response is "RetailStoreSelectionPage".
- If the selected delivery option is customer, the response is "AddressSelectionPage".
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=DeliveryOptionSelectionPage"
payload = 'delivery_option=1&clear=false'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response 1 - Slot Selection
When scheduled delivery is enabled, the following response is generated as endpoint result.
{
"context_list": [
{
"page_context": {
"slots": [
{
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
},
{
"upper": "2023-03-15 21:00:00+00:00",
"lower": "2023-03-15 19:00:00+00:00",
}
]
},
"page_name": "SlotSelectionPage",
"page_slug": "slotselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Example Response 2 - Pickup Location
If the selected delivery option is a pickup location, the following result is generated as endpoint response.
{
"context_list": [
{
"page_context": {
"addresses": [
{
"pk": 1,
"title": "Location Title",
"line": "some address lines",
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
},
"city": {
"pk": 1,
"name": "İstanbul",
},
"township": {
"pk": 1,
"name": "Township",
},
"district" : {
"pk": 1,
"name": "District",
},
}
],
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
}
},
"page_name": "PickupLocationSelectionPage",
"page_slug": "pickuplocationselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Example Response 3 - Retail Store
If the selected delivery option is a retail store, the following result is generated as endpoint response.
{
"context_list": [
{
"page_context": {
"addresses": [
{
"pk": 1,
"title": "Location Title",
"line": "some address lines",
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
},
"city": {
"pk": 1,
"name": "İstanbul",
},
"township": {
"pk": 1,
"name": "Township",
},
"district" : {
"pk": 1,
"name": "District",
},
}
],
"retail_stores": [
{
"pk": 1,
"name": "",
"address": "",
"township": {
"pk": 1,
"name": "Township",
},
"district" : {
"pk": 1,
"name": "District",
},
},
],
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
}
},
"page_name": "RetailStoreSelectionPage",
"page_slug": "retailstoreselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Response 4 - Ship to Customer
In case none of the above conditions are valid for the request, the following response is generated as the endpoint result.
{
"context_list": [
{
"page_context": {
"addresses": [
{
"pk": 1,
"title": "Address Title",
"line": "some address lines",
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
},
"city": {
"pk": 1,
"name": "İstanbul",
},
"township": {
"pk": 1,
"name": "Township",
},
"district" : {
"pk": 1,
"name": "District",
},
}
],
"country": {
"pk": 1,
"name": "Türkiye",
"code": "tr"
}
},
"page_name": "AddressSelectionPage",
"page_slug": "addressselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Send User's Billing and Shipping Addresses
This method is used to notify the user’s designated shipping and billing addresses.
Path: https://{commerce_url}/orders/checkout/?page=AddressSelectionPage
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=AddressSelectionPage"
payload = 'shipping_address=42&billing_address=42'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response
{
"context_list": [
{
"page_context": {
"shipping_options": [
{
"pk": 1,
"name": "Yurt İçi Kargo",
"slug": "yurtici",
"logo": null,
"shipping_amount": 8.5,
"description": null,
"kwargs": {}
},
{
"pk": 2,
"name": "Aras Kargo",
"slug": "aras-kargo",
"logo": null,
"shipping_amount": 0,
"description": null,
"kwargs": {}
}
]
},
"page_name": "ShippingOptionSelectionPage",
"page_slug": "shippingoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Select Slot (DateTime Range)
This method is used to notify the user's designated date and time range for delivery. In order to make this request, the shipping address must be set beforehand.
Path: https://{commerce_url}/orders/checkout/?page=SlotSelectionPage
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=SlotSelectionPage"
payload = 'upper=2023-03-15%2017%3A00%3A00%2B00%3A00&lower=2023-03-15%2015%3A00%3A00%2B00%3A00'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response
{
"context_list": [
{
"page_context": {
"checkout_url": null,
"status_url": null,
"payment_options": [
{
"pk": 1,
"name": "Kredi Kartı",
"payment_type": "credit_card",
"payment_type_label": "Kredi Kartı"
}
],
"unavailable_options": []
},
"page_name": "PaymentOptionSelectionPage",
"page_slug": "paymentoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Select Pickup Location
This method is used to notify the user’s designated pickup location.
Path: https://{commerce_url}/orders/checkout/?page=PickupLocationSelectionPage
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=PickupLocationSelectionPage"
payload = 'remote_id=42&billing_address=1'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response
{
"context_list": [
{
"page_context": {
"shipping_options": [
{
"pk": 1,
"name": "Yurt İçi Kargo",
"slug": "yurtici",
"logo": null,
"shipping_amount": 8.5,
"description": null,
"kwargs": {}
},
{
"pk": 2,
"name": "Aras Kargo",
"slug": "aras-kargo",
"logo": null,
"shipping_amount": 0,
"description": null,
"kwargs": {}
}
]
},
"page_name": "ShippingOptionSelectionPage",
"page_slug": "shippingoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Select Retail Store
This method is used to notify the user’s designated retail store.
Path: https://{commerce_url}/orders/checkout/?page=RetailStoreSelectionPage
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=RetailStoreSelectionPage"
payload = 'billing_address=1&retail_store=42'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response
{
"context_list": [
{
"page_context": {
"shipping_options": [
{
"pk": 1,
"name": "Yurt İçi Kargo",
"slug": "yurtici",
"logo": null,
"shipping_amount": 8.5,
"description": null,
"kwargs": {}
},
{
"pk": 2,
"name": "Aras Kargo",
"slug": "aras-kargo",
"logo": null,
"shipping_amount": 0,
"description": null,
"kwargs": {}
}
]
},
"page_name": "ShippingOptionSelectionPage",
"page_slug": "shippingoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Send Shipping Option
This method is used to notify the shipping option selected by the user. Once the user sets a shipping option, the result will be one of the following pages based on the platform settings: SampleProductPage
,
ReservationSelectionPage
, PaymentOptionSelectionPage
.
Path: https://{commerce_url}/orders/checkout/?page=ShippingOptionSelectionPage
Example Request
import requests
url = "https://{commerce_url}/orders/checkout/?page=ShippingOptionSelectionPage"
payload = 'shipping_option=1'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response 1 - Payment Options
{
"context_list": [
{
"page_context": {
"checkout_url": null,
"status_url": null,
"payment_options": [
{
"pk": 1,
"name": "Kredi Kartı",
"payment_type": "credit_card",
"payment_type_label": "Kredi Kartı"
}
],
"unavailable_options": []
},
"page_name": "PaymentOptionSelectionPage",
"page_slug": "paymentoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Example Response 2 - Sample Products
{
"context_list": [
{
"page_context": {
"sample_products": [
{
"pk": 3239,
"name": "2-Li Aile Çerçevesi 13x18cm",
"base_code": "1KCERV0784",
"sku": "2672881078584",
"product_type": "0",
"is_active": true,
"parent": null,
"attributes": {
"integration_ProductAtt13Desc": "Dekoratif - %50+%50",
"integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
"integration_ProductAtt07Desc": "50+50 promosyon",
"boyut": "13x18 CM",
"uretim_yeri": "ÇİN",
"renk": "STD",
"integration_ProductAtt03Desc": "2011/2012 KIŞ",
"integration_ProductCode": "1KCERV0784139",
"integration_ProductAtt01Desc": "DIŞ ALIM",
"integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
"integration_ProductAtt09Desc": "POLYRESİN",
"integration_ProductAtt15Desc": "%50+%20 PROMOSYON",
"integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
"integration_ProductHierarchyLevel02": "Dekoratif",
"integration_ProductAtt02Desc": "Dekoratif - Çerçeve",
"integration_ProductAtt14Desc": "POLİREZİN ÇERÇEVE"
},
"attributes_kwargs": {
"integration_ProductHierarchyLevel01": {
"value": "TEKSTİL DIŞI",
"label": "TEKSTİL DIŞI"
},
"renk": {
"value": "STD",
"label": "STD"
},
"integration_ProductHierarchyLevel02": {
"value": "Dekoratif",
"label": "Dekoratif"
}
},
"extra_attributes": {},
"group_products": [],
"productimage_set": [
{
"pk": 978,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/ce59ad7a-15f8-44d6-9c0d-9df0fe5405ba.jpg",
"order": 0,
"created_date": "2017-01-24T10:38:10.663088Z",
"specialimage_set": []
},
{
"pk": 2434,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/93e48ca3-3bac-4bec-940c-64a9de3c4040.jpg",
"order": 1,
"created_date": "2017-01-24T10:39:44.865219Z",
"specialimage_set": []
},
{
"pk": 3928,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/66d2b6b9-3d27-482f-93d5-e48abf231122.jpg",
"order": 2,
"created_date": "2017-01-24T10:41:16.058763Z",
"specialimage_set": []
}
],
"attribute_set": 62,
"custom_attribute_set": null,
"is_listable": true,
"listing_code": null,
"data_source": null
},
],
"allowed_quantity": 2
},
"page_name": "SampleProductPage",
"page_slug": "sampleproductpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Example Response 3 - Reservation Selection
{
"context_list": [
{
"page_context": {
"slots": [
{
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
},
{
"upper": "2023-03-15 21:00:00+00:00",
"lower": "2023-03-15 19:00:00+00:00",
}
]
},
"page_name": "ReservationSelectionPage",
"page_slug": "reservationselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
POST
Set Reservation Selection
This method is used to notify the user’s designated reservation selection.
Path: https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage
Example Request 1
import requests
url = "https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage"
payload = 'skip_reservation=true'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response 1 - Reservation Skipped
{
"context_list": [
{
"page_context": {
"checkout_url": null,
"status_url": null,
"payment_options": [
{
"pk": 1,
"name": "Kredi Kartı",
"payment_type": "credit_card",
"payment_type_label": "Kredi Kartı"
}
],
"unavailable_options": []
},
"page_name": "PaymentOptionSelectionPage",
"page_slug": "paymentoptionselectionpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Example Request 2
import requests
url = "https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage"
payload = 'upper=2023-03-15%2017%3A00%3A00%2B00%3A00&lower=2023-03-15%2015%3A00%3A00%2B00%3A00&skip_reservation=false'
headers = {
'x-requested-with': 'XMLHttpRequest',
'Cookie': 'osessionid=<session_id>',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Response 2 - Reservation Made
{
"context_list": [
{
"page_context": {
"slots:": [
{
"05/14/2030": {
"is_available": true,
"time_slot": {
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
}
"quota": 100,
"is_delivery_range_active": true,
}
}
]
},
"page_name": "ReservationSelectionPage",
"page_slug": "ReservationSelectionPage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}