Skip to content

Charges

It is possible to charge Consumers for their Service Items and Change Instances. This allows Service Owners to assign a value to their Services and encourage proper maintenance of the Service Items.

Types

NetOrca currently supports two types of charges for each Service:

  • Cost per Change: This is a fixed fee that will apply every time a Change Instance from the Service is generated
  • Monthly Cost: This is a monthly fee that will be calculated each month for the 'IN_SERVICE' Service Items

Charges Configuration

Service charges need to be specified in the Service Schema. Within the JSON Schema, there is a metadata key. You can define the charges in the metadata of the Schema as follows:

"metadata": {
    "monthly_cost": 50,
    "cost_per_change": 100
}

A full example of a Service Schema with charges:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/service.schema.json",
  "title": "VM",
  "description": "Schema of a Virtual Machine",
  "type": "object",
  "metadata": {
    "monthly_cost": 50,
    "cost_per_change": 100
  },
  "properties": {
    "name": {
      "type": "string"
    },
    "cpu": {
      "type": "integer",
      "title": "cpu cores",
      "description": "Number of cpu cores",
    },
    "memory": {
      "type": "integer",
      "title": "Memory",
      "description": "Memory in GB",
      "default": "8",
      "examples": ["8", "16", "24"]
    }
  },
  "required": ["name", "cpu", "memory"]
}

If a Consumer submission generates Change Instances or makes Service Items IN_SERVICE from a Service with the Schema above, Charges will be created.

Charges Endpoint

To fetch the list of charges for both Service Owners and Consumers:

GET /v1/marketplace/<pov:"serviceowner"/"consumer">/charges/ HTTP/1.1
Content-Type: application/json
Authorization: Token <YOUR_TOKEN>

It is not possible to create or delete any charge. Hence, the POST and DELETE HTTP methods are forbidden. However, it is possible to mark any charge object as processed in NetOrca

Processing Charges

Charge records in NetOrca alone might not be flexible enough for many big organizations. They usually need to integrate it with other third party billing software. Service Owners are able to process the charges outside NetOrca, and then mark them as processed. Therefore, besides list and detail endpoints, each charge record in NetOrca's database has a boolean field called processed. By default, the value for this field is false. When they are processed in the third party software, the Service Owner can change the field to true

Here is the way to process charges:

PUT /v1/marketplace/serviceowner/charges/<charge_id> HTTP/1.1
Content-Type: application/json
Authorization: Token <YOUR_TOKEN>
{
    "processed": true
}