Add Discount to Cart
/v1/checkout/cart/{cart_id}/discounts
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
Path Parameters
Query Parameters
Body
Discount code being applied
ID of the Merchant the discount belongs to
Response
App Customer ID
ID of the App creating the order
Name of app that originated the order.
App Order ID
Bags in the Order
The shipping or billing address of a user placing an order
Base currency of cart
Symbol representing the desired currency
The Customer Placing the Order
Date of order creation
Date of last order update
ID of the Developer who placed
Discount Total of the Order
Errors on the Order
Order is Guest
IN_PROGRESS
, PROCESSING
, COMPLETED
, CANCELED
, PARTIALLY_REFUNDED
, REFUNDED
, REQUIRES_ACTION
Payment intent client secret
Payment Method belonging to an Order
Is the cart priced
Optional value used to represent an identifier in your system.
The shipping or billing address of a user placing an order
Shipping Total of the Order
Status of the Order
in_progress
, processing
, completed
, canceled
, partially_refunded
, refunded
, requires_action
Stripe publishable key. Use for tokenizing payment methods.
Subtotal of the Order
Tax Total of the Order
Total of the Order
ID of the User placing the order
Is this cart going to be placed through wallet-based checkout
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"
}