Product Custom Fields

With product custom fields, you can capture additional information about your product. Once you have created a product custom field in the original Gotransverse user interface 1.0, you can retrieve available custom fields and related references with the Gotransverse Billing API.

To use the Custom Fields functionality, you have to populate existing custom fields with the custom field values. When needed, you can also edit and delete desired custom field values.

Retrieving the configured custom fields and related references

To retrieve existing custom fields, use the following endpoints:

GET https://example.gotransverse.com/billing/2/product-custom-fields
GET https://example.gotransverse.com/billing/2/product-custom-fields/{id}

To retrieve existing list values for a product custom field with the specified ID, use the following endpoint:

GET https://example.gotransverse.com/billing/2/product-custom-fields/{custom_field_id}/references

Working with product custom field values

The Gotransverse Billing API provides a way to retrieve the available custom field values and add new ones to the existing custom fields. You can also edit and delete custom field values that you no longer need.

Retrieving product custom field values

Use the following endpoints to retrieve product custom field values:

GET https://example.gotransverse.com/billing/2/products/{product_id}/custom-field-values
GET https://example.gotransverse.com/billing/2/products/{product_id}/custom-field-values/{id}

Creating a new product custom field value

Use the following endpoint and sample request body to create a new custom field value for the exiting custom field:

POST https://example.gotransverse.com/billing/2/products/{product_id}/custom-field-values

Request

{
  "custom_field_value_type": "product",
  "value": "custom field value #1",
  "custom_field": {
      "id": "2330",
	  "name": "sample product custom field #1",
	  "custom_field_type": "product"
   }
}

Response

{
  "custom_field_value_type": "product",
  "id": "171358",
  "value": "custom field value #1",
  "custom_field": {
       "custom_field_type": "product",
	   "id": "2330",
	   "name": "sample product custom field #1"
  }
}

Editing and deleting product custom field values

Use the following endpoint to edit the existing custom field value. In the request body, specify the desired custom field value and its type:

PUT https://example.gotransverse.com/billing/2/products/{product_id}/custom-field-values/{id}

Request

{
  "custom_field_value_type": "product",
  "value": "updated custom field value #1"
}

Response

{
  "custom_field_value_type": "product",
  "id": "171358",
  "value": "updated custom field value #1",
  "custom_field": {
       "custom_field_type": "product",
	   "id": "2330",
	   "name": "sample product custom field #1"
   }
}

Use the following endpoint to delete the desired custom field value:

DELETE https://example.gotransverse.com/billing/2/products/{product_id}/custom-field-values/{id} >

Note: You cannot delete a custom field value that is in use.