---
title: "Coupons actions, commands, and pipelines"
slug: "coupons-actions-commands-and-pipelines"
abstract: ""
---
# Coupons actions, commands, and pipelines

The following table describes the coupons actions, commands, and pipelines:

| **Action/Command/Pipeline** | **Description** |
| --- | --- |
| `AddCoupon`<br><br>`AddCouponCommand`<br><br>`AddCouponToCartPipeline` | Adds a coupon to a cart using a coupon code.<br><br>It has the following parameters:<br><br><ul><li>`cartId`: the identifier of the cart (string)</li><li>`couponCode`: the identifier of the coupon (string)</li></ul><br><br>To add a coupon to a cart using a coupon code, this action, command and pipeline:<br><br><ol><li>Validates the coupon by loading the coupon based on the coupon code.</li><li>Retrieves the CartCouponsComponent from the cart.</li><li>Checks if this coupon code is already added.</li><li>Creates a new CartCoupon object.</li><li>Populates: IsValid = true, promotion = coupon.Promotion.</li><li>Adds new CartCoupon object to CartCouponsComponent list property.</li></ol> |
| `AddPrivateCoupon`<br><br>`AddPrivateCouponCommand`<br><br>`AddPrivateCouponPipeline` | Generates a batch of private coupons, adding those coupons to a list of unallocated coupons associated to the promotion. Uses the prefix and suffix combined with a generated string to form a complete unique coupon code.<br><br>It has the following parameters:<br><br><ul><li>`PromotionId`: the identifier of a promotion the coupon qualifies for (string)</li><li>`Prefix` : a prefix to apply to the generated codes (string)</li><li>`Suffix`: a Suffix to apply to the generated codes (string)</li><li>`Total`: the number of private coupons to generate (integer)</li></ul> |
| `AddPublicCoupon`<br><br>`AddPublicCouponCommand`<br><br>`AddPublicCouponPipeline` | Creates a public coupon to be associated with a promotion.<br><br>It has the following parameters:<br><br><ul><li>`PromotionId`: the identifier of a promotion the coupon qualifies for (string)</li><li>`CouponCode`: the identifier of the coupon code (string)</li></ul> |
| `NewAllocation`<br><br>`NewCouponAllocationCommand`<br><br>`NewCouponAllocationPipeline` | Allocates a batch of coupons from a private coupon group associated with the promotion. This moves the list of coupons from the unallocated coupons list to the allocated coupons list. This returns a list of coupon codes that have been allocated.<br><br>It has the following parameters:<br><br><ul><li>`PromotionId`: the identifier of a promotion to allocate from (string)</li><li>`PrivateCouponGroupId`: the identifier of the PrivateCouponGroup to allocate from (string)</li><li>`Total`: the number of private coupons to allocate (integer)</li></ul> |
| `RemoveCoupon`<br><br>`RemoveCouponCommand`<br><br>`RemoveCouponFromCartPipeline` | Removes a coupon from the cart.<br><br>It has the following parameters:<br><br><ul><li>`cartId`: the identifier of the cart (string)</li><li>`couponCode`: the identifier of the coupon (string)</li></ul> |