riverty logo

Docs

Start Subscription

Create a new or update an existing subscription.

Path

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

Request Parameters

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

Request Body

application/json

customerNumber
required
string > 100 Characters
Id of the customer to assign this subscription to.
subscriptionProductId
required
string > 100 Characters
Id of the subscription product.
billingDayOffset
required
integer
The billing day offset. Use this to adjust the billing day.
metadata
array
Optional. A list of key-value pairs.
activeFrom
required
string
The date from which date this subscription is active.

Responses

Successful Request, Subscription UpdatedSuccessful Request, Subscription CreatedUnsuccessful Request, Bad/Missing Information

Response Example

    
        {
 "id": "subscription-id-1",
 "customerNumber": "customer-number-1",
 "subscriptionProductId": "subscription-product-id-1",
 "metadata": [
  {
   "key": "order-id",
   "value": "a9ee9996-e941-4aa8-90b9-4b047c4afe87"
  }
 ],
 "createdAt": "2022-01-28T13:04:40.020Z",
 "active": {
  "from": "2022-09-28",
  "until": "9999-12-31"
 },
 "status": "ACTIVE",
 "closeDetails": {
  "canceledByClient": false,
  "canceledByBillingPartner": false,
  "terminatedByClient": false
 },
 "billingDetails": {
  "nextBillingDate": "2022-09-30",
  "billingDayOffset": 2
 },
 "currentPeriod": {
  "start": "2022-09-28",
  "end": "2022-10-27"
 },
 "_links": [
  {
   "method": "GET",
   "href": "https://api.horizonafs.io/subscription/v1/clients/1234/subscriptions/subscription-id-1",
   "rel": "self"
  },
  {
   "method": "GET",
   "href": "https://api.horizonafs.io/subscription/v1/clients/1234/subscription-products/subscription-product-id-1",
   "rel": "subscription-product"
  },
  {
   "method": "PUT",
   "href": "https://api.horizonafs.io/subscription/v1/clients/1234/subscriptions/subscription-id-1/cancellation",
   "rel": "cancellation"
  },
  {
   "method": "PUT",
   "href": "https://api.horizonafs.io/subscription/v1/clients/1234/subscriptions/subscription-id-1/termination",
   "rel": "termination"
  },
  {
   "method": "GET",
   "href": "https://api.horizonafs.io/subscription/v1/clients/1234/subscriptions/subscription-id-1/timeline",
   "rel": "timeline"
  }
 ]
}
    

Request Example

    
        {
 "customerNumber": "customer-number-1",
 "subscriptionProductId": "subscription-product-id-1",
 "billingDayOffset": 2,
 "metadata": [
  {
   "key": "order-id",
   "value": "a9ee9996-e941-4aa8-90b9-4b047c4afe87"
  }
 ],
 "activeFrom": "2022-09-28"
}