Delete specific cart fee - Fabric

Delete specific cart fee

cURL

curl --request DELETE \
  --url https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees \
  --header 'Authorization: <authorization>' \
  --header 'x-site-context: <x-site-context>'

Python

import requests

url = "https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees"

headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "<authorization>"
}

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

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'DELETE',
  headers: {'x-site-context': '<x-site-context>', Authorization: '<authorization>'}
};

fetch('https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => [
    "Authorization: <authorization>",
    "x-site-context: <x-site-context>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees"

req, _ := http.NewRequest("DELETE", url, nil)

req.Header.Add("x-site-context", "<x-site-context>")
    req.Header.Add("Authorization", "<authorization>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Unirest (Java)

HttpResponse<String> response = Unirest.delete("https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees")
  .header("x-site-context", "<x-site-context>")
  .header("Authorization", "<authorization>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://prod.cart.fabric.inc/v2/carts/{cartId}/attributes/fees")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = '<authorization>'

response = http.request(request)
puts response.read_body

Example Responses

Success (200)

{
  "items": [
    {
      "sku": "16B2GS8LD5FDS",
      "items": [
        {
          "sku": "13B9CL6WT2SLW",
          "quantity": 15,
          "items": ["<unknown>"],
          "cartItemId": "12gved0f-7645-40cb-y7b0-167f8bggdb3z",
          "itemId": "1730902008",
          "title": "Light Cover",
          "attributes": [
            {
              "attributeId": "60c2a358eb2ec30008ae70a1",
              "name": "gift wrapping (small)",
              "type": "GIFT",
              "price": 10,
              "description": "Gift wrapping for a small package",
              "mapping": "ITEM",
              "value": "true",
              "level": "order",
              "items": ["1000000001"]
            }
          ],
          "createdAt": "2022-02-18T15:12:40.974580",
          "updatedAt": "2022-02-18T15:12:40.974580",
          "type": "WEB_SHIP",
          "subType": "Border-free",
          "priceListId": "108674",
          "lineItemId": 1,
          "isActive": true,
          "unitPrice": {
            "currency": "USD",
            "amount": 100,
            "discount": {
              "price": 80,
              "promosApplied": [
                {"promoId": "fza065tdr787", "promoCode": "coupon123", "value": "20", "unit": "%OFF"}
              ],
              "discounts": [
                {
                  "promoId": "fza065tdr787",
                  "promoCode": "coupon123",
                  "promoTitle": "New Year discount",
                  "quantity": 1,
                  "amount": 20,
                  "value": 20,
                  "groupId": "new-items",
                  "promotionType": "PROMOTION",
                  "priority": 1,
                  "stackable": false,
                  "sku": "16B2GS8LD5FDS",
                  "itemId": "1000000001",
                  "itemKey": "Key1234",
                  "message": "New Year Promotion",
                  "unit": "%OFF",
                  "proratedQuantity": 1,
                  "proratedAmount": 3.33
                }
              ],
              "discountAmount": 20
            },
            "sale": 80
          }
        }
      ],
      "quantity": 1,
      "isPickup": true,
      "cartItemId": "88cded0f-1439-40eb-a7a0-167e8bffdb3b",
      "itemId": "1000000001",
      "title": "Varnet Garden Light Kit",
      "attributeTotalPrice": 10,
      "createdAt": "2022-02-18T15:12:40.974580",
      "updatedAt": "2022-02-18T15:12:40.974580",
      "priceListId": "100000",
      "lineItemId": 1,
      "isActive": true,
      "unitPrice": {...},
      "totalPrice": {...},
      "attributes": [...],
      "priceAdjustments": [...],
      "warehouseId": "XYZ-1234",
      "shipTo": {...},
      "channel": 12,
      "group": [...],
      "fees": [...]
    }
  ],
  "currency": "USD",
  "metadata": {"approver": "620d8896058edb0009385311"},
  "allPromosApplied": [...],
  "sharedUserIds": ["[\"*\"] or [userId1,userId2]"],
  "error": {...},
  "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
  "createdAt": "2022-02-11T14:09:40.836703",
  "updatedAt": "2022-02-22T22:36:40.194293",
  "totalItems": 3,
  "totalUniqueItems": 2,
  "cartState": "PENDING",
  "tenantId": "5f689caa4216e7000750d1ef",
  "accountId": "5f689caa4216e7000750d1ef",
  "userId": "61b8e921d0cf2e000882b09f",
  "configuration": {...},
  "customer": {...},
  "totalAmount": 95,
  "subTotal": 120,
  "totalDiscount": 25,
  "totalFees": 25,
  "attributes": [...],
  "fees": [...],
  "suggestedProducts": [...]
}

Error (400/404/500)

{
  "code": "Bad Request",
  "message": "User ID or Cart ID does not exist"
}

Other Error Responses

{
  "code": "Cart or item not found",
  "message": "If the issue persists please contact support@fabric.inc."
}
{
  "code": "Internal Server Error",
  "message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}