riverty logo

Docs

Create or Update Discount

Create or update a discount

Path

PUT /v1/clients/{clientId}/subscriptions/{subscriptionId}/discounts/{discountId}

Request Parameters

clientId
required
integer
Your assigned `ClientId`.
subscriptionId
required
string
Id of the subscription to retrieve.
discountId
required
string
Id of the discount.

Request Body

application/json

description
required
string
> 200 Characters
A description of the discount.
type
string
Enum:

AMOUNT

PERCENTAGE

Indicates whether a discount by fixed amount or by percentage.
value
required
number
Indicates how much the subscription will be discounted.
start
string
yyyy-MM-dd
Indicates the date that discount was applied or started.
object
Indicates how long the discount will be applied.
array
Optional. A list of key-value pairs.

Responses

Successful Request, CreateSuccessful Request, UpdateUnsuccessful Request, Subscription not Found

Request Example

    
        {
 "description": "discount.",
 "type": "PERCENTAGE",
 "value": 12.5,
 "start": "2023-09-10",
 "duration": {
  "type": "REPEATING",
  "count": 5
 },
 "metadata": [
  {
   "key": "order-id",
   "value": "a9ee9996-e941-4aa8-90b9-4b047c4afe87"
  }
 ]
}
    

Response Example

    
        {
 "id": "discount-id-1",
 "description": "discount.",
 "type": "PERCENTAGE",
 "value": 12.5,
 "start": "2023-09-10T13:04:40.020Z",
 "duration": {
  "type": "REPEATING",
  "count": 5
 },
 "metadata": [
  {
   "key": "order-id",
   "value": "a9ee9996-e941-4aa8-90b9-4b047c4afe87"
  }
 ],
 "createdAt": "2022-09-39T07:29:04.407Z",
 "_links": [
  {
   "method": "GET",
   "href": "https://api.riverty.io/subscription/v1/clients/1234/subscriptions/subscription-id-1/discounts/discount-id-1",
   "rel": "self",
   "target": "API"
  },
  {
   "method": "GET",
   "href": "https://api.riverty.io/subscription/v1/clients/1234/subscriptions/subscription-id-1",
   "rel": "subscription",
   "target": "API"
  }
 ]
}