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": {},
    "pricingCycleOrdinal": 1
  },
  "usageConfig": {
    "mode": "CUSTOM",
    "usageMap": {
      "um.1zcgWalbM2y.qaX5j": 100
    }
  },
  "entitlementOverageConfig": {
    "mode": "CUSTOM",
    "custom": [
      {
        "featureId": "feature.1122.ahoiud",
        "quantity": 5
      },
      {
        "featureId": "feature.3452.abcaf2",
        "quantity": 28
      }
    ]
  }
}
'
{
  "currency": "USD",
  "revenueInfo": [
    {
      "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
              }
            ]
          }
        ]
      }
    },
    {
      "revenueSummary": {
        "usages": {
          "um.fdjal.kdajf": 10
        },
        "slabRevenues": [
          {
            "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

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