Discounts

Manage Discounts

Returning all discounts from the cart

get

Returns all discounts of the specified cart.


Required scopes

  • cart.cart_manage

    Note: This scope is only required for OAuth2 authorization method to authorize the request with the access_token.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Available scopes:
  • : Needed to manage carts.
Path parameters
cartIdstringRequired

Cart unique identifier generated when a cart is created.

tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Responses
200

The request was successful. Cart discounts items are returned.

application/json
get
/cart/{tenant}/carts/{cartId}/discounts

Applying a discount to cart

post

Applies a discount on the specified cart. Multiple discount coupons can be applied to cart, but you need to send a separate request for each discount coupon.


Required scopes

  • cart.cart_manage

    Note: This scope is only required for OAuth2 authorization method to authorize the request with the access_token.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Available scopes:
  • : Needed to manage carts.
Path parameters
cartIdstringRequired

Cart unique identifier generated when a cart is created.

tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Body
idstringOptional

Discount unique identifier.

couponYrnstring · min: 1Optional

A unique identifier of a global resource, which stores information about the resource, such as its type, ID or name of the tenant.

codestring · min: 1 · max: 150Required

Discount code generated when a discount coupon is created through the Coupon Service.

currencystring · min: 3 · max: 3Optional

Three-letter currency code, compliant with the ISO 4217 standard.

Pattern: [A-Z]{3}
amountnumber · doubleOptional

Discount expressed as fixed amount.

namestring · max: 150Optional

Discount displayed name.

discountRatenumber · doubleOptional

Discount expressed as a percentage of the price.

discountCalculationTypestring · enumOptional

Determines whether the coupon is applied to the total or subtotal value of the order.

Default: SUBTOTALPossible values:
calculationTypestring · enum · max: 30OptionalDeprecated

Calculation type specifies how the discount should be calculated. It can be set to one of the following:

  • ApplyDiscountBeforeTax
  • ApplyDiscountAfterTax

The field is deprecated and is not used in calculatedPrice fields. The calculated price takes into account site's settings where:

  • includesTax=true results in ApplyDiscountAfterTax
  • includesTax=false results in ApplyDiscountBeforeTax
Default: ApplyDiscountBeforeTaxPossible values:
Responses
post
/cart/{tenant}/carts/{cartId}/discounts

Removing all discounts from cart

delete

Removes all discounts applied to the specified cart.


Required scopes

  • cart.cart_manage

    Note: This scope is only required for OAuth2 authorization method to authorize the request with the access_token.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Available scopes:
  • : Needed to manage carts.
Path parameters
cartIdstringRequired

Cart unique identifier generated when a cart is created.

tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Query parameters
codesstringOptional

Discount codes, listed with commas, specify the discounts slated for deletion. If no codes are provided, all discounts will be removed.

Example: code1,code2
Responses
delete
/cart/{tenant}/carts/{cartId}/discounts

No content

Removing a discount from cart

delete

Delete the discount in the cart by the provided discount Index.


Required scopes

  • cart.cart_manage

    Note: This scope is only required for OAuth2 authorization method to authorize the request with the access_token.

Authorizations
OAuth2clientCredentialsRequired
Token URL:
Available scopes:
  • : Needed to manage carts.
Path parameters
cartIdstringRequired

Cart’s unique identifier generated when a cart is created.

tenantstring · min: 3 · max: 16Required

Your Emporix tenant name.

Note: The tenant should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
discountIndexstringRequired
Responses
delete
/cart/{tenant}/carts/{cartId}/discounts/{discountIndex}

No content

Last updated

Was this helpful?