Skip to main content
POST
/
revenue_calculator
curl --request POST \ --url https://api.togai.com/revenue_calculator \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "currencyConfig": { "mode": "CUSTOM", "currency": "USD" }, "pricePlanDetailsConfig": { "mode": "PRICE_PLAN", "pricePlanId": "pp.fdhkf.djf", "effectiveOn": "2020-01-01T00:00:00Z", "pricingCycleOrdinal": 1 }, "usageConfig": { "mode": "CUSTOM", "usageMap": { "um.1zcgWalbM2y.qaX5j": 100 } }, "licenseEntriesConfig": { "mode": "CUSTOM", "custom": [ { "licenseId": "license.1zcgWalbM2y.qaX5j", "quantity": 10, "effectiveFrom": "2020-01-01T00:00:00Z" } ] }, "entitlementOverageConfig": { "mode": "CUSTOM", "custom": [ { "featureId": "feature.1122.ahoiud", "quantity": 5 }, { "featureId": "feature.3452.abcaf2", "quantity": 28 } ] } } '
{
  "currency": "USD",
  "pricePlanDetails": {
    "supportedCurrencies": [
      "USD"
    ],
    "activeCurrencies": [
      "USD"
    ],
    "pricingCycleConfig": {
      "interval": "MONTHLY",
      "startOffset": {
        "dayOffset": "1",
        "monthOffset": "NIL"
      },
      "gracePeriod": 1,
      "anniversaryCycle": false
    },
    "usageRateCards": [
      {
        "displayName": "AfterShip Shipments1",
        "usageMeterId": "um.1zcgWalbM2y.qaX5j",
        "ratePlan": {
          "pricingModel": "TIERED",
          "slabs": [
            {
              "priceType": "PER_UNIT",
              "startAfter": 0,
              "order": 1
            },
            {
              "priceType": "PACKAGE",
              "startAfter": 2,
              "order": 2,
              "slabConfig": {
                "packageSize": "10"
              }
            }
          ]
        },
        "rateValues": [
          {
            "currency": "USD",
            "slabRates": [
              {
                "order": 1,
                "rate": 10,
                "slabRateConfig": {
                  "minimumRate": "1",
                  "maximumRate": "10"
                }
              },
              {
                "order": 2,
                "rate": 20
              }
            ]
          }
        ],
        "tag": "1"
      }
    ],
    "type": "BILLING"
  },
  "revenueInfo": [
    {
      "usages": {
        "um.fdjal.kdajf": 10
      },
      "usageRateCard": {
        "displayName": "AfterShip Shipments1",
        "usageMeterId": "um.1zcgWalbM2y.qaX5j",
        "ratePlan": {
          "pricingModel": "TIERED",
          "slabs": [
            {
              "priceType": "PER_UNIT",
              "startAfter": 0,
              "order": 1
            },
            {
              "priceType": "PACKAGE",
              "startAfter": 2,
              "order": 2,
              "slabConfig": {
                "packageSize": "10"
              }
            }
          ]
        },
        "rateValues": [
          {
            "currency": "USD",
            "slabRates": [
              {
                "order": 1,
                "rate": 10,
                "slabRateConfig": {
                  "minimumRate": 1,
                  "maximumRate": 10
                }
              },
              {
                "order": 2,
                "rate": 20
              }
            ]
          }
        ]
      },
      "slabRevenueSummaries": [
        {
          "order": 1,
          "usage": 10,
          "revenue": 100
        },
        {
          "order": 2,
          "usage": 0,
          "revenue": 0
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request payload for calculateRevenueAPI

Request to get revenue details

currencyConfig
CurrencyConfig · object
required

Configuration for getting the currency

pricePlanDetailsConfig
PricePlanDetailsConfig · object
required

Configuration for getting the usage rate card

usageConfig
UsageConfig · object
required

Configuration for getting the usage

licenseEntriesConfig
LicenseEntriesConfig · object
required

Configuration for getting the license entries

namedLicenseEntriesConfig
NamedLicenseEntriesConfig · object

Configuration for getting the named license entries

prorationConfig
ProrationConfig · object

Configuration for getting the proration, if not provided no proration will be applied

entitlementOverageConfig
EntitlementOverageConfig · object

Configuration for getting the entitlement overages

Response

Response payload for calculateRevenueAPI

currency
string
required
pricePlanDetails
object
required
revenueInfo
RevenueInfo · object[]
required
usageLookupRange
UsageLookupRange · object

Start and end dates of usage lookup if usage mode is LOOKUP