> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/omnitron/integration/order/order-cancellation.md).

# Order Cancellation

All orders can be canceled/returned, as well as order items in the order can be canceled/returned partially.

It is not possible to partially cancel some and return some inside the order. It is only possible to initiate either the cancellation or return processes for the entire order.

<table data-header-hidden><thead><tr><th width="121.2890625"></th><th width="110.66015625"></th><th width="92.0234375"></th><th width="92.30859375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>✓</td><td><a href="/omnitron/getting-started.md">The API key of the customer’s account</a></td></tr><tr><td>order</td><td>integer</td><td>data</td><td>✓</td><td>Order ID</td></tr><tr><td>is_all</td><td>boolean</td><td>data</td><td></td><td>If True cancels the order with all order items under it. Default False</td></tr><tr><td>cancel_items</td><td>dict</td><td>data</td><td>✓</td><td>If is_all True, you need to send cancel_items as an empty list. Otherwise need to sent Order items that will cancel</td></tr><tr><td>forced_refund_amount</td><td>string</td><td>data</td><td>✓</td><td>Used in Omnitron operating mechanism, default null must be sent</td></tr><tr><td>reasons</td><td>dict</td><td>data</td><td>✓</td><td>Cancellation or refund reason code</td></tr><tr><td>is_cargo_refund</td><td>boolean</td><td>data</td><td></td><td>Cargo cost will be refunded. Default value is False. You can switch cancellation rules via Cancellation Strategy. See the Cancellation Strategies section for more information.</td></tr><tr><td>refund_invoice_number</td><td>string</td><td>data</td><td></td><td>Refund invoice number for the order.</td></tr><tr><td>ibans</td><td>dict</td><td>data</td><td></td><td>Iban information can be seen in the Cancellation Request. Used for only Fund Transfer transaction cancellations. Not required. Example structure is {`{"order_item_id": "iban"}`}</td></tr><tr><td>holder_names</td><td>dict</td><td>data</td><td></td><td>Holder name information can be seen in the Cancellation Used for only Fund Transfer transaction cancellations. Not required. Example structure is {`{"order_item_id": "holder_name"}`}</td></tr></tbody></table>

In the example below, all order items are canceled.

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Cancel Order</mark>

**Path:** `/api/i1/orders/{order_id}/cancel/`

Sample HTTP request to cancel all order items in the order.

`content_type` header represents the response type.

`Authorization` header is a required header for authentication. You can retrieve api\_token with login.

**Example Request**

<pre class="language-python"><code class="lang-python"><strong>import requests
</strong>import json

url = "https://{customer_api_url}/api/v1/orders/{order_id}/cancel/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}

data = {
  "order": 167848, # order id
  "is_all": True, 
  "cancel_items": [],
  "forced_refund_amount": None,
  "reasons": {
      "46761": 1 # order item id : reason code
  }
}

response = requests.post(url, headers=headers , data=json.dumps(data))
print(response.text)
</code></pre>

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Cancel Order - Partial</mark>

**Path:** `/api/i1/orders/{order_id}/cancel/`

In the example below, the order items are partially canceled.

Sample HTTP request to cancel desired order items in the order.

**Example Request**

```python
import requests
import json

url = "https://{customer_api_url}/api/v1/orders/{order_id}/cancel/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}

data = {
  "order": 167848, # order id
  "is_all": False, 
  "cancel_items": [
    46761,
    46762,
  ],
  "forced_refund_amount": None,
  "reasons": {
      "46761": 1,# order item id : reason code
      "46762": 1 # order item id : reason code

  }
}

response = requests.post(url, headers=headers , data=json.dumps(data))
print(response.text)
```

**Example Response**

Returns given order detail information. Expected status code 200-OK. To see more information about response fields, see the Get Order section.

```json

{
    "pk": 29,
    "number": "4cd342afffe8464",
    "channel": {
        "pk": 1,
        "name": "Shop",
        "channel_type": "web",
        "catalog": 1,
        "modified_date": "2022-06-13T10:47:45.640791Z",
        "created_date": "2017-01-22T23:33:29.178976Z",
        "category_tree": null,
        "is_active": true,
        "conf": {
            "username": "John",
            "feature_flags": {},
            "auth_token": "AILeoZiTaWGHEIHSvfdaaURqFfBEWgbhdNrlxShtu",
            "server": "http://localhost:8080/api/v1/",
            "localized_cancel_mail_subject": {},
            "sales_url": "http://www.brand.com",
            "password": "Password12345!"
        },
        "schema": {}
    },
    "status": "50",
    "date_placed": "2017-02-01T11:07:24.155206Z",
    "customer": {
        "pk": 1104,
        "channel": 1,
        "email": "samplemail@akinon.com",
        "first_name": "John",
        "last_name": "Doe",
        "phone_number": null,
        "is_active": true,
        "channel_code": "2",
        "erp_code": "1-4-3473443",
        "extra_field": {},
        "modified_date": "2017-02-05T19:22:03.144426Z",
        "created_date": "2017-02-02T09:40:29.912650Z",
        "date_joined": "2017-01-24T15:08:49.308306Z",
        "email_allowed": false,
        "sms_allowed": false,
        "call_allowed": false,
        "gender": null,
        "attributes": {},
        "user_type": null,
        "date_of_birth": null
    },
    "shipping_address": {
        "pk": 28,
        "email": "samplemail@akinon.com",
        "phone_number": "9999999999",
        "first_name": "John",
        "last_name": "Doe",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z"
        },
        "city": {
            "pk": 62,
            "is_active": true,
            "name": "İstanbul",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.030000Z",
            "created_date": "2016-12-22T08:50:57.030000Z"
        },
        "line": "line",
        "title": "title",
        "township": {
            "pk": 156,
            "is_active": true,
            "name": "SARIYER",
            "city": 62,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:02.022000Z",
            "created_date": "2016-12-22T08:51:02.022000Z"
        },
        "district": null,
        "postcode": "99999",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "d7f63eea389f78116fdf95d0d0b23719a",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1104,
            "channel": 1,
            "email": "samplemail@akinon.com",
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": null,
            "is_active": true,
            "channel_code": "2",
            "erp_code": "1-4-3473443",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:03.144426Z",
            "created_date": "2017-02-02T09:40:29.912650Z",
            "date_joined": "2017-01-24T15:08:49.308306Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:03.276431Z"
    },
    "billing_address": {
        "pk": 28,
        "email": "samplemail@akinon.com",
        "phone_number": "9999999999",
        "first_name": "John",
        "last_name": "Doe",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z"
        },
        "city": {
            "pk": 62,
            "is_active": true,
            "name": "İstanbul",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.030000Z",
            "created_date": "2016-12-22T08:50:57.030000Z"
        },
        "line": "line",
        "title": "title",
        "township": {
            "pk": 156,
            "is_active": true,
            "name": "SARIYER",
            "city": 62,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:02.022000Z",
            "created_date": "2016-12-22T08:51:02.022000Z"
        },
        "district": null,
        "postcode": "31213",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "d7f63eea389f78116dff95d0d0b23719a",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1104,
            "channel": 1,
            "email": "samplemail@akinon.com",
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": null,
            "is_active": true,
            "channel_code": "2",
            "erp_code": "1-4-3473443",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:03.144426Z",
            "created_date": "2017-02-02T09:40:29.912650Z",
            "date_joined": "2017-01-24T15:08:49.308306Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:03.276431Z"
    },
    "currency": "try",
    "amount": "10.94",
    "shipping_amount": "8.50",
    "shipping_tax_rate": null,
    "extra_field": {
        "cargo_line_id": "9e52cd4f-921a-4680-avaea-a70f0085f18a"
    },
    "orderitem_set": [
        {
            "pk": 115,
            "order": 29,
            "product": {
                "pk": 5957,
                "name": "Limon",
                "base_code": "1KMEYV0011",
                "sku": "2672881053987",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "erp_ProductCode": "1KMEYV0011108",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "uretim_yeri": "ÇİN",
                    "renk": "SARI",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "SARI",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "materyal": "POLYFOAM",
                    "integration_ProductCode": "1KMEYV0011108",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductHierarchyLevel02": "Dekoratif",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt02Desc": "Yapay Meyve",
                    "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Dekoratif",
                    "erp_ProductAtt25Desc": "ÇİN",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt20Desc": "POLYFOAM",
                    "integration_ProductAtt02Desc": "Yapay Meyve",
                    "integration_ProductAtt07Desc": "50+50 promosyon",
                    "filtre_renk1": "Sarı"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Dekoratif",
                        "data_type": "dropdown",
                        "label": "Dekoratif"
                    },
                    "filtre_renk1": {
                        "value": "Sarı",
                        "data_type": "dropdown",
                        "label": "Sarı"
                    },
                    "erp_color": {
                        "value": "SARI",
                        "data_type": "dropdown",
                        "label": "SARI"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Dekoratif",
                        "data_type": "dropdown",
                        "label": "Dekoratif"
                    },
                    "renk": {
                        "value": "SARI",
                        "data_type": "dropdown",
                        "label": "SARI"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 17180,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/d907e2f2-b615-454c-a383-ca1ae7e93faf.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.574308Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    },
                    {
                        "pk": 17181,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/982815c2-ae3e-4cb1-b126-93ab2622b57c.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.640015Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    },
                    {
                        "pk": 17182,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/c1bb563c-b2bd-4478-99ab-cc5136d55a84.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.704360Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    }
                ],
                "attribute_set": 66,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:42:56.863166Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:45:37.864572Z",
                "uuid": "2e200443-b5ea-4909-b75f-v02912fc9e4cd",
                "created_date": "2017-01-22T22:20:51.092944Z"
            },
            "status": "50",
            "price_currency": "try",
            "price": "2.44",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": "waiting",
            "status_display": "cancellation waiting",
            "installment_interest_amount": "0.00",
            "net_amount": "2.44",
            "tracking_number": "123",
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null
        }
    ],
    "discountitem_set": [],
    "transaction_set": [
        {
            "pk": 4,
            "transaction_type": "purchase",
            "transaction_id": "17032OHXH15476",
            "auth_code": null,
            "pos": {
                "pk": 2,
                "name": "NestPay",
                "slug": "HA",
                "gateway": "omnicore.libs.payment_gateways.nestpay.NestpayGateway",
                "config": {
                    "auth": {
                        "username": "ISBANKAPI",
                        "password": "ISBANK07",
                        "client_id": "7006550002100"
                    }
                },
                "resource_url": "https://entegrasyon.asseco-see.com.tr/fim/api",
                "three_d_resource_url": null,
                "channel": 1,
                "gateway_display": "Nestpay",
                "modified_date": "2017-02-02T10:38:15.427494Z",
                "created_date": "2017-02-01T14:01:28.829319Z"
            },
            "main_pos": null,
            "order": {
                "pk": 29,
                "number": "4cd342gafffe8464",
                "channel": 1,
                "status": "50",
                "date_placed": "2017-02-01T11:07:24.155206Z",
                "customer": 1104,
                "shipping_address": 28,
                "billing_address": 28,
                "currency": "try",
                "amount": "10.94",
                "shipping_amount": "8.50",
                "shipping_tax_rate": null,
                "extra_field": {
                    "cargo_line_id": "9e52cd4f-921a-4680-a4aea-a70f0085f18a"
                },
                "payment_option": 2,
                "payment_option_slug": "kredi_karti",
                "bin_number": "454360",
                "installment": 22,
                "installment_count": 1,
                "delivery_type": null,
                "installment_interest_amount": "0.00",
                "cargo_company": 1,
                "invoice_number": null,
                "invoice_date": null,
                "e_archive_url": null,
                "refund_amount": "0.00",
                "discount_refund_amount": "0.00",
                "shipping_refund_amount": "0.00",
                "discount_amount": "0.00",
                "is_send": true,
                "net_shipping_amount": "8.50",
                "shipping_interest_amount": "0.00",
                "tracking_number": "123",
                "carrier_shipping_code": null,
                "remote_addr": null,
                "fundstransfertransaction_set": [],
                "has_gift_box": false,
                "gift_box_note": null,
                "external_status": null,
                "client_type": "default",
                "language_code": null,
                "notes": null,
                "delivery_range": null,
                "shipping_option_slug": null,
                "segment": null,
                "modified_date": "2022-12-20T10:30:46.666779Z",
                "checkout_provider_id": null,
                "created_date": "2017-02-02T09:40:30.624692Z"
            },
            "currency": null,
            "user_email": "samplemail@akinon.com",
            "raw_request": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<CC5Request><OrderId>4cd342afffe8464cb00d7caf6a522a27</OrderId><PayerAuthenticationCode>CAVV</PayerAuthenticationCode><Name>ISBANKAPI</Name><Taksit></Taksit><Type>Auth</Type><Expires>**/****</Expires><Number>****************</Number><ClientId>700655000100</ClientId><Cvv2Val>***</Cvv2Val><Currency>949</Currency><GroupId></GroupId><TransId></TransId><Password>ISBANK07</Password><IPAddress>127.0.0.1</IPAddress><Email>example@example.com</Email><Total>10.94</Total></CC5Request>",
            "raw_response": "<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>\n<CC5Response>\n  <OrderId>4cd342afffe8464cb00d7caf6a522a27</OrderId>\n  <GroupId>4cd342afffe8464cb00d7caf6a522a27</GroupId>\n  <Response>Approved</Response>\n  <AuthCode>P306990</AuthCode>\n  <HostRefNum>703200000390</HostRefNum>\n  <ProcReturnCode>00</ProcReturnCode>\n  <TransId>17032OHXH15476</TransId>\n  <ErrMsg></ErrMsg>\n  <Extra>\n    <SETTLEID>387</SETTLEID>\n    <TRXDATE>20170201 14:07:23</TRXDATE>\n    <ERRORCODE></ERRORCODE>\n    <TERMINALID>00556600</TERMINALID>\n    <MERCHANTID>655000100</MERCHANTID>\n    <CARDBRAND>VISA</CARDBRAND>\n    <CARDISSUER>T. IS BANKASI A.S.</CARDISSUER>\n    <HOSTDATE>0201-140723</HOSTDATE>\n    <NUMCODE>00</NUMCODE>\n  </Extra>\n</CC5Response>\n",
            "is_succeeded": true,
            "amount": "10.94",
            "remote_addr": null,
            "created_date": "2017-02-02T09:40:30.722919Z",
            "pos_slug": "HA",
            "modified_date": "2017-02-05T20:03:17.194881Z"
        }
    ],
    "payment_option": {
        "pk": 2,
        "name": "Credit Card",
        "slug": "credit_Card",
        "payment_type": "credit_card",
        "sort_order": 0,
        "is_active": true,
        "config": {},
        "translations": {
            "tr-tr": {
                "name": "Kredi Kartı"
            }
        },
        "channel": 1,
        "modified_date": "2021-11-10T10:06:41.529791Z",
        "created_date": "2017-02-01T14:46:02.110133Z"
    },
    "payment_option_slug": "kredi_karti",
    "bin_number": "454360",
    "installment": {
        "pk": 22,
        "card": {
            "pk": 23,
            "name": "Maximum",
            "bank": {
                "pk": 16,
                "name": "İş Bankası",
                "slug": "is-bankas",
                "logo": null,
                "channel": 1,
                "modified_date": "2017-02-01T14:34:07.916233Z",
                "created_date": "2017-02-01T14:34:07.916213Z"
            },
            "card_type": {
                "pk": 18,
                "name": "Maximum",
                "slug": "maximum",
                "logo": "http://localhost:8000/media/card_types/2017/02/01/d09bb303-ea29-4eba-8c9a-f9bc056d52d7.jpg",
                "channel": 1,
                "modified_date": "2017-02-01T14:34:08.130132Z",
                "created_date": "2017-02-01T14:34:08.130112Z"
            },
            "card_payment_type": "credit",
            "cash_payment": 10,
            "installment_payment": 2,
            "slug": "maximum",
            "three_d_payment": 10,
            "is_commerce_card": false,
            "channel": 1,
            "modified_date": "2017-02-01T14:34:08.139753Z",
            "created_date": "2017-02-01T14:34:08.139728Z"
        },
        "installment_count": 1,
        "label": "Peşin",
        "interest_rate": "0.000000",
        "is_active": true,
        "config": {},
        "translations": null
    },
    "installment_count": 1,
    "installment_interest_amount": "0.00",
    "cargo_company": {
        "pk": 1,
        "name": "Aras",
        "erp_code": "ARAS",
        "shipping_company": "aras",
        "modified_date": "2018-08-15T12:11:54.402253Z",
        "created_date": "2017-01-30T14:02:18.165573Z"
    },
    "invoice_number": null,
    "invoice_date": null,
    "e_archive_url": null,
    "refund_amount": "0.00",
    "discount_refund_amount": "0.00",
    "shipping_refund_amount": "0.00",
    "discount_amount": "0.00",
    "cancellation_info": {
        "shipping_refund_amount": "8.50",
        "staff_remote_id": null,
        "refund_amount": "10.94",
        "order_items": [
            {
                "status": "100",
                "pk": 115,
                "reason": 4,
                "previous_status": "450"
            }
        ],
        "previous_status": "450",
        "discounts": [],
        "discount_refund_amount": "0.0",
        "retail_store_remote_id": null,
        "refund_invoice_number": null
    },
    "status_display": "cancellation waiting",
    "tracking_number": "123",
    "is_send": true,
    "cancel_status": "waiting",
    "net_shipping_amount": 8.5,
    "remote_addr": null,
    "language_code": null,
    "fundstransfertransaction_set": [],
    "has_gift_box": false,
    "gift_box_note": null,
    "tracking_url": null,
    "external_status": null,
    "payondeliverytransaction_set": [],
    "loyaltytransaction_set": [],
    "bextransaction_set": [],
    "cancellationplan_set": [
        {
            "pk": 15,
            "order": {
                "pk": 29,
                "number": "4cd342afffef8464",
                "channel": 1,
                "status": "50",
                "date_placed": "2017-02-01T11:07:24.155206Z",
                "customer": 1104,
                "shipping_address": 28,
                "billing_address": 28,
                "currency": "try",
                "amount": "10.94",
                "shipping_amount": "8.50",
                "shipping_tax_rate": null,
                "extra_field": {
                    "cargo_line_id": "9e52cd4f-921a-4680v-aaea-a70f0085f18a"
                },
                "payment_option": 2,
                "payment_option_slug": "kredi_karti",
                "bin_number": "454360",
                "installment": 22,
                "installment_count": 1,
                "delivery_type": null,
                "installment_interest_amount": "0.00",
                "cargo_company": 1,
                "invoice_number": null,
                "invoice_date": null,
                "e_archive_url": null,
                "refund_amount": "0.00",
                "discount_refund_amount": "0.00",
                "shipping_refund_amount": "0.00",
                "discount_amount": "0.00",
                "is_send": true,
                "net_shipping_amount": "8.50",
                "shipping_interest_amount": "0.00",
                "tracking_number": "123",
                "carrier_shipping_code": null,
                "remote_addr": null,
                "fundstransfertransaction_set": [],
                "has_gift_box": false,
                "gift_box_note": null,
                "external_status": null,
                "client_type": "default",
                "language_code": null,
                "notes": null,
                "delivery_range": null,
                "shipping_option_slug": null,
                "segment": null,
                "modified_date": "2022-12-20T10:30:46.666779Z",
                "checkout_provider_id": null,
                "created_date": "2017-02-02T09:40:30.624692Z"
            },
            "invoice_number": null,
            "order_previous_status": "450",
            "shipping_refund_amount": "8.50",
            "refund_amount": "10.94",
            "discount_refund_amount": "0.00",
            "status": "waiting",
            "plan_type": "cancel",
            "cancellationplanorderitem_set": [
                {
                    "pk": 13,
                    "order_item": {
                        "pk": 115,
                        "order": {
                            "pk": 29,
                            "number": "4cd342afffe84v64",
                            "channel": 1,
                            "status": "50",
                            "date_placed": "2017-02-01T11:07:24.155206Z",
                            "customer": 1104,
                            "shipping_address": 28,
                            "billing_address": 28,
                            "currency": "try",
                            "amount": "10.94",
                            "shipping_amount": "8.50",
                            "shipping_tax_rate": null,
                            "extra_field": {
                                "cargo_line_id": "9e52cd4f-921a-4f680-aaea-a70f0085f18a"
                            },
                            "payment_option": 2,
                            "payment_option_slug": "kredi_karti",
                            "bin_number": "454360",
                            "installment": 22,
                            "installment_count": 1,
                            "delivery_type": null,
                            "installment_interest_amount": "0.00",
                            "cargo_company": 1,
                            "invoice_number": null,
                            "invoice_date": null,
                            "e_archive_url": null,
                            "refund_amount": "0.00",
                            "discount_refund_amount": "0.00",
                            "shipping_refund_amount": "0.00",
                            "discount_amount": "0.00",
                            "is_send": true,
                            "net_shipping_amount": "8.50",
                            "shipping_interest_amount": "0.00",
                            "tracking_number": "123",
                            "carrier_shipping_code": null,
                            "remote_addr": null,
                            "fundstransfertransaction_set": [],
                            "has_gift_box": false,
                            "gift_box_note": null,
                            "external_status": null,
                            "client_type": "default",
                            "language_code": null,
                            "notes": null,
                            "delivery_range": null,
                            "shipping_option_slug": null,
                            "segment": null,
                            "modified_date": "2022-12-20T10:30:46.666779Z",
                            "checkout_provider_id": null,
                            "created_date": "2017-02-02T09:40:30.624692Z"
                        },
                        "product": {
                            "pk": 5957,
                            "name": "Limon",
                            "base_code": "1KMEYV0011",
                            "sku": "2672881053987",
                            "product_type": "0",
                            "is_active": true,
                            "parent": null,
                            "attributes": {
                                "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                                "erp_ProductCode": "1KMEYV0011108",
                                "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                                "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                                "uretim_yeri": "ÇİN",
                                "renk": "SARI",
                                "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                                "erp_ProductAtt07Desc": "50+50 promosyon",
                                "erp_color": "SARI",
                                "erp_ProductAtt01Desc": "DIŞ ALIM",
                                "materyal": "POLYFOAM",
                                "integration_ProductCode": "1KMEYV0011108",
                                "integration_ProductAtt01Desc": "DIŞ ALIM",
                                "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                                "erp_ProductHierarchyLevel02": "Dekoratif",
                                "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                                "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                                "erp_ProductAtt02Desc": "Yapay Meyve",
                                "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                                "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                                "integration_ProductHierarchyLevel02": "Dekoratif",
                                "erp_ProductAtt25Desc": "ÇİN",
                                "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                                "erp_ProductAtt20Desc": "POLYFOAM",
                                "integration_ProductAtt02Desc": "Yapay Meyve",
                                "integration_ProductAtt07Desc": "50+50 promosyon",
                                "filtre_renk1": "Sarı"
                            },
                            "attributes_kwargs": {
                                "erp_ProductHierarchyLevel01": {
                                    "value": "TEKSTİL DIŞI",
                                    "data_type": "dropdown",
                                    "label": "TEKSTİL DIŞI"
                                },
                                "erp_ProductHierarchyLevel02": {
                                    "value": "Dekoratif",
                                    "data_type": "dropdown",
                                    "label": "Dekoratif"
                                },
                                "filtre_renk1": {
                                    "value": "Sarı",
                                    "data_type": "dropdown",
                                    "label": "Sarı"
                                },
                                "erp_color": {
                                    "value": "SARI",
                                    "data_type": "dropdown",
                                    "label": "SARI"
                                },
                                "integration_ProductHierarchyLevel01": {
                                    "value": "TEKSTİL DIŞI",
                                    "data_type": "dropdown",
                                    "label": "TEKSTİL DIŞI"
                                },
                                "integration_ProductHierarchyLevel02": {
                                    "value": "Dekoratif",
                                    "data_type": "dropdown",
                                    "label": "Dekoratif"
                                },
                                "renk": {
                                    "value": "SARI",
                                    "data_type": "dropdown",
                                    "label": "SARI"
                                }
                            },
                            "extra_attributes": {},
                            "group_products": [],
                            "productimage_set": [
                                {
                                    "pk": 17180,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/d907e2f2-b615-454c-a383-ca1ae7e93faf.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.574308Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                },
                                {
                                    "pk": 17181,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/982815c2-ae3e-4cb1-b126-93ab2622b57c.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.640015Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                },
                                {
                                    "pk": 17182,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/c1bb563c-b2bd-4478-99ab-cc5136d55a84.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.704360Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                }
                            ],
                            "attribute_set": 66,
                            "custom_attribute_set": null,
                            "productization_date": "2017-01-23T17:42:56.863166Z",
                            "listing_code": null,
                            "data_source": null,
                            "modified_date": "2021-02-23T13:45:37.864572Z",
                            "uuid": "2e200443-b5ea-4909-b75f-02912fc9e4cd",
                            "created_date": "2017-01-22T22:20:51.092944Z"
                        },
                        "status": "50",
                        "price_currency": "try",
                        "price": "2.44",
                        "tax_rate": "18.00",
                        "extra_field": {},
                        "price_list": {
                            "pk": 1,
                            "name": "default_price_list",
                            "code": "default_price_list",
                            "is_auto_sync": true,
                            "modified_date": "2017-01-22T12:14:44.637000Z",
                            "created_date": "2017-01-22T12:14:44.637000Z",
                            "currency": "try"
                        },
                        "stock_list": {
                            "pk": 1,
                            "name": "default_stock_list",
                            "code": "default_stock_list",
                            "is_auto_sync": true,
                            "modified_date": "2017-01-22T12:14:18.030000Z",
                            "created_date": "2017-01-22T12:14:18.030000Z"
                        },
                        "invoice_number": null,
                        "invoice_date": null,
                        "e_archive_url": null,
                        "cancel_status": "waiting",
                        "status_display": "cancellation waiting",
                        "installment_interest_amount": "0.00",
                        "net_amount": "2.44",
                        "tracking_number": "123",
                        "shipping_company": null,
                        "discount_amount": "0.00",
                        "shipment_code": null,
                        "benefitapplicant_set": [],
                        "external_status": null,
                        "retail_price": null,
                        "attributes": {},
                        "attributes_kwargs": {},
                        "tracking_url": null,
                        "image": null,
                        "parent": null,
                        "data_source": null,
                        "estimated_delivery_date": null,
                        "datasource": null
                    },
                    "order_item_previous_status": "450",
                    "status": "100",
                    "reason": {
                        "pk": 4,
                        "cancellation_type": "cancel",
                        "extra_information_needed": true,
                        "order": 100,
                        "subject": "Other",
                        "is_active": true,
                        "send_to_remote": false,
                        "modified_date": "2021-10-01T13:19:06.985243Z",
                        "created_date": "2018-08-15T12:11:54.817442Z"
                    },
                    "modified_date": "2022-12-20T10:30:46.696440Z"
                }
            ],
            "created_date": "2022-12-20T10:30:46.688582Z",
            "retail_store_remote_id": null,
            "staff_remote_id": null,
            "created_by": {
                "pk": 1,
                "username": "admin",
                "first_name": "John",
                "last_name": "Doe",
                "email": "samplemail@akinon.com",
                "is_staff": true,
                "is_active": true,
                "date_joined": "2017-01-22T21:29:29.531432Z",
                "last_login": "2022-12-20T07:31:18.656960Z",
                "is_superuser": true,
                "groups": [
                    1,
                    2
                ]
            },
            "modified_date": "2022-12-20T10:30:46.688608Z",
            "last_updated_by": {
                "pk": 1,
                "username": "admin",
                "first_name": "John",
                "last_name": "Doe",
                "email": "samplemail@akinon.com",
                "is_staff": true,
                "is_active": true,
                "date_joined": "2017-01-22T21:29:29.531432Z",
                "last_login": "2022-12-20T07:31:18.656960Z",
                "is_superuser": true,
                "groups": [
                    1,
                    2
                ]
            }
        }
    ],
    "cashregistertransaction_set": [],
    "client_type": "default",
    "shipping_interest_amount": "0.00",
    "delivery_type": null,
    "notes": null,
    "delivery_range": null,
    "shipping_option_slug": null,
    "segment": null,
    "carrier_shipping_code": null
}
```

**Example Clear Response**

If the user doesn't need any details about the order, they can send “return\_details”: false in the request to operate cancellation. Example response is shown below.

```json

{
    "success": true
}
```

**Example Bad Response**

Expected response status codes are greater than/equal to 400 less than 500. Returns the reason why it is not an acceptable request. Bad Responses are listed below:

```json
{
    "non_field_errors": 'Order cancel_status cannot be updated from approved to confirmed 
                         and waiting_for_payment to less than waiting_for_payment'
    "error_code": 'order_101_4',
}
```

```json
{
    "non_field_errors": 'Strategy not found'
    "error_code": 'cancel_101',
}
```

```json
{
    "non_field_errors": 'Transaction not found'
    "error_code": 'cancel_102',
}
```

```json
{
    "non_field_errors": 'There is no refundable amount'
    "error_code": 'cancel_103',
}
```

```json
{
    "non_field_errors": 'The refund must be done manually input'
    "error_code": 'cancel_104',
}
```

```json
{
    "non_field_errors": 'The count of items does not match the "cancel_items" count.'
    "error_code": 'cancel_105',
}
```

```json
{
    "non_field_errors": 'Forced refund amount not valid'
    "error_code": 'cancel_106',
}
```

```json
{
    "non_field_errors": 'There can not be more than one active cancellation request'
    "error_code": 'cancel_107',
}
```

```json
{
    "non_field_errors": 'Cant create CancellationRequest for already cancelled items.'
    "error_code": 'cancel_108',
}
```

```json
{
    "non_field_errors": 'You must make cancellation and refund requests separately'
    "error_code": 'cancel_109',
}
```

```json
{
    "non_field_errors": 'The amount to be refunded can not be 0. order_id: {0}'
    "error_code": 'cancel_111',
}
```

```json
{
    "non_field_errors": 'Can not update to '{0}' status'
    "error_code": 'cancel_112',
}
```

```json
{
    "non_field_errors": 'Unreported order of ERP can not be canceled'
    "error_code": 'cancel_113',
}
```

```json
{
    "non_field_errors": 'Refund amount greater than order amount'
    "error_code": 'cancel_114',
}
```

```json
{
    "non_field_errors": 'The refund must be selected all order items. Missing order items: {0}'
    "error_code": 'cancel_115',
}
```

```json
{
    "non_field_errors": 'Order({0})'s refund amount({1}) doesn't equal to CancellationPlan's refund amount({2})'
    "error_code": 'cancel_116',
}
```

```json
{
    "non_field_errors": 'Following parameters can not be used together: {0}'
    "error_code": 'cancel_117',
}
```

```json
{
    "non_field_errors": 'Cancellation reason missing for item with ID: {0}.'
    "error_code": 'cancel_118',
}
```

```json
{
    "non_field_errors": 'Orders that have multi-status items can not be canceled within pay-on-delivery.'
    "error_code": 'cancel_119',
}
```

```json
{
    "non_field_errors": 'Multiple data-sources found for the given items.'
    "error_code": 'cancel_120',
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/omnitron/integration/order/order-cancellation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
