In this topic:

Product Prices

The Product Price is required before a product can be sold. Products can have both recurring and one-time prices depending on your business needs.

  • One-time price stands for items with charges that occur once only.
  • Recurring price stands for items with recurring charges.

As different payloads are needed for creating one-time and recurring prices, let’s look at an example for each.

Retrieving charge categories

To add a product price, we should first retrieve the available charge categories. Select the needed one, and note its ID:

GET https://example-tract-api.com/billing/2/charge-categories

Response

{
 [
  {
   "charge_category_type": "adjustment",
   "id": "2882",
   "name": "Default Adjustment Category",
   "description": "Default Adjustment Category",
   "priority": 1,
   "status": "ACTIVE"
  },
  {
   "charge_category_type": "price",
   "id": "2884",
   "name": "Default",
   "description": "Default Price Category",
   "priority": 1,
   "status": "ACTIVE"
  }
 … [other charge categories]
}

Adding a recurring price

A Product can have one or more recurring prices, provided that each recurring price has a different recurrence period. For example, you can set a recurring price at 100 dollars per quarter and another recurring price at 120 dollars with the recurrence period of one month.

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

Request

{
  "product_price_type": "recurring",
  "tapered": false,
  "currency_code": "USD",
  "category": {
    "charge_category_type": "price",
    "id": "2884"
  },
  "valid_from": "2018-01-01",
  "price_override": true,
  "price_ranges": [
   {
     "price_range_type": "product",
     "price": 200,
	 "level": 1,
	 "quantity_begin_range": 0,
	 "currency_code": "USD"
	}
   ],
  "recurrence_period": "BILL_CYCLE",
  "prorated_on_order": false,
  "prorated_on_cancel": false,
  "prorated_on_order_no_charge": false,
  "bill_in_advance": true
 }
}

Response

[
{
  "product_price_type": "recurring",
  "id": "42880",
  "tapered": false,
  "currency_code": "USD",
  "category": {
     "charge_category_type": "price",
	 "id": "2884",
	 "name": "Default"
   },
  "valid_from": "2018-01-01T00:00:00-06:00",
  "price_override": true,
  "price_ranges": [
   {
     "price_range_type": "product",
     "id": "46742",
	 "price": 200,
	 "level": 1,
	 "quantity_begin_range": 0,
	 "currency_code": "USD"
    }
	],
  "payment_on_purchase_required": false,
  "price_group": null,
  "recurring_payment_required": false,
  "recurrence_period": "BILL_CYCLE",
  "prorated_on_order": false,
  "prorated_on_cancel": false,
  "prorated_on_order_no_charge": false,
  "bill_in_advance": true,
  "usage_rules": []
}
				

Adding a one-time price

To add an one-time price, use the endpoint below. In the request payload, specify the desired parameter values.

Note: A product can have only one one-time price in the same currency.

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

Request

{
 "product_price_type": "one-time",
 "tapered": false,
 "currency_code": "USD",
 "category": {
     "charge_category_type": "price",
     "id": "2884",
	 "name": "Default"
   },
 "valid_from": "2018-10-10",
 "price_override": true,
 "price_ranges": [
   {
	  "price_range_type": "product",
	  "price": 200,
	  "level": 1,
      "quantity_begin_range": 0,
	  "currency_code": "USD"
   }
   ]
}

Response

{
  "product_price_type": "one-time",
  "id": "42938",
  "tapered": false,
  "currency_code": "USD",
  "category": {
   	 "charge_category_type": "price",
     "id": "2884",
	 "name": "Default"
   },
  "valid_from": "2018-10-10T00:00:00-05:00",
  "price_override": true,
  "price_ranges": [
   {
     "price_range_type": "product",
     "id": "46800",
	 "price": 200,
	 "level": 1,
	 "quantity_begin_range": 0,
	 "currency_code": "USD"
	}
	],
  "payment_on_purchase_required": false,
  "price_group": null,
  "charge_during_renewal": false,
  "allow_scheduled_charges": false
}
				

Once you have added all desired prices, you can activate the product and create an order.

Top