Anonymous User Orders & Cancellations

POST User Anonymous Order

This endpoint allows users to retrieve their order details by providing their email and order number without logging in.

In order to get the details for the order, the user type associated with the order must be "guest".

Path: /users/orders/anonymous/

Authentication Required: No

Headers:

Accept-Language: <iso_language_code>
x-csrftoken: <token>
Content-Type: 'application/json'

Body Parameters

Property
Data Type
Required
Description

email

String

True

The email associated with the order to be queried.

order

String

True

The order number associated with the order to be queried.

Request Body

{
	"email": "[email protected]",
	"order": "111111111111"
}

Example Request

import requests
import json

url = "https://{commerce_url}/users/orders/anonymous/"

payload = json.dumps({
	"email": "[email protected]",
	"order": "111111111111"
})
headers = {
  'Content-Type': 'application/json',
  'Accept-Language': '<iso_language_code>'
  'x-csrftoken': '<token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Example Response (200 OK)

{
	"count": 1,
	"next": null,
	"previous": null,
	"results": [
    	{
        	"id": 6016,
        	"status": {},
        	"currency": {},
        	"orderitem_set": [],
        	"discountitem_set": [],
        	"is_cancelled": true,
        	"is_cancellable": false,
        	"is_refundable": false,
        	"shipping_address": {},
        	"billing_address": {},
        	"shipping_company": null,
        	"client_type": "default",
        	"payment_option": {},
        	"amount_without_discount": "109.99",
        	"is_payable": false,
        	"tracking_url": null,
        	"bank": {},
        	"loyaltytransaction_set": [],
        	"created_date": "2024-10-24T09:32:05.544358Z",
        	"modified_date": "2024-11-05T08:53:25.564365Z",
        	"number": "2745403029312170",
        	"amount": "99.99",
        	"discount_amount": "10.00",
        	"shipping_amount": "0.00",
        	"shipping_tax_rate": null,
        	"refund_amount": "99.99",
        	"discount_refund_amount": "0.00",
        	"shipping_refund_amount": "0.00",
        	"invoice_number": null,
        	"invoice_date": null,
        	"e_archive_url": null,
        	"tracking_number": null,
        	"defined_tracking_url": null,
        	"remote_addr": "3.73.5.7",
        	"has_gift_box": false,
        	"gift_box_note": null,
        	"language_code": "en-us",
        	"notes": null,
        	"delivery_range": null,
        	"extra_field": {},
        	"user_email": "[email protected]",
        	"shipping_option_slug": "TEST-123",
        	"payment_option_slug": "Credit_Card",
        	"bin_number": "555555",
        	"installment_count": 1,
        	"installment_interest_amount": "0.00",
        	"shipping_tracking_url": null,
        	"user": 6471,
        	"basket": 9901,
        	"shipping_option": 232,
        	"card": 364,
        	"installment": 265,
        	"segment": null,
        	"checkout_provider": null
    	}
	]
}

POST User Anonymous Orders Bulk Cancellation Request

This endpoint allows guest users to submit bulk cancellation requests for multiple order items at once. It supports both "cancel" and "refund" types of cancellations. It also provides optional parameters to specify details such as the pickup address, refund method, and pickup time for returned items.

Path: /users/orders/anonymous/bulk_cancellation_requests/

Authentication Required: No

Headers:

Content-Type: application/json
Accept-Language: <iso_language_code>
x-csrftoken: <token>

Body Parameters

Property
Data Type
Required
Description

cancellation_type

enum

True

Type of cancellations. Possible values are “cancel” and “refund”.

quantity

integer

False

Specifies the quantity of the order items to be cancelled. If left empty, it assumes all items of the specified type.

description

string

False

An optional message explaining the reason for the cancellation.

order_item

integer

True

The ID of the order item to be cancelled.

shipping_company

integer

False

The ID of the shipping company (if applicable).

iban

String

False

IBAN number for refund processing (if applicable).

holder_name

String

False

Name of the account holder for refunding (if applicable).

pickup_date

date

False

The scheduled date and time for pickup of the cancelled item. Includes date and hour_range (start and end times). { "date": "2024-01-01", "hour_range": { "start": "09:00", "end": "12:00" } }

pickup_address

Integer

False

ID of the address where the cancelled item should be picked up.

fully_refund_as_loyalty_money

Boolean

False

If true, the refund will be processed as loyalty points.

Request Body

{
  "cancel_order_items": [
    {
      "description": "test",
      "reason": 1,
      "pickup_address": 3,
      "cancellation_type": "refund",
      "order_item": 1,
      "shipping_company": 1,
      "pickup_date": {
        "date": "2024-01-01",
        "hour_range": {
          "start": "09:00",
          "end": "12:00"
        }
      }
    }
  ]
}

Example Request

import requests
import json

url = "https://{commerce_url}/users/orders/anonymous/bulk_cancellation_requests/"

payload = json.dumps({
    "cancel_order_items": [
        {
            "order_item": 271,
            "reason": 3,
            "cancellation_type": "refund"
        }
    ]
})

headers = {
   'Content-Type': 'application/json',
   'Accept-Language': '<iso_language_code>',
   'x-csrftoken': '<token>'
}

response = requests.post(url, headers=headers, data=payload)

print(response.text)

Example Response (201 Created)

[
    {
        "id": 18,
        "cancellation_type": "refund",
        "status": {
            "value": "open",
            "label": "Open"
        },
        "easy_return": null,
        "created_date": "2023-01-16T19:39:35.592560Z",
        "modified_date": "2023-01-16T19:39:35.592575Z",
        "uuid": "62eeea09-2f48-4db8-9ca5-83168a8647e6",
        "description": null,
        "iban": null,
        "holder_name": null,
        "reason": 3,
        "order_item": 271
    }
]

POST User Anonymous Orders Cancellation Request

This endpoint allows guest users to create a cancellation request for a specific order item. Users can choose to cancel the item or request a refund. Optional parameters allow for specifying shipping logistics, refund details, and a reason for the cancellation.

Path: /users/orders/anonymous/cancellation_requests/

Authentication Required: No

Headers:

Content-Type: application/json
Accept-Language: <iso_language_code>
x-csrftoken: <token>

Body Parameters

Property
Data Type
Required
Description

cancellation_type

Enum

True

Indicates the type of cancellation: "cancel" for order cancellation, "refund" for refund request.

reason

Integer

True

The ID of the cancellation reason.

order_item

Integer

True

The ID of the order item being canceled.

shipping_company

Integer

False

The ID of the shipping company handling the return, if applicable.

pickup_address

Integer

False

The ID of the address where the item should be picked up for return.

pickup_date

Dict

False

The scheduled date and time for pickup of the returned item. Includes date and hour_range (start and end times). { "date": "2024-01-01", "hour_range": { "start": "09:00", "end": "12:00" } }

quantity

Integer

False

The number of items to be canceled (should not exceed the quantity ordered).

description

String

False

An optional description or message explaining the reason for cancellation.

iban

String

False

The IBAN number for the refund (if applicable).

holder_name

String

False

The name of the account holder for refunding (if applicable).

fully_refund_as_loyalty_money

Boolean

False

Indicates whether the refund should be processed as loyalty money.

Request Body

{
    "order_item": 12345,
    "reason": 67890,
    "cancellation_type": "refund",
    "description": "Test description",
    "shipping_company": 1,
    "pickup_address": 101,
    "pickup_date": {
        "date": "2024-01-01",
        "hour_range": {
            "start": "09:00",
            "end": "12:00"
 	 }
     },
    "iban": "TR330006100519786457841326",
    "holder_name": "John Doe",
    "fully_refund_as_loyalty_money": true,
    "quantity": 2
}

Example Request

import requests
import json

url = "https://{commerce_url}/users/orders/anonymous/cancellation_requests/"

headers = {
  'Content-Type': 'application/json',
  'Accept-Language: '<iso_language_code>',
  'x-csrftoken': '<token>'
}

payload = json.dumps({
    "order_item": 12345,
    "reason": 67890,
    "cancellation_type": "refund",
    "description": "Test description",
    "shipping_company": 1,
    "pickup_address": 101,
    "pickup_date": {
        "date": "2024-01-01",
        "hour_range": {
            "start": "09:00",
            "end": "12:00"
 	 }
     },
    "iban": "TR330006100519786457841326",
    "holder_name": "John Doe",
    "fully_refund_as_loyalty_money": true
})

response = requests.post(url, headers=headers, data=payload)
print(response.text)

Example Response (200 OK)

{
    "status": {
        "value": "open",
        "label": "Open"
    },
    "modified_date": "2024-11-19T22:35:54.246633Z",
    "holder_name": "John Doe",
    "uuid": "8187c360-66da-4959-9f0b-9aa2ccac9001",
    "easy_return": {
        "status": {
            "value": "active",
            "label": "Active"
        },
        "code": "14223",
        "end_date": null,
        "tracking_url": "https://wwww.test.com",
        "tracking_number": "12352355",
        "shipping_company": {
            "value": "extension",
            "label": "Extension Cargo"
        },
        "pickup_date": {
            "date": "2024-01-01",
            "hour_range": {
                "start": "09:00",
                "end": "12:00"
            }
        },
        "start_date": "2024-11-19T22:35:54.246615Z"
    },
    "description": "test",
    "fully_refund_as_loyalty_money": true,
    "reason": 2,
    "iban": "test-iban",
    "cancellation_type": "refund",
    "created_date": "2024-11-19T22:35:54.246615Z",
    "order_item": 126,
    "id": 1,
    "quantity": 2
}

Example Response (406 Not Acceptable)

If the pickup_address is not provided:

{
    "non_field_errors": "Pickup address is required.",
    "error_code": "cancellation_request_100_8"
}

Example Response (400 Bad Request)

If the quantity is provided and is greater than the available quantity of the order item:

{
    "quantity": "Quantity can not be greater than order item quantity."
}

Was this helpful?