POST

/v1/checkout/cart/{cart_id}/discounts

X-Violet-Token
X-Violet-App-Secret
X-Violet-App-Id
curl --request POST \
  --url https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/discounts \
  --header 'Content-Type: application/json'
{
  "app_customer_id": "string",
  "app_id": "integer",
  "app_name": "string",
  "app_order_id": "string",
  "bags": [
    {
      "app_id": "integer",
      "app_name": "string",
      "app_order_id": "string",
      "bag_id": "integer",
      "bag_status": "IN_PROGRESS",
      "channel": "APP",
      "commission_rate": "number",
      "currency": "string",
      "currency_exchange_rate": "number",
      "date_created": "string",
      "discount_total": "integer",
      "discounts": [
        {
          "amount": "integer",
          "amount_total": "integer",
          "bag_id": "integer",
          "code": "string",
          "date_created": "string",
          "date_last_modified": "string",
          "external_id": "string",
          "id": "integer",
          "percentage": "number",
          "status": "PENDING",
          "type": "CODE",
          "value_type": "AMOUNT"
        }
      ],
      "external_checkout": "boolean",
      "external_currency": "string",
      "external_id": "string",
      "financial_status": "UNPAID",
      "fulfillment_status": "PROCESSING",
      "fulfillments": [
        {
          "bag_id": "integer",
          "carrier": "OTHER",
          "carrier_status": "PENDING",
          "external_id": "string",
          "id": "integer",
          "raw_carrier": "string",
          "skus": [
            {
              "fulfillment_id": "integer",
              "id": "integer",
              "order_sku_id": "integer",
              "quantity_fulfilled": "integer"
            }
          ],
          "status": "PENDING",
          "tracking_number": "string",
          "tracking_url": "string"
        }
      ],
      "id": "integer",
      "merchant_id": "integer",
      "merchant_name": "string",
      "order_id": "integer",
      "platform": "OTHER",
      "remorse_period_ends": "string",
      "shipping_method": {
        "Carrier": "ups",
        "bag_id": "integer",
        "external_id": "string",
        "id": "integer",
        "label": "string",
        "max_subtotal": "integer",
        "max_weight": "number",
        "merchant_id": "integer",
        "min_subtotal": "integer",
        "min_weight": "number",
        "price": "integer",
        "shipping_method_id": "string",
        "tracking_number": "string",
        "type": "variable"
      },
      "shipping_total": "integer",
      "skus": [
        {
          "app_id": "integer",
          "available": "boolean",
          "brand": "string",
          "external_id": "string",
          "height": "number",
          "id": "integer",
          "length": "number",
          "line_price": "integer",
          "merchant_id": "integer",
          "name": "string",
          "order_sku_rates": [
            {
              "amount": "integer",
              "decimal_rate": "number",
              "dollar_amount": "number",
              "name": "string",
              "order_sku_id": "integer",
              "rate": "number",
              "type": "TAX"
            }
          ],
          "price": "integer",
          "product_id": "string",
          "product_type": "PHYSICAL",
          "quantity": "integer",
          "quantity_fulfilled": "integer",
          "sku_id": "integer",
          "status": "IN_PROGRESS",
          "thumbnail": "string",
          "transient_external_product_id": "string",
          "weight": "number",
          "width": "number"
        }
      ],
      "status": "IN_PROGRESS",
      "sub_total": "integer",
      "tax_total": "integer",
      "taxes": [
        {
          "amount": "integer",
          "description": "string",
          "merchant_id": "integer",
          "order_id": "integer",
          "postal_code": "string",
          "rate": "number",
          "skus": [
            "string"
          ],
          "state": "string"
        }
      ],
      "taxes_included": "boolean",
      "total": "integer",
      "transactions": [
        {
          "amount": "integer",
          "app_id": "integer",
          "bag_id": "integer",
          "currency": "string",
          "date_created": "string",
          "date_last_modified": "string",
          "error_code": "string",
          "gateway": "string",
          "gateway_transaction_id": "string",
          "id": "integer",
          "merchant_id": "integer",
          "order_id": "integer",
          "order_payment_method": {
            "brand": "string",
            "cardholder_name": "string",
            "default": "boolean",
            "exp_month": "integer",
            "exp_year": "integer",
            "last_four": "string",
            "payment_method_id": "integer"
          },
          "payment_method_id": "integer",
          "status": "PROCESSING",
          "test": "boolean",
          "type": "AUTHORIZATION"
        }
      ],
      "wallet_based_checkout": "boolean"
    }
  ],
  "billing_address": {
    "address_1": "string",
    "address_2": "string",
    "city": "string",
    "country": "string",
    "email": "string",
    "first_name": "string",
    "last_name": "string",
    "name": "string",
    "phone": "string",
    "postal_code": "string",
    "state": "string",
    "type": "shipping"
  },
  "currency": "string",
  "currency_symbol": "string",
  "customer": {
    "billing_address": {
      "address_1": "string",
      "address_2": "string",
      "city": "string",
      "country": "string",
      "email": "string",
      "first_name": "string",
      "last_name": "string",
      "name": "string",
      "phone": "string",
      "postal_code": "string",
      "state": "string",
      "type": "shipping"
    },
    "email": "string",
    "external_id": "string",
    "first_name": "string",
    "last_name": "string",
    "name": "string",
    "same_address": "boolean",
    "shipping_address": {
      "address_1": "string",
      "address_2": "string",
      "city": "string",
      "country": "string",
      "email": "string",
      "first_name": "string",
      "last_name": "string",
      "name": "string",
      "phone": "string",
      "postal_code": "string",
      "state": "string",
      "type": "shipping"
    },
    "user_id": "integer"
  },
  "date_created": "string",
  "date_last_modified": "string",
  "developer_id": "integer",
  "discount_total": "integer",
  "errors": [
    {
      "bag_id": "integer",
      "date_created": "string",
      "entity_id": "string",
      "id": "integer",
      "message": "string",
      "order_id": "integer",
      "platform": "OTHER",
      "type": "EXTERNAL_CREATE_CART"
    }
  ],
  "guest": "boolean",
  "id": "integer",
  "intent_based_checkout": "boolean",
  "is_guest": "boolean",
  "order_id": "integer",
  "order_status": "IN_PROGRESS",
  "payment_intent_client_secret": "string",
  "payment_method": {
    "brand": "string",
    "cardholder_name": "string",
    "default": "boolean",
    "exp_month": "integer",
    "exp_year": "integer",
    "last_four": "string",
    "payment_method_id": "integer"
  },
  "priced": "boolean",
  "referral_id": "string",
  "shipping_address": {
    "address_1": "string",
    "address_2": "string",
    "city": "string",
    "country": "string",
    "email": "string",
    "first_name": "string",
    "last_name": "string",
    "name": "string",
    "phone": "string",
    "postal_code": "string",
    "state": "string",
    "type": "shipping"
  },
  "shipping_total": "integer",
  "status": "in_progress",
  "stripe_key": "string",
  "sub_total": "integer",
  "tax_total": "integer",
  "token": "string",
  "total": "integer",
  "user_id": "integer",
  "wallet_based_checkout": "boolean"
}

Add discounts to a cart given its cart_id.

Discounts are added at a per merchant level and each merchant is required to have created this discount code in their E-Commerce platform prior to being applied through Violet. You can read more about discount codes here.

Headers

X-Violet-Token
string
X-Violet-App-Secret
string
X-Violet-App-Id
integer

Path Parameters

cart_idrequired
integer

Query Parameters

price_cart
Default: false
boolean

Body

application/json
code
string

Discount code being applied

merchant_id
integer

ID of the Merchant the discount belongs to

Response

200 - application/json
app_customer_id
string

App Customer ID

app_id
integer

ID of the App creating the order

app_name
string

Name of app that originated the order.

app_order_id
string

App Order ID

bags
object[]

Bags in the Order

billing_address
object

The shipping or billing address of a user placing an order

currency
string

Base currency of cart

currency_symbol
string

Symbol representing the desired currency

customer
object

The Customer Placing the Order

date_created
string

Date of order creation

date_last_modified
string

Date of last order update

developer_id
integer

ID of the Developer who placed

discount_total
integer

Discount Total of the Order

errors
object[]

Errors on the Order

guest
boolean
id
integer
intent_based_checkout
boolean
is_guest
boolean

Order is Guest

order_id
integer
order_status
enum<string>
Available options:
IN_PROGRESS,
PROCESSING,
COMPLETED,
CANCELED,
PARTIALLY_REFUNDED,
REFUNDED,
REQUIRES_ACTION
payment_intent_client_secret
string

Payment intent client secret

payment_method
object

Payment Method belonging to an Order

priced
boolean

Is the cart priced

referral_id
string

Optional value used to represent an identifier in your system.

shipping_address
object

The shipping or billing address of a user placing an order

shipping_total
integer

Shipping Total of the Order

statusrequired
enum<string>

Status of the Order

Available options:
in_progress,
processing,
completed,
canceled,
partially_refunded,
refunded,
requires_action
stripe_key
string

Stripe publishable key. Use for tokenizing payment methods.

sub_total
integer

Subtotal of the Order

tax_total
integer

Tax Total of the Order

token
string
total
integer

Total of the Order

user_id
integer

ID of the User placing the order

wallet_based_checkout
boolean

Is this cart going to be placed through wallet-based checkout