Skip to main content

Shipping Related

This document covers all services for setting delivery details for an order, including the requests and responses associated with these services.

Get Delivery Options

This method is used to get the available delivery options, if any.

GET Get-Delivery-Options

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)

Requirement Authorization Token

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/"

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

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

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": {...}
}

Set Delivery Option

This method is used to set the selected delivery option to the current pre-order.

POST Set-Delivery-Option

Path: https://{commerce_url}/orders/checkout/?page=DeliveryOptionSelectionPage

The response can vary depending on the services in use.

  1. If the scheduled delivery feature is enabled, the response is "SlotSelectionPage".
  2. If the scheduled delivery feature is disabled, the response depends on the selected delivery option: a. If the selected delivery option is a pickup location, the response is "PickupLocationSelectionPage". b. If the selected delivery option is a retail store, the response is "RetailStoreSelectionPage". c. If the selected delivery option is customer, the response is "AddressSelectionPage".

Requirement Authorization Token

Request Body

    {
"delivery_option": 1,
"clear": false
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=DeliveryOptionSelectionPage"

payload = json.dumps({
"delivery_option": 1,
"clear": false
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

Send User's Billing and Shipping Addresses

This method is used to notify the user’s designated shipping and billing addresses.

POST Send-User's-Billing-and-Shipping-Addresses

Path: https://{commerce_url}/orders/checkout/?page=AddressSelectionPage

Requirement Authorization Token

Request Body

    {
"shipping_address": 42,
"billing_address": 42
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=AddressSelectionPage"

payload = json.dumps({
"shipping_address": 42,
"billing_address": 42
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

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.

POST Select-Slot-(DateTime-Range)

Path: https://{commerce_url}/orders/checkout/?page=SlotSelectionPage

Requirement Authorization Token

Request Body

    {
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=SlotSelectionPage"

payload = json.dumps({
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

Select Pickup Location

This method is used to notify the user’s designated pickup location.

POST Select-Pickup-Location

Path: https://{commerce_url}/orders/checkout/?page=PickupLocationSelectionPage

Requirement Authorization Token

Request Body

    {
"remote_id": 42,
"billing_address": 1,
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=PickupLocationSelectionPage"

payload = json.dumps({
"remote_id": 42,
"billing_address": 1,
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

Select Retail Store

This method is used to notify the user’s designated retail store.

POST Select-Retail-Store

Path: https://{commerce_url}/orders/checkout/?page=RetailStoreSelectionPage

Requirement Authorization Token

Request Body

    {
"retail_store": 42,
"billing_address": 1,
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=RetailStoreSelectionPage"

payload = json.dumps({
"retail_store": 42,
"billing_address": 1,
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

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.

POST Send-Shipping-Option

Path: https://{commerce_url}/orders/checkout/?page=ShippingOptionSelectionPage

Requirement Authorization Token

Request Body

     {
"shipping_option": 1
}

Example Request

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=ShippingOptionSelectionPage"

payload = json.dumps({
"shipping_option": 1
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

Set Reservation Selection

This method is used to notify the user’s designated reservation selection.

POST Set-Reservation-Selection

Path: https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage

Requirement Authorization Token

Request Body 1

    {
"skip_reservation": true,
}

Example Request 1

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage"

payload = json.dumps({
"skip_reservation": true,
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}

Request Body 2

    {
"skip_reservation": false,
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
}

Example Request 2

import requests
import json

url = "https://{commerce_url}/orders/checkout/?page=ReservationSelectionPage"

payload = json.dumps({
"skip_reservation": false,
"upper": "2023-03-15 17:00:00+00:00",
"lower": "2023-03-15 15:00:00+00:00",
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}

response = requests.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": {...}
}