# Refresh promotions on an order

Re-calculates promotion discounts, removes promotions that are no longer valid, and adds eligible promotions where AutoApply=true (up to limit of 100)

Endpoint: POST /orders/{direction}/{orderID}/refreshpromotions
Version: 1.0.457.36910
Security: OAuth2

## Path parameters:

  - `direction` (string, required)
    Direction of the order, from the current user's perspective.
    Enum: "Incoming", "Outgoing", "All"

  - `orderID` (string, required)
    ID of the order.

## Response 200 fields (application/json):

  - `PromosAdded` (array)
    Promotions that were auto-applied.
    Example: [{"LineItemID":"","Amount":0,"ID":"","LineItemLevel":false,"Code":"","Name":"","RedemptionLimit":0,"RedemptionLimitPerUser":0,"RedemptionCount":0,"QuantityLimitPerOrder":0,"ItemLimitPerOrder":0,"ItemSortBy":"","Description":"","FinePrint":"","StartDate":"2018-01-01T00:00:00-06:00","ExpirationDate":"2018-01-01T00:00:00-06:00","EligibleExpression":"","ValueExpression":"","CanCombine":false,"AllowAllBuyers":false,"OwnerID":"","AutoApply":false,"Active":false,"UseIntegration":false,"Priority":0,"xp":{}}]

  - `PromosAdded.LineItemID` (string)

  - `PromosAdded.Amount` (number)

  - `PromosAdded.ID` (string)

  - `PromosAdded.LineItemLevel` (boolean)
    If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level.

  - `PromosAdded.Code` (string)
    Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0.

  - `PromosAdded.Name` (string)

  - `PromosAdded.RedemptionLimit` (integer)
    Limit the total number of orders this promotion can be applied to across all users.

  - `PromosAdded.RedemptionLimitPerUser` (integer)
    Limit the total number of orders this promotion can be applied to per user.

  - `PromosAdded.RedemptionCount` (integer)
    The number of times this promotion has been applied to an order.

  - `PromosAdded.QuantityLimitPerOrder` (integer)
    Can only be used when LineItemLevel is true and ItemLimitPerOrder does not have a value. When defined the ValueExpression will be the discount applied to each qualifying quantity of eligible items. When no ItemSortBy is defined, items will be sorted by DateAdded ascending.

  - `PromosAdded.ItemLimitPerOrder` (integer)
    Can only be used when LineItemLevel is true and QuantityLimitPerOrder does not have a value. Limits the number of items the promotion will apply to when eligible. When no ItemSortBy is defined, items will be sorted by DateAdded ascending.

  - `PromosAdded.ItemSortBy` (string)
    Comma delimited list of properties to sort by. Can only be used when ItemLimitPerOrder is true. Used to determine the order in which the promotion is applied to the specified limit of items. Use ! to reverse sort order on a property.

  - `PromosAdded.Description` (string)

  - `PromosAdded.FinePrint` (string)
    For reference only. Terms, conditions, and other legal jargon.

  - `PromosAdded.StartDate` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `PromosAdded.ExpirationDate` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `PromosAdded.EligibleExpression` (string)
    The expression evaluated to determine if an item or order is eligible for a promotion. See rules engine documentation for formatting details.

  - `PromosAdded.ValueExpression` (string)
    The expression evaluated to determine the discount amount of an eligible promotion. See rules engine documentation for formatting details.

  - `PromosAdded.CanCombine` (boolean)
    If true, the promotion can be applied to an order that already other promotions applied, as long as they can also be combined.

  - `PromosAdded.AllowAllBuyers` (boolean)
    Allow promo to be used by all buyers without creating explicit assignments.

  - `PromosAdded.OwnerID` (string)
    ID of the organization that owns the promotion. Only the marketplace owner can override the OwnerID on create.

  - `PromosAdded.AutoApply` (boolean)

  - `PromosAdded.Active` (boolean)

  - `PromosAdded.UseIntegration` (boolean)

  - `PromosAdded.Priority` (integer)
    Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint.

  - `PromosAdded.GeneratedCodeCount` (integer)
    Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code.

  - `PromosAdded.GeneratedCodeLength` (integer)
    Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0.

  - `PromosAdded.GeneratedCodePrefix` (string)
    Optional prefix prepended to generated codes, separated by a dash.

  - `PromosAdded.xp` (object)
    Example: {}

  - `PromosRemoved` (array)
    Promotions that were removed due to ineligibility or other reasons.
    Example: [{"ErrorCode":"","Reason":"","LineItemID":"","Amount":0,"ID":"","LineItemLevel":false,"Code":"","Name":"","RedemptionLimit":0,"RedemptionLimitPerUser":0,"RedemptionCount":0,"QuantityLimitPerOrder":0,"ItemLimitPerOrder":0,"ItemSortBy":"","Description":"","FinePrint":"","StartDate":"2018-01-01T00:00:00-06:00","ExpirationDate":"2018-01-01T00:00:00-06:00","EligibleExpression":"","ValueExpression":"","CanCombine":false,"AllowAllBuyers":false,"OwnerID":"","AutoApply":false,"Active":false,"UseIntegration":false,"Priority":0,"xp":{}}]

  - `PromosRemoved.ErrorCode` (string)

  - `PromosRemoved.Reason` (string)

  - `PromosRemoved.LineItemID` (string)

  - `PromosRemoved.Amount` (number)

  - `PromosRemoved.ID` (string)

  - `PromosRemoved.LineItemLevel` (boolean)
    If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level.

  - `PromosRemoved.Code` (string)
    Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0.

  - `PromosRemoved.Name` (string)

  - `PromosRemoved.RedemptionLimit` (integer)
    Limit the total number of orders this promotion can be applied to across all users.

  - `PromosRemoved.RedemptionLimitPerUser` (integer)
    Limit the total number of orders this promotion can be applied to per user.

  - `PromosRemoved.RedemptionCount` (integer)
    The number of times this promotion has been applied to an order.

  - `PromosRemoved.QuantityLimitPerOrder` (integer)
    Can only be used when LineItemLevel is true and ItemLimitPerOrder does not have a value. When defined the ValueExpression will be the discount applied to each qualifying quantity of eligible items. When no ItemSortBy is defined, items will be sorted by DateAdded ascending.

  - `PromosRemoved.ItemLimitPerOrder` (integer)
    Can only be used when LineItemLevel is true and QuantityLimitPerOrder does not have a value. Limits the number of items the promotion will apply to when eligible. When no ItemSortBy is defined, items will be sorted by DateAdded ascending.

  - `PromosRemoved.ItemSortBy` (string)
    Comma delimited list of properties to sort by. Can only be used when ItemLimitPerOrder is true. Used to determine the order in which the promotion is applied to the specified limit of items. Use ! to reverse sort order on a property.

  - `PromosRemoved.Description` (string)

  - `PromosRemoved.FinePrint` (string)
    For reference only. Terms, conditions, and other legal jargon.

  - `PromosRemoved.StartDate` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `PromosRemoved.ExpirationDate` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `PromosRemoved.EligibleExpression` (string)
    The expression evaluated to determine if an item or order is eligible for a promotion. See rules engine documentation for formatting details.

  - `PromosRemoved.ValueExpression` (string)
    The expression evaluated to determine the discount amount of an eligible promotion. See rules engine documentation for formatting details.

  - `PromosRemoved.CanCombine` (boolean)
    If true, the promotion can be applied to an order that already other promotions applied, as long as they can also be combined.

  - `PromosRemoved.AllowAllBuyers` (boolean)
    Allow promo to be used by all buyers without creating explicit assignments.

  - `PromosRemoved.OwnerID` (string)
    ID of the organization that owns the promotion. Only the marketplace owner can override the OwnerID on create.

  - `PromosRemoved.AutoApply` (boolean)

  - `PromosRemoved.Active` (boolean)

  - `PromosRemoved.UseIntegration` (boolean)

  - `PromosRemoved.Priority` (integer)
    Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint.

  - `PromosRemoved.GeneratedCodeCount` (integer)
    Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code.

  - `PromosRemoved.GeneratedCodeLength` (integer)
    Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0.

  - `PromosRemoved.GeneratedCodePrefix` (string)
    Optional prefix prepended to generated codes, separated by a dash.

  - `PromosRemoved.xp` (object)
    Example: {}

## Response 4XX fields (application/json):

  - `StatusCode` (integer)
    Example: "404"

  - `ErrorCode` (string)
    Example: "NotFoundError"

  - `Message` (string)
    Example: "Object not found"

  - `Data` (object)
    Example: {"ObjectType":"","ObjectID":""}


