In this topic:

How to add a usage rule to order item?

When creating an order, you can add a new usage rule to the order item. In the request body, indicate the type of usage rule that you want add, its specification, allowance, rate, and charge category.

Note: In the payload for creating an order, the usage_rules entity is placed within order_item_prices.

Likewise, the Gotransverse Billing API provides a way to add usage rules to order items and retrieve the existing ones.

Retrieving usage rules on order items

You can retrieve the existing usage rules available on order items by IDs.

Retrieve usage rules by the order and order item

Use this endpoint to retrieve usage rules associated with the specified order item by order and order item IDs:

GET https://example.gotransverse.com/billing/2/orders/{order_id}/order-items/{order_item_id}/usage-rules

Use this endpoint to retrieve the specified usage rule by order, order item, and usage rule IDs.

GET https://example.gotransverse.com/billing/2/orders/{order_id}/order-items/{order_item_id}/usage-rules/{id}

Retrieve usage rules by the order item

Use this endpoint to retrieve all usage rules associated with a given order item:

GET https://example.gotransverse.com/billing/2/order-items/{order_item_id}/usage-rules

Use this endpoint to retrieve a specified usage rule associated with a given order item:

GET https://example.gotransverse.com/billing/2/order-items/{order_item_id}/usage-rules/{id}

Adding usage rules to the order items

Here you can find examples of how to add the common usage rule types to order items. This list of examples is not exhaustive and should be used as a general guideline rather than index of all possible configurations.

Top