Removes coupon - Fabric

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.


Removes coupon

cURL

curl --request DELETE \
  --url https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode} \
  --header 'Authorization: Bearer <token>' \
  --header 'x-fabric-channel-id: <x-fabric-channel-id>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>'
import requests

url = "https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}"

headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "x-fabric-channel-id": "<x-fabric-channel-id>",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
const options = {
  method: 'DELETE',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    'x-fabric-channel-id': '<x-fabric-channel-id>',
    Authorization: 'Bearer <token>'
  }
};

fetch('https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}",
  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: Bearer <token>",
    "x-fabric-channel-id: <x-fabric-channel-id>",
    "x-fabric-tenant-id: <x-fabric-tenant-id>"
  ],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}"

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

req.Header.Add("x-fabric-tenant-id", "<x-fabric-tenant-id>")
    req.Header.Add("x-fabric-channel-id", "<x-fabric-channel-id>")
    req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.delete("https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}")
  .header("x-fabric-tenant-id", "<x-fabric-tenant-id>")
  .header("x-fabric-channel-id", "<x-fabric-channel-id>")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/orchestrator/carts/{cartId}/coupons/{couponCode}")

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

request = Net::HTTP::Delete.new(url)
request["x-fabric-tenant-id"] = '<x-fabric-tenant-id>'
request["x-fabric-channel-id"] = '<x-fabric-channel-id>'
request["Authorization"] = 'Bearer <token>'

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

Response Codes


Sample Response

{
  "id": "0e49199c-5849-4211-abe6-a97a3c4dcc56",
  "attributes": {},
  "configuration": {
    ...
  },
  "customerContext": {
    ...
  },
  "status": "ACTIVE",
  "state": [
    {"resource": "CART", "resourceId": "c86f777b-1885-4ddf-961d-542ba80a69b8", "key": "MISSING_PAYMENT_DETAILS", "description": "No payment details have been added to this Cart"}
  ],
  "price": {
    "total": 1570,
    "subtotal": 1530,
    "tax": 0,
    "fulfillments": 40,
    "discounts": 0,
    "fees": 0,
    "adjustments": 0
  },
  "promotions": {
    "total": 0,
    "collection": []
  },
  "fees": {"total": 12.99, ...},
  "addresses": {...},
  "lineItems": {...},
  "summary": {...},
  "fulfillments": {...},
  "coupons": [{"code": "VALID_COUPON"}],
  "appliedCoupons": [{"code": "VALID_COUPON"}], 
  "notAppliedCoupons": [{"code": "VALID_COUPON"}], 
  "validations": {...}, 
  "payments": {...},
  "channelId": "12",
  "currency": "USD",
  "updatedAt": "2024-06-13T16:50:00.682Z",
  "createdAt": "2024-06-13T16:50:00.682Z",
  "suggestedProducts": [{"id": "12345", "name": "Wireless Mouse", "description": "A high-quality wireless mouse with ergonomic design.", "price": 29.99}],
  "promotionMessages": [{"message": "Buy one get one free", "code": "BOGO"}],
  "errors": [{"code": "ERR001", "message": "Invalid input"}]
}

Authorizations