Simulate Posting Usage Events

You can simulate a process of creating one or more usage events in a bulk process. It provides a way to preview the event charges before posting the actual usage event. The simulate process executes the full rating logic for a usage event, however, it does not persist the event in the Gotransverse, meaning simulated events won’t be displayed on the billing account balance.

Use the following endpoint and sample request body to simulate posting a usage event:

POST https://example-gotransverse.com/billing/2/usage-events/simulate/bulk}

Request

Copy
{
    "mode": "FAIL_ON_EXISTING",
    "usage_events": [
        {
            "start_time": "2018-12-25",
            "service_resource_identifier": "12345",
            "usage_uom": "DAY",
            "usage_amount": 20,
            "reference_id": "1",
            "sequence_id": "3"
        },
        {
            "start_time": "2019-01-24",
            "service_resource_identifier": "12345",
            "usage_uom": "DAY",
            "usage_amount": 35,
            "reference_id": "2",
            "sequence_id": "4"
        }
    ]
}

Response

Copy
{
    "rated_events": [
        {
            "id": "1006660021",
            "total_charge": 2000,
            "start_time": "2018-12-25T00:00:00-06:00",
            "end_time": "2019-01-24T04:34:05-06:00",
            "service_resource_identifier": "12345",
            "usage_uom": "DAY",
            "usage_amount": 20,
            "reference_id": "1",
            "sequence_id": "3",
            "event_charges": [
                {
                    "id": "1008430023",
                    "charge": 2000,
                    "usage_rule": {
                        "id": "142866894"
                    },
                    "charge_category": {
                        "charge_category_type": "usage-charge",
                        "id": "4314",
                        "name": "usage charge y"
                    },
                    "usage_uom": "DAY",
                    "usage_amount": 20
                }
            ],
            "service_period": {
                "id": "637204734"
            },
            "overwrite_counter": 0
        },
        {
            "id": "1006660022",
            "total_charge": 3500,
            "start_time": "2019-01-24T00:00:00-06:00",
            "end_time": "2019-01-24T04:34:05-06:00",
            "service_resource_identifier": "12345",
            "usage_uom": "DAY",
            "usage_amount": 35,
            "reference_id": "2",
            "sequence_id": "4",
            "event_charges": [
                {
                    "id": "1008430024",
                    "charge": 3500,
                    "usage_rule": {
                        "id": "143443790"
                    },
                    "charge_category": {
                        "charge_category_type": "usage-charge",
                        "id": "4314",
                        "name": "usage charge y"
                    },
                    "usage_uom": "DAY",
                    "usage_amount": 35
                }
            ],
            "service_period": {
                "id": "637204736"
            },
            "overwrite_counter": 0
        }
    ],
    "erred_events": []
}

Parameters

  • rated_events — within this entity, you can find usage events that have been successfully processed.

  • erred_events — within this entity, you can find usage events that have erred and details about what has gone wrong.