Orders-orderId-account-products-productId-discounts:PUT

From Hostway API Documentation
Revision as of 16:31, 27 September 2013 by Mike.robski (Talk | contribs)
Jump to: navigation, search

PUT /orders/{orderId}/account/products/{productId}/discounts

Set discounts for a Product in an Order. Discounts will be applied only to the specified product. Note: This will replace any existing discounts that were configured for the specified product.

Contents


Request

PUT /orders/{orderId}/account/products/{productId}/discounts

Request Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.
productId - string
UUID specifying the product for which actions are to be performed

URI Parameters

None.

Request Headers

Content-Type
Required. Set this header to application/json; charset=UTF-8
Cookie
A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.

Request Body

{
  "discounts": [
    {
      "priceName": "recurring",
      "recurrences": -1,
      "type": "amount",
      "value": "1.00"
    }
  ]
}
 

Parameters

discounts - list
A list of discounts. Each discount contains the following:
priceName - string
The type of price to which the discount will be applied.
Validation: Should match the fee types configured in the back-end (eg. 'recurring').
recurrences - integer
The number of times that the discount will be applied. A value of "-1" means the discount will be applied every time the fee is charged.
Validation: Should be either a positive integer or -1.
Note: Value must be -1 if the priceName is "recurring".
type - string
Specifies the discount type which determines the method used to calculate the amount that is discounted. Possible values are:
amount: Discount will be treated as an exact amount
percent: Discount will be treated as a percentage
Validation: Should be set to either amount or percent.
value - string
The discount amount. The value will be interpreted based on the specified discount type.
Validation: Should be a positive number.

Response

Status Code

200 OK
The discount was successfully set.
400 Bad Request
Returned if discount data is invalid.
401 Unauthorized
The request was not properly authorized.
403 Forbidden
The client does not have sufficient privileges.
404 Not Found
Returned if the order could not be found.

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox