In this topic:

Overview

This guide shows you how to use the Gotransverse Billing API to create, update, and delete products, as well as manage prices and product tags. Also, this sample covers how to associate related products and create product categories.

To be able to be sold, each Product must meet the following criteria:

Terminology

Product: stands for goods or services that are offered for sale to customers. Products are organized into subscription, one-time, or add-on types.

Note: In the API, these are respectively categorized as: customer-subscription, general, and add-on.

Product category: a group of products containing all details associated with a product. You can also use product categories for reporting purposes.

Price: a default price at which products may be sold. You can add both one-time and recurring prices to a product.

Product tag: a label that you can use for filtering or identifying products that have one or more common characteristics as well as group products that are best suited for a specific function or task.

Creating a product category

Each product must be assigned to a product category before it is available to customers. With product categories, you can organize related products for ease of managing and reporting purposes.

Let’s create a new product category:

POST https://example-tract-api.com/billing/2/product-categories

Request

{
  "name": "Product Category",
  "description": "additional information",
  "status": "ACTIVE"
}

Response

{
  "id": "1406",
  "name": "Product Category",
  "description": "additional information",
  "status": "ACTIVE"
}			

Creating a product

Now, we can create a product with a certain name, type, and introduction date. A product can be of the customer-subscription, general, or add-on types. Let’s take a quick look at what product type you may need:

  • Subscription (customer-subscription): a product with a recurring charge. Optionally, it can have a one-time price too. An example of the customer-subscription is a cable TV subscription.
  • One-Time (general): a product that is sold one time only. An example could be an initiation fee for a cable subscription.
  • Add-on (add-on): an addition to another product. This add-on product should have a parent product of the subscription type. With add-on products, you can define additional services on top of base charges. An example could be additional premium channels package on a cable subscription.

To create a new product, use the following endpoint and sample payload:

POST https://example-tract-api.com/billing/2/products

Request

{
  "product_type": "customer-subscription",
  "name": "Product 1",
  "description": "additional information on product",  
  "introduction_date": "2018-08-10", 
  "product_category": {
     "id": "1406"
  }
}			

Response

{
   "product_type": "customer-subscription",
   "id": "24362",
   "name": "Product 1",
   "description": "additional information on product",
   "serialized": true,
   "taxable": false,
   "trial": false,
   "state": "DRAFT",
   "requires_agreement": false,
   "default_quantity": 1,
   "product_category": {
   	 "id": "1406",
 	 "name": "Product Category"
	},
   "min_service_resources": 0,
   "max_service_resources": 0,
   "trial_override": false,
   "product_tags": [],
   "introduction_date": "2018-08-10T00:00:00-05:00",
   "rule_override": false,
   "rule_type": "TAPERED",
   "rule_mode": "ROOT",
   "consume_prepaid_balance": false
}			

Updating a product

To modify the needed product, use the following endpoint specifying parameters that you want to change:

PUT https://example-tract-api.com/billing/2/products/{id}

Deleting a product

To delete a product that you no longer need, use the following endpoint:

DELETE https://example-tract-api.com/billing/2/products/{id}

Activating a product

After you have specified the product prices, you can move it to the AVAILABLE status, meaning it is available for purchasing.

POST https://example-tract-api.com/billing/2/products/{id}/activate

Response: 204

Top