Visit Main Site
Join Partner Program
Login
     
Introduction
Installation
Python
PHP
GitHub
Composer
Documentation
Account
Item
Item Fulfillment
Item Receipts
Order
Usage
Express
Invoice
Payment
Credit Note
Refund
Purchase Order
Purchase Invoice
Purchase Payment
Purchase Credit Notes
Purchase Refund
Gift Certificate
Return Merchandise Authorizations
RVA
Settings
Integration
Portal
Communications
Reports
Proforma
Custom Objects
Rental Asset Profiles
User settings
Labour
Custom Development
Custom Component
Custom Attribute
Custom Object
Custom Database
» Usages SDK Documentation

Listing Usages

Function: usage_list()

Purpose

This API retrieves the full paginated list of usage records logged against billable charge items via GET /api/v3/usages. The response returns a usages array — each entry exposing identification (uuid, version), the bound charge item (chargeItemUuid, chargeItemName, uom), the metering window (chargingPeriod, startTime, endTime), the recorded quantity, the increment type (e.g. INCREMENTAL), the charge status, the source/origin marker, audit metadata (createdBy, createdOn, lastUpdatedBy, lastUpdatedOn), tenant-defined custom attributes, and an optional usage reference — alongside a standard pagination block (records, limit, offset, previous/next page URLs). Snake_case API keys are mapped to camelCase DTO fields automatically by the SDK's deserializer.

Parameters

Parameter nameTypeDescription
limitIntegerMaximum number of usages to return per page (optional).
offsetIntegerNumber of usages to skip for pagination (optional).
directionSortDirectionSort direction (ASC/DESC) for the result set (optional).
order_byStringField name to sort the result set by (optional).

Use Case

Billing and metering teams need a full sweep of every recorded usage event — across orders, accounts, and charge items — to drive invoicing runs, audit reconciliation, and downstream analytics. Building this view by walking each order is brittle; the dedicated usage-listing endpoint avoids that fan-out by returning every usage record in a single paginated payload. Telco and SaaS integrations consume the listing to verify that batch usage uploads landed correctly. Finance pipelines pull the list to compute revenue accruals against unbilled usage. The Python SDK exposes this through order.usage_list() returning a strongly typed UsageListDTO.

Python
PHP
def test_order_usage_list():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        response = exsited_sdk.order.usage_list()
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testReadAll()
{
    try {
        $queryParams = '?order_by=created_on&direction=desc&limit=10';
        $response = $this->usagesService->readAll('v3', $queryParams);
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a UsageListDTO containing a usages list of UsageDataDTO entries (one per usage record) and a pagination block (PaginationDTO). Each usage entry exposes 18 fields — uuid, version, chargeItemUuid, chargeItemName, chargingPeriod, quantity, uom, startTime, endTime, type, chargeStatus, source, createdBy, createdOn, lastUpdatedBy, lastUpdatedOn, customAttributes, and usageReference — covering identification, charge binding, metering window, audit, and runtime state.

Python
PHP
UsageListDTO(
    usages=[
        UsageDataDTO(
            uuid='USAGE_UUID',
            version='VERSION',
            chargeItemUuid='CHARGE_ITEM_UUID',
            chargeItemName='CHARGE_ITEM_NAME',
            chargingPeriod='CHARGING_PERIOD',
            quantity='QUANTITY',
            uom='UOM',
            startTime='START_TIME',
            endTime='END_TIME',
            type='TYPE',
            chargeStatus='CHARGE_STATUS',
            source='SOURCE',
            createdBy='CREATED_BY',
            createdOn='CREATED_ON',
            lastUpdatedBy='LAST_UPDATED_BY',
            lastUpdatedOn='LAST_UPDATED_ON',
            customAttributes=[],
            usageReference='USAGE_REFERENCE'
        )
    ],
    pagination=PaginationDTO(
        records='TOTAL_RECORDS',
        limit='PAGE_LIMIT',
        offset='PAGE_OFFSET',
        previousPage='PREVIOUS_PAGE_URL',
        nextPage='NEXT_PAGE_URL'
    )
)
{
    "usages": [
        {
            "uuid": "USAGE_UUID",
            "version": "VERSION",
            "charge_item_uuid": "CHARGE_ITEM_UUID",
            "charge_item_name": "CHARGE_ITEM_NAME",
            "charging_period": "CHARGING_PERIOD",
            "quantity": "QUANTITY",
            "uom": "UOM",
            "start_time": "START_TIME",
            "end_time": "END_TIME",
            "type": "TYPE",
            "charge_status": "CHARGE_STATUS",
            "source": "SOURCE",
            "created_by": "CREATED_BY",
            "created_on": "CREATED_ON",
            "last_updated_by": "LAST_UPDATED_BY",
            "last_updated_on": "LAST_UPDATED_ON",
            "custom_attributes": [],
            "usage_reference": "USAGE_REFERENCE"
        }
    ],
    "pagination": {
        "records": "TOTAL_RECORDS",
        "limit": "PAGE_LIMIT",
        "offset": "PAGE_OFFSET",
        "previous_page": "PREVIOUS_PAGE_URL",
        "next_page": "NEXT_PAGE_URL"
    }
}

Retrieving Usage Details

Function: usage_details()

Purpose

This API retrieves a single usage record by its UUID via GET /api/v3/usages/{uuid}. The response returns the full usage object — chargeItemUuid binding, metering window (startTime, endTime, chargingPeriod), quantity, increment type, charge status, source/origin marker, audit fields, custom attributes, and an optional usage reference. The SDK exposes this through order.usage_details(uuid) returning a typed UsageDataDTO. The endpoint underpins record-level inspection workflows (drill-down from a usage list, dispute resolution, mid-billing-cycle audit).

Parameters

Parameter nameTypeDescription
uuidStringThe UUID of the usage record to retrieve.

Use Case

Billing analysts and customer success agents drill into individual usage records when an end customer disputes a charge, when a metering integration reports a mismatch, or when the team needs to confirm that a specific event was captured before invoicing closes. Reconciliation tooling fetches one record at a time to compare against the source-of-truth metering store. Support workflows invoke this endpoint from a usage detail page to render the full state of a single record before allowing further modify/update/delete actions.

Python
PHP
def test_order_usages_details():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        response = exsited_sdk.order.usage_details(uuid='USAGE_UUID')
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testReadDetails()
{
    $uuid = '{usage_uuid}';
    try {
        $response = $this->usagesService->readDetails($uuid, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a UsageDataDTO carrying the full usage record. Note: the SDK currently binds the response object directly to UsageDataDTO (flat, no envelope). All 18 fields are populated where the API returned a value.

Python
PHP
UsageDataDTO(
    uuid='USAGE_UUID',
    version='VERSION',
    chargeItemUuid='CHARGE_ITEM_UUID',
    chargeItemName='CHARGE_ITEM_NAME',
    chargingPeriod='CHARGING_PERIOD',
    quantity='QUANTITY',
    uom='UOM',
    startTime='START_TIME',
    endTime='END_TIME',
    type='TYPE',
    chargeStatus='CHARGE_STATUS',
    source='SOURCE',
    createdBy='CREATED_BY',
    createdOn='CREATED_ON',
    lastUpdatedBy='LAST_UPDATED_BY',
    lastUpdatedOn='LAST_UPDATED_ON',
    customAttributes=[],
    usageReference='USAGE_REFERENCE'
)
{
    "usage": {
        "uuid": "USAGE_UUID",
        "version": "VERSION",
        "charge_item_uuid": "CHARGE_ITEM_UUID",
        "charge_item_name": "CHARGE_ITEM_NAME",
        "charging_period": "CHARGING_PERIOD",
        "quantity": "QUANTITY",
        "uom": "UOM",
        "start_time": "START_TIME",
        "end_time": "END_TIME",
        "type": "TYPE",
        "charge_status": "CHARGE_STATUS",
        "source": "SOURCE",
        "created_by": "CREATED_BY",
        "created_on": "CREATED_ON",
        "last_updated_by": "LAST_UPDATED_BY",
        "last_updated_on": "LAST_UPDATED_ON",
        "custom_attributes": [],
        "usage_reference": "USAGE_REFERENCE"
    }
}

Adding a Single Usage

Function: add_usage()

Purpose

This API submits a single usage record against a billable charge item via POST /api/v3/usages. The request wraps the new usage under a usage root key and supplies the chargeItemUuid binding, metering window (chargingPeriod, startTime, endTime), recorded quantity, and increment type (e.g. INCREMENTAL). The system persists the record, computes its charge status against the bound rating rule, and returns the created object — including system-generated fields (uuid, version, chargeStatus, source, audit timestamps). The SDK exposes this through order.add_usage(request_data) accepting a UsageCreateDTO and returning the post-create state for immediate caching/UI refresh.

Parameters

Parameter nameTypeDescription
request_dataUsageCreateDTORequest payload wrapping a UsageDataDTO under usage.

Use Case

Telco metering pipelines, SaaS API gateways, and IoT platforms call this endpoint event-by-event when streaming low-volume usage in real time. CRM and customer-portal integrations call it to log discretionary usage adjustments (manual concessions, courtesy credits, one-off events) outside of bulk batches. The single-usage path is also used for retry-of-one in batch flows where a specific record failed validation and needs an isolated retry. The Python SDK now covers this in parity with the .NET SDK via order.add_usage().

Python
PHP
def test_order_usage_add():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        request_data = UsageCreateDTO(
            usage=UsageDataDTO(
                chargeItemUuid="CHARGE_ITEM_UUID",
                chargingPeriod="CHARGING_PERIOD",
                quantity="QUANTITY",
                startTime="START_TIME",
                endTime="END_TIME",
                type="TYPE"
            )
        )
        response = exsited_sdk.order.add_usage(request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testCreate()
{
    $params = [
        "usage" => [
            "order_id" => "{order_id}",
            "charge_item_uuid" => "{charge_item_uuid}",
            "quantity" => "{quantity}",
            "usage_date" => "{YYYY-MM-DD}",
            "note" => "{note}"
        ]
    ];

    try {
        $response = $this->usagesService->create($params, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a UsageCreateDTO wrapping the created UsageDataDTO under the usage field. The returned object reflects the persisted state including the new uuid, version, computed chargeStatus, source, and audit fields.

Python
PHP
UsageCreateDTO(
    usage=UsageDataDTO(
        uuid='USAGE_UUID',
        version='VERSION',
        chargeItemUuid='CHARGE_ITEM_UUID',
        chargeItemName='CHARGE_ITEM_NAME',
        chargingPeriod='CHARGING_PERIOD',
        quantity='QUANTITY',
        uom='UOM',
        startTime='START_TIME',
        endTime='END_TIME',
        type='TYPE',
        chargeStatus='CHARGE_STATUS',
        source='SOURCE',
        createdBy='CREATED_BY',
        createdOn='CREATED_ON',
        customAttributes=[],
        usageReference='USAGE_REFERENCE'
    )
)
{
    "usage": {
      "uuid": "USAGE_UUID",
      "version": "VERSION",
      "charge_item_uuid": "CHARGE_ITEM_UUID",
      "charge_item_name": "CHARGE_ITEM_NAME",
      "charging_period": "CHARGING_PERIOD",
      "quantity": "QUANTITY",
      "uom": "UOM",
      "start_time": "START_TIME",
      "end_time": "END_TIME",
      "type": "TYPE",
      "charge_status": "CHARGE_STATUS",
      "source": "SOURCE",
      "created_by": "CREATED_BY",
      "created_on": "CREATED_ON",
      "last_updated_by": "LAST_UPDATED_BY",
      "last_updated_on": "LAST_UPDATED_ON",
      "custom_attributes": [],
      "usage_reference": "USAGE_REFERENCE"
    }
}

Adding Multiple Usages (Bulk)

Function: add_multiple_usage()

Purpose

This API submits multiple usage records in a single call against the same POST /api/v3/usages endpoint, discriminated by payload shape. The bulk request wraps records under a usages array (alongside an optional pagination block) and the response splits results into a success array (records that persisted cleanly) and a failed array (records that hit validation or rating errors). The system processes each record independently — partial failures do not roll back successful inserts — so callers receive both halves of the outcome and can retry only the failed items. The SDK exposes this through order.add_multiple_usage(request_data) accepting a MultipleUsageCreateDTO and returning a MultipleUsageResponseDTO.

Parameters

Parameter nameTypeDescription
request_dataMultipleUsageCreateDTORequest payload with a usages list of UsageDataDTO entries.

Use Case

High-volume metering integrations (telco call records, SaaS API hit counters, IoT device events) batch usage submissions to reduce request overhead and stay within rate limits. Daily/hourly ETL jobs build the full batch from a staging store and submit in one call, then fan-out retries only against the failed half of the response. Migration scripts loading historical usage during a tenant cutover use the bulk path to seed thousands of pre-aggregated records without flooding the single-record endpoint. The Python SDK exposes order.add_multiple_usage() returning a typed split response so callers do not need to parse raw JSON.

Python
PHP
def test_order_multiple_usage_add():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        request_data = MultipleUsageCreateDTO(
            usages=[
                UsageDataDTO(
                    chargeItemUuid="CHARGE_ITEM_UUID_1",
                    chargingPeriod="CHARGING_PERIOD",
                    quantity="QUANTITY_1",
                    startTime="START_TIME_1",
                    endTime="END_TIME_1",
                    type="TYPE"
                ),
                UsageDataDTO(
                    chargeItemUuid="CHARGE_ITEM_UUID_2",
                    chargingPeriod="CHARGING_PERIOD",
                    quantity="QUANTITY_2",
                    startTime="START_TIME_2",
                    endTime="END_TIME_2",
                    type="TYPE"
                )
            ]
        )
        response = exsited_sdk.order.add_multiple_usage(request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testCreateBulk()
{
    $params = [
        "usages" => [
            [
                "order_id" => "{order_id}",
                "charge_item_uuid" => "{charge_item_uuid}",
                "quantity" => "{quantity}",
                "usage_date" => "{YYYY-MM-DD}",
                "note" => "{note}"
            ],
            [
                "order_id" => "{order_id_2}",
                "charge_item_uuid" => "{charge_item_uuid_2}",
                "quantity" => "{quantity_2}",
                "usage_date" => "{YYYY-MM-DD}",
                "note" => "{note}"
            ]
        ]
    ];

    try {
        $response = $this->usagesService->create($params, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a MultipleUsageResponseDTO carrying a success list of UsageDataDTO entries (records that persisted cleanly with their generated uuid/version/audit fields) and a failed list of UsageDataDTO entries (records the API rejected). Callers can iterate the failed list to build a retry batch without re-submitting the entire payload.

Python
PHP
MultipleUsageResponseDTO(
    success=[
        UsageDataDTO(
            uuid='USAGE_UUID_1',
            version='VERSION',
            chargeItemUuid='CHARGE_ITEM_UUID_1',
            chargingPeriod='CHARGING_PERIOD',
            quantity='QUANTITY_1',
            startTime='START_TIME_1',
            endTime='END_TIME_1',
            type='TYPE',
            chargeStatus='CHARGE_STATUS',
            createdBy='CREATED_BY',
            createdOn='CREATED_ON'
        )
    ],
    failed=[
        UsageDataDTO(
            chargeItemUuid='CHARGE_ITEM_UUID_2',
            chargingPeriod='CHARGING_PERIOD',
            quantity='QUANTITY_2',
            startTime='START_TIME_2',
            endTime='END_TIME_2',
            type='TYPE'
        )
    ]
)
{
    "usages": [
        {
            "uuid": "USAGE_UUID_1",
            "version": "VERSION",
            "charge_item_uuid": "CHARGE_ITEM_UUID_1",
            "charge_item_name": "CHARGE_ITEM_NAME",
            "charging_period": "CHARGING_PERIOD",
            "quantity": "QUANTITY",
            "uom": "UOM",
            "start_time": "START_TIME",
            "end_time": "END_TIME",
            "type": "TYPE",
            "charge_status": "CHARGE_STATUS",
            "source": "SOURCE",
            "created_by": "CREATED_BY",
            "created_on": "CREATED_ON",
            "last_updated_by": "LAST_UPDATED_BY",
            "last_updated_on": "LAST_UPDATED_ON",
            "custom_attributes": [],
            "usage_reference": "USAGE_REFERENCE"
        },
        {
            "uuid": "USAGE_UUID_2",
            "version": "VERSION",
            "charge_item_uuid": "CHARGE_ITEM_UUID_2",
            "charge_item_name": "CHARGE_ITEM_NAME",
            "charging_period": "CHARGING_PERIOD",
            "quantity": "QUANTITY",
            "uom": "UOM",
            "start_time": "START_TIME",
            "end_time": "END_TIME",
            "type": "TYPE",
            "charge_status": "CHARGE_STATUS",
            "source": "SOURCE",
            "created_by": "CREATED_BY",
            "created_on": "CREATED_ON",
            "last_updated_by": "LAST_UPDATED_BY",
            "last_updated_on": "LAST_UPDATED_ON",
            "custom_attributes": [],
            "usage_reference": "USAGE_REFERENCE"
        }
    ]
}

Modifying a Usage (PATCH)

Function: usage_modify()

Purpose

This API applies a partial update to an existing usage record by its UUID via PATCH /api/v3/usages/{uuid}. Only the fields supplied in the payload are touched — every other field on the record is left untouched. The system applies the change, increments the record version, and returns the updated state wrapped in a usage root key. The SDK exposes this through order.usage_modify(uuid, request_data) accepting a UsageCreateDTO and returning a UsageModifyDataDTO. Use this when only the quantity, metering window, or a custom attribute needs to change.

Parameters

Parameter nameTypeDescription
uuidStringThe UUID of the usage record to modify.

Use Case

Customer success agents and billing analysts use this endpoint when a recorded usage event needs a small correction — fixing a typo in the quantity, adjusting the metering window after a meter-reading reconciliation, or attaching a freshly added custom attribute — without re-submitting the entire record. Mid-cycle dispute resolution flows rely on PATCH because POST would create a duplicate and PUT would force the caller to re-send all the unchanged fields. Audit pipelines also use PATCH to backfill missing custom attributes onto historical records as part of metadata cleanup runs.

Python
PHP
def test_order_usage_modify():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        request_data = UsageCreateDTO(
            usage=UsageDataDTO(
                quantity="UPDATED_QUANTITY"
            )
        )
        response = exsited_sdk.order.usage_modify(uuid='USAGE_UUID', request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testChange()
{
    $uuid = '{usage_uuid}';
    $params = [
        "usage" => [
            "quantity" => "{quantity}",
            "note" => "{updated_note}"
        ]
    ];

    try {
        $response = $this->usagesService->change($uuid, $params, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a UsageModifyDataDTO wrapping the updated UsageDataDTO under the usage field. The returned object reflects the post-update state with the bumped version and refreshed audit fields.

Python
PHP
UsageModifyDataDTO(
    usage=UsageDataDTO(
        uuid='USAGE_UUID',
        version='NEW_VERSION',
        chargeItemUuid='CHARGE_ITEM_UUID',
        chargingPeriod='CHARGING_PERIOD',
        quantity='UPDATED_QUANTITY',
        startTime='START_TIME',
        endTime='END_TIME',
        type='TYPE',
        chargeStatus='CHARGE_STATUS',
        lastUpdatedBy='LAST_UPDATED_BY',
        lastUpdatedOn='LAST_UPDATED_ON'
    )
)
{
    "usage": {
        "uuid": "USAGE_UUID",
        "version": "VERSION",
        "charge_item_uuid": "CHARGE_ITEM_UUID",
        "charge_item_name": "CHARGE_ITEM_NAME",
        "charging_period": "CHARGING_PERIOD",
        "quantity": "QUANTITY",
        "uom": "UOM",
        "start_time": "START_TIME",
        "end_time": "END_TIME",
        "type": "TYPE",
        "charge_status": "CHARGE_STATUS",
        "source": "SOURCE",
        "created_by": "CREATED_BY",
        "created_on": "CREATED_ON",
        "last_updated_by": "LAST_UPDATED_BY",
        "last_updated_on": "LAST_UPDATED_ON",
        "custom_attributes": [],
        "usage_reference": "USAGE_REFERENCE"
    }
}

Updating a Usage (PUT)

Function: usage_update()

Purpose

This API replaces an existing usage record by its UUID via PUT /api/v2/usages/{uuid} (note: the SDK currently routes PUT to v2; PATCH and the rest of the family are on v3). PUT is the full-replace counterpart to PATCH — every supplied field overwrites the stored value, and any field omitted from the payload may be cleared depending on tenant configuration. The SDK exposes this through order.usage_update(uuid, request_data) accepting a UsageCreateDTO and returning a UsageUpdateDataDTO.

Parameters

Parameter nameTypeDescription
uuidStringThe UUID of the usage record to update.

Use Case

Migration scripts replacing legacy usage records with cleaned/canonicalized versions during a data quality remediation pass use PUT to guarantee the post-state matches the supplied payload exactly — no partial-merge surprises. Integration systems that own the source-of-truth metering store and want to keep Exsited usage in lock-step with their version often prefer PUT over PATCH for deterministic overwrite semantics. Note that because the SDK still routes this PUT to the v2 endpoint, callers should validate field-level coverage against the v2 contract until the SDK URL is bumped to v3.

Python
PHP
def test_order_usage_update():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        request_data = UsageCreateDTO(
            usage=UsageDataDTO(
                chargeItemUuid="CHARGE_ITEM_UUID",
                chargingPeriod="CHARGING_PERIOD",
                quantity="REPLACED_QUANTITY",
                startTime="START_TIME",
                endTime="END_TIME",
                type="TYPE"
            )
        )
        response = exsited_sdk.order.usage_update(uuid='USAGE_UUID', request_data=request_data)
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testUpdate()
{
    $uuid = '{usage_uuid}';
    $params = [
        "usage" => [
            "order_id" => "{order_id}",
            "charge_item_uuid" => "{charge_item_uuid}",
            "quantity" => "{quantity}",
            "usage_date" => "{YYYY-MM-DD}",
            "note" => "{note}"
        ]
    ];

    try {
        $response = $this->usagesService->update($uuid, $params, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the function returns a UsageUpdateDataDTO wrapping the replaced UsageDataDTO under the usage field. The returned object reflects the post-replace state with the bumped version and refreshed audit fields.

Python
PHP
UsageUpdateDataDTO(
    usage=UsageDataDTO(
        uuid='USAGE_UUID',
        version='NEW_VERSION',
        chargeItemUuid='CHARGE_ITEM_UUID',
        chargingPeriod='CHARGING_PERIOD',
        quantity='REPLACED_QUANTITY',
        startTime='START_TIME',
        endTime='END_TIME',
        type='TYPE',
        chargeStatus='CHARGE_STATUS',
        lastUpdatedBy='LAST_UPDATED_BY',
        lastUpdatedOn='LAST_UPDATED_ON'
    )
)
{
    "usage": {
        "uuid": "USAGE_UUID",
        "version": "VERSION",
        "charge_item_uuid": "CHARGE_ITEM_UUID",
        "charge_item_name": "CHARGE_ITEM_NAME",
        "charging_period": "CHARGING_PERIOD",
        "quantity": "QUANTITY",
        "uom": "UOM",
        "start_time": "START_TIME",
        "end_time": "END_TIME",
        "type": "TYPE",
        "charge_status": "CHARGE_STATUS",
        "source": "SOURCE",
        "created_by": "CREATED_BY",
        "created_on": "CREATED_ON",
        "last_updated_by": "LAST_UPDATED_BY",
        "last_updated_on": "LAST_UPDATED_ON",
        "custom_attributes": [],
        "usage_reference": "USAGE_REFERENCE"
    }
}

Deleting a Usage

Function: usage_delete()

Purpose

This API deletes a usage record by its UUID via DELETE /api/v3/usages/{uuid}. Removal drops the record from rating/invoicing pipelines going forward; existing invoices already generated from the record are preserved as audit trail (the deletion does not retroactively credit a finalised invoice). On success the API responds with HTTP 204 No Content. This is a destructive operation — callers should confirm intent before invoking, especially against records already mid-cycle.

Parameters

Parameter nameTypeDescription
uuidStringThe UUID of the usage record to delete.

Use Case

Billing analysts removing usage records that were submitted in error (duplicate batch upload, wrong account binding, test data accidentally promoted to production) use this endpoint to clean up before invoicing close. Migration scripts purging legacy or invalid records during a tenant cleanup run rely on the same endpoint. Because deletion ripples through rating and invoice computation, it is gated behind explicit user confirmation in tooling — the SDK exposes order.usage_delete(uuid) for the underlying call.

Python
PHP
def test_order_usages_delete():
    SDKConfig.PRINT_REQUEST_DATA = True
    SDKConfig.PRINT_RAW_RESPONSE = False

    token_file_path = "shared_token.json"
    file_token_mgr = FileTokenManager(token_file_path)

    exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(
        request_token_dto=CommonData.get_request_token_dto(),
        file_token_mgr=file_token_mgr
    )

    try:
        response = exsited_sdk.order.usage_delete(uuid="USAGE_UUID")
        print(response)
    except ABException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)
public function testDelete()
{
    $uuid = '{usage_uuid}';
    try {
        $response = $this->usagesService->delete($uuid, 'v3');
        echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

Response

On success, the API responds with HTTP 204 No Content. The SDK does not bind a response DTO for this operation — callers should check that no exception was raised. No response body is delivered.

Python
PHP
{'success': True, 'status_code': 204}
null

Looking to build your next big project?

With our robust set of tools and resources, you can create custom solutions that integrate seamlessly with our system and take your business to the next level.

Join Our Partner Program
APIs
SDK
Help Center
Community
Contact Us

©2026 Exsited. All rights reserved.

Terms and Conditions | Privacy Policy

Follow Us: