{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-products/dynamicmonetization/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab","admonition"]},"type":"markdown"},"seo":{"title":"Rate Table Formulas","description":"API documentation for Revenera products","siteUrl":"https://developer.revenera.com"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"rate-table-formulas","__idx":0},"children":["Rate Table Formulas"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Rate table formulas enable flexible, value-driven pricing models"]}," by allowing producers to define token consumption using formulas that combine multiple usage metrics, business parameters, or customer-specific factors. This provides the flexibility to align rates with the unique value delivered by the software, create differentiated offerings for diverse customer segments, and adapt monetization strategies as business needs evolve. By tying consumption more closely to customer value and usage patterns, producers can drive monetization outcomes that better reflect how their software is consumed in the market."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using rate table formulas, producers can define pricing dynamically using spreadsheet-style expressions. Instead of assigning a fixed token cost (rate) to a product item, producers can calculate charges using one or more variables supplied at runtime."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rate table formulas support rate calculation scenarios such as:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Surge rate adjustments based on changing conditions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Geography-based rates that vary by region or market"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Time-based rates that differ by time of day, day of week, or season"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Demand-based rates that respond to usage levels or demand patterns"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Resource consumption rates based on metrics such as CPU, memory, storage, or bandwidth usage"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Custom business-specific rate models tailored to unique monetization requirements"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The goal is to provide a familiar and intuitive rate mechanism using spreadsheet-style formulas that those in roles such as Product Manager or End Customer buyers already understand."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"rate-table-requirements","__idx":1},"children":["Rate Table Requirements"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In a rate table, each item must specify either a rate or a formula, but not both. If a rate table uses a formula with variables, the variables must be defined in the access request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Formulas in rate tables use the same syntax and calculation rules as formulas in Microsoft Excel."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For details, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/dynamicmonetization/apis/openapi-spec/rate-tables/postratetables"},"children":["Create a rate table"]}," in the API reference."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You will find examples for defining variables in the access request in the next section, ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#access-request-behavior-when-using-formulas"},"children":["Access Request Behavior When Using Formulas"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"access-request-behavior-when-using-formulas","__idx":2},"children":["Access Request Behavior When Using Formulas"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples illustrate how Dynamic Monetization processes access requests for different formula configurations. Before submitting an access request, ensure that it satisfies the requirements described in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#access-request-prerequisites"},"children":["Access Request Prerequisites"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#access-request-behavior-for-single-variable-rates"},"children":["Access Request Behavior for Single Variable Rates"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#access-request-behavior-with-multi-variable-rate-formulas"},"children":["Access Request Behavior with Multi-Variable Rate Formulas"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#access-request-behavior-when-tokens-must-be-consumed-from-more-than-one-line-item"},"children":["Access Request Behavior When Tokens Must Be Consumed From More Than One Line Item"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"access-request-prerequisites","__idx":3},"children":["Access Request Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following prequisites and validation rules apply:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The access request ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["must"]}," contain ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["either"]},":",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," (for standard rates or single-variable count-based formulas), or"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," (for multi-variable formulas)"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," cannot be provided together."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," object must contain ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["at least one variable value"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," object can include a variable named ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"access-request-examples","__idx":4},"children":["Access Request Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples illustrate valid and invalid access request structures."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-a-valid-request-using-count","__idx":5},"children":["Example A: Valid Request Using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," for standard rates and single-variable count-based formulas."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"ultrasound-ai\",\n      \"version\": \"1.0\",\n      \"count\": 10                // [!code highlight]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-b-valid-request-using-variables","__idx":6},"children":["Example B: Valid Request Using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," object when the rate formula requires one or more input variables."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"ultrasound-ai\",\n      \"version\": \"1.0\",\n      \"variables\": {                // [!code highlight]\n        \"cpucycles\": 2,\n        \"cores\": 5\n      }\n    }\n  ]\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-c-valid-request-using-variables-with-count","__idx":7},"children":["Example C: Valid Request Using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," value can be supplied as a variable within the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," object."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"ultrasound-ai\",\n      \"version\": \"1.0\",\n      \"variables\": {                    // [!code highlight]\n        \"count\": 10,                    // [!code highlight]\n        \"cpucycles\": 2,\n        \"cores\": 5\n      }\n    }\n  ]\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-d-invalid-request-using-both-count-and-variables","__idx":8},"children":["Example D: Invalid Request Using Both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The access request must contain either ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]},". Providing both is not supported."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"ultrasound-ai\",\n      \"version\": \"1.0\", \n      \"count\": 10,                     // [!code error]\n      \"variables\": {                   // [!code highlight]\n        \"cpucycles\": 2\n      }\n    }\n  ]\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This request includes both ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]},". The request fails validation because only one of these fields can be supplied."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"access-request-behavior-for-single-variable-rates","__idx":9},"children":["Access Request Behavior for Single Variable Rates"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a single variable is used in a formula, the token consumption is calculated using a formula with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," variable. When a request is evaluated against this single variable formula, the system uses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," value supplied in the access request and substitutes it into the formula to determine the token charge."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This section explains the behavior when a single variable rate is used by means of an example."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-variable-rate-example-rate-table","__idx":10},"children":["Single Variable Rate: Example Rate Table"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the rate table as a table or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Rate Table"},"children":["Field in Rate Table"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formula"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count * 5"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"effectiveFrom\":1691999660000,\n  \"series\": \"PublicationApps\",\n  \"version\": \"1\",\n  \"items\": [\n    {\n      \"name\": \"PhotoPrint\",\n      \"version\": \"1.0\",\n      \"formula\": \"count * 5\"        // [!code highlight]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-variable-rate-example-access-request","__idx":11},"children":["Single Variable Rate: Example Access Request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the access request as a table or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Access Request"},"children":["Field in Access Request"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"  {\n    \"requester\": {\n      \"type\": \"user\",\n      \"value\": \"LisaBarry\"\n    },\n    \"requestedItems\": [\n      {\n        \"item\": \"PhotoPrint\",\n        \"version\": \"1.0\",\n        \"count\": 10                // [!code highlight]\n      }\n    ]\n  }   \n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-variable-rate-example-access-response","__idx":12},"children":["Single Variable Rate: Example Access Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To respond to the request, the system substitutes the supplied ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," value for the variable in the rate table and evaluates the formula."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the access response as a table or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Access Response"},"children":["Field in Access Response"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formula"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count * 5"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalTokensCharged"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["50"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tokensCharged"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["50"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"correlationId\": \"5c8ec4fd-f17f-4657-bf09-74a97ddc9f8b\",\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"PhotoPrint\",\n      \"version\": \"1.0\",\n      \"count\": 10,                          // [!code highlight]\n      \"status\": {\n        \"code\": \"1001\",\n        \"description\": \"Successfully checked out\"\n      },\n      \"totalTokensCharged\": 50.0,             // [!code highlight]\n      \"lineItems\": [\n        {\n          \"formula\": \"count * 5\",           // [!code highlight]\n          \"activationId\": \"ACT02-Elastic\",\n          \"tokensCharged\": 50.0              // [!code highlight]\n         }\n      ]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-variable-rate-outcome-and-key-takeaway","__idx":13},"children":["Single Variable Rate: Outcome and Key Takeaway"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The formula uses the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," value supplied in the access request to determine the token charge. In this example, a count of 10 results in a charge of 50 tokens (10 × 5)."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Formula"},"children":["Formula"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Access Request Input Value"},"children":["Access Request Input Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Tokens Charged"},"children":["Tokens Charged"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count * 5"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["50"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Single variable formulas are easy to construct, keep access requests simple, and can model some helpful rate constructs, without changing the access requests. This means that you can replace a static rate with a formula for token consumption without changing the client implementation—which could already be supplying a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["count"]}," value."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"access-request-behavior-with-multi-variable-rate-formulas","__idx":14},"children":["Access Request Behavior with Multi-Variable Rate Formulas"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Multi-variable rate formulas allow token consumption to be calculated using formulas that reference one or more variables supplied in the access request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a rate formula is used, the access request must provide the required variable values so the system can evaluate the formula and determine the token charge."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following sections explain how access requests are processed for multiple-variable formulas and provide examples."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multi-variable-rate-example-rate-table","__idx":15},"children":["Multi-Variable Rate: Example Rate Table"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the rate table in table format or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Rate Table"},"children":["Field in Rate Table"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formula"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cores * hours * 2"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"effectiveFrom\":1691999660000,\n  \"series\": \"PublicationApps\",\n  \"version\": \"1\",\n  \"items\": [\n  {\n    \"name\": \"PhotoPrint\",\n    \"version\": \"2.0\",\n    \"formula\": \"cores * hours * 2\"        // [!code highlight]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multi-variable-rate-example-access-request","__idx":16},"children":["Multi-Variable Rate: Example Access Request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the access request in table format or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Rate Table"},"children":["Field in Rate Table"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cores * hours * 2"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n \"requester\": {\n   \"type\": \"user\",\n   \"value\": \"LisaBarry\"\n },\n \"requestedItems\": [\n   {\n     \"item\": \"PhotoPrint\",\n     \"version\": \"2.0\",\n     \"variables\": {                // [!code highlight]\n       \"cores\": 8,                 // [!code highlight]\n       \"hours\": 10                 // [!code highlight]\n       }                          // [!code highlight]\n   }\n ]\n}   \n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multi-variable-rate-example-access-response","__idx":17},"children":["Multi-Variable Rate: Example Access Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The system substitutes the supplied variable values into the formula."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the relevant tab to see the example values for the access response in table format or as a JSON payload."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Values","disable":false},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field in Access Response"},"children":["Field in Access Response"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formula"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cores * hours * 2"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cores"]}," (inside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["8"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hours"]}," (inside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["totalTokensCharged"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["160"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example JSON Payload","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"correlationId\": \"5c8ec4fd-f17f-4657-bf09-74a97ddc9f8b\",\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\": [\n    {\n      \"item\": \"PhotoPrint\",\n      \"version\": \"2.0\",\n     \"variables\": {           // [!code highlight]\n            \"cores\": 8,        // [!code highlight]\n            \"hours\": 10      // [!code highlight]\n        },                          // [!code highlight]\n      \"status\": {\n        \"code\": \"1001\",\n        \"description\": \"Successfully checked out\"\n      },\n      \"totalTokensCharged\": 160.0,             // [!code highlight]\n      \"lineItems\": [\n        {\n          \"formula\": \"cores * hours * 2\",           // [!code highlight]\n          \"activationId\": \"ACT02-Elastic\",\n          \"tokensCharged\": 160.0               // [!code highlight]\n         }\n      ]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multi-variable-rate-outcome-and-key-takeaway","__idx":18},"children":["Multi-Variable Rate: Outcome and Key Takeaway"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each variable in the formula is replaced with its corresponding input value from the access request. In this example, the resulting calculation (8 × 10 × 2) produces a token charge of 160."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Formula"},"children":["Formula"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Access Request Input Value"},"children":["Access Request Input Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Tokens Charged"},"children":["Tokens Charged"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cores * hours * 2"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"cores\": 8,"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"hours\" : 10"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["160"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Multi-variable rate formulas enable token consumption to be calculated dynamically using values supplied in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," section of the access request. This approach allows producers to implement more advanced pricing models."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"access-request-behavior-when-tokens-must-be-consumed-from-more-than-one-line-item","__idx":19},"children":["Access Request Behavior When Tokens Must Be Consumed From More Than One Line Item"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a line item does not contain enough available tokens to satisfy an access request, the system continues consuming tokens from the next eligible line item. Because different line items can reference different rates or formulas, the system follows specific rules to ensure token consumption is calculated consistently."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following sections explain how rates and formulas are applied when token consumption spans multiple line items."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Priority of Line Items"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The order in which line items are charged depends on their expiration and start dates:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tokens are first charged to the line item with the earliest expiration date."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If line items have identical expiration dates, the one with the earliest start date is charged first."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/dynamicmonetization/guides/elastic-access-workflows-and-behavior#behavior-when-tokens-are-charged-to-multiple-line-items"},"children":["Behavior When Tokens are Charged to Multiple Line Items"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"general-principle","__idx":20},"children":["General Principle"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once a function-based rate is applied, it becomes the governing mechanism for setting rates for the entire request. If additional line items are required to satisfy the request, the formula result from the first line item will be applied in all subsequent line items. Formulas or rate configured on subsequent line items will be ignored."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following examples show how rates and formulas are applied when tokens are consumed from more than one line item."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"formula-propagation-across-multiple-line-itemsgeneric-example","__idx":21},"children":["Formula Propagation Across Multiple Line Items—Generic Example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Consider the following scenario: A client sends an access request for an item, and multiple line items are available that could satisfy the request:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Line Item 1 contains 30 available tokens and expires on May 1, 2027."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Line Item 2 contains 600 available tokens and expires on December 30, 2027."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Line Item 1 uses formula A."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Line Item 2 uses formula B."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Based on line item prioritization rules (see \"Priority of Line Items\", above), the system selects line item 1 first. It evaluates formula A and determines that the request requires 50 tokens."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Line item 1 contains only 30 available tokens, which are consumed first. The remaining 20 tokens are then consumed from line item 2."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The system does not evaluate formula B from line item 2. Instead, the token requirement calculated from formula A continues to govern the request, and the remaining tokens are consumed from subsequent line items using formula A until the request is satisfied."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following table shows how token consumption is distributed across the line items and which formula is used to calculate the token charge."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Line Item"},"children":["Line Item"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Configured Formula"},"children":["Configured Formula"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Applied Formula"},"children":["Applied Formula"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Tokens Charged"},"children":["Tokens Charged"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["1"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Formula A"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Formula A"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["30"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["2"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Formula B (ignored)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Formula A"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["20"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Total"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["50"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"formula-propagation-across-multiple-line-itemsconcrete-example","__idx":22},"children":["Formula Propagation Across Multiple Line Items—Concrete Example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The previous example explained the governing formula principle using a simplified scenario. This example illustrates the same behavior using sample line items, rate tables, and an access request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example Line items"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following tabs show the line items from which tokens can be consumed."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Line Item 1","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"activationId\": \"ACT03-Elastic\",\n  \"state\": \"DEPLOYED\",\n  \"quantity\": 100,\n  \"start\": 1785542400000,\n  \"end\": 1817078400000,\n  \"used\": 70,\n  \"attributes\": {\n    \"elastic\": true,\n    \"rateTableSeries\": \"FormulaSeries1\",\n    \"overdraftLimit\": 0,\n    \"overdraftType\": \"string\"\n  }\n}\n","lang":"JSON"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Line Item 2","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"activationId\": \"ACT04-Elastic\",\n  \"state\": \"DEPLOYED\",\n  \"quantity\": 100,\n  \"start\": 1819756800000,\n  \"end\": 1914451200000,\n  \"used\": 0,\n  \"attributes\": {\n    \"elastic\": true,\n    \"rateTableSeries\": \"FormulaSeries2\",\n    \"overdraftLimit\": 0,\n    \"overdraftType\": \"string\"\n  }\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this example, line item 1 expires before line item 2. According to the line item prioritization rules, line item 1 is therefore consumed first."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example Rate Tables"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following tabs show the rate tables associated with line items 1 and 2 for the item ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ultrasound-ai"]},"."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Rate Table for Line Item 1","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"effectiveFrom\":1785076543000,\n  \"series\": \"FormulaSeries1\",\n  \"version\": \"4.7\",\n  \"items\": [\n    {\n      \"name\": \"ultrasound-ai\",                        // [!code highlight]\n      \"version\": \"1.0\",\n      \"formula\": \"((count * cpucycles)/2) * 5\"        // [!code highlight]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Example Rate Table for Line Item 2","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"effectiveFrom\":1798295743000,\n  \"series\": \"FormulaSeries2\",\n  \"version\": \"4.7\",\n  \"items\": [\n    {\n      \"name\": \"ultrasound-ai\",                         // [!code highlight]\n      \"version\": \"1.0\",\n      \"formula\": \"((count * cpucycles * llmusedcost)/2) * 5\"        // [!code highlight]\n    }\n  ]\n}\n","lang":"JSON"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example Access Request"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A client sends an access request for item ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ultrasound-ai"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JSON","header":{"controls":{"copy":{}}},"source":"{\n  \"requester\": {\n    \"type\": \"user\",\n    \"value\": \"LisaBarry\"\n  },\n  \"requestedItems\":[\n    {\n      \"item\": \"ultrasound-ai\",            // [!code highlight]\n      \"version\": \"1.0\",                  // [!code highlight]\n      \"variables\":{                      // [!code highlight]\n        \"count\" : 10,                      // [!code highlight]\n        \"cpucycles\": 2                   // [!code highlight]\n      }\n    }  \n  ]\n}\n","lang":"JSON"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Consuming Tokens from Line Items"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Evaluate Formula A on Line Item 1"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Formula A is:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"((count * cpucycles) / 2) * 5\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using the values supplied in the access request:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"((10 * 2) / 2) * 5 = 50\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The request therefore requires ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["50 tokens"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Consume Available Tokens from Line Item 1"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Line item 1 contains only ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["30 available tokens"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These 30 tokens are consumed first."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Continue Consumption on Line Item 2"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The request still requires ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["20 additional tokens"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The system consumes those 20 tokens from line item 2."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Formula B is not evaluated. The token requirement calculated using formula A continues to govern the request."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"key-takeaway","__idx":23},"children":["Key Takeaway"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When token consumption spans multiple line items, the system evaluates the governing formula only once. If additional line items are required, the calculated token requirement is carried forward and used for the remainder of the request. Formulas defined on subsequent line items are ignored."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"reporting","__idx":24},"children":["Reporting"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When transactions are recorded in the Data Warehouse, additional fields are populated to capture the rate or formula used to calculate token consumption."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following fields provide visibility into both traditional rate-based and formula-based charging models:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Data Warehouse Field"},"children":["Data Warehouse Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_COST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["For standard rate-based items, contains the configured rate. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"For formula-based items, the value is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["null"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_FORMULA"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Contains the formula used to calculate token consumption.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The value is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["null"]}," when a standard rate is used."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_FORMULA_VARIABLES"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Contains the variables supplied in the access request and used to evaluate the formula. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The value is null when token consumption is calculated using a standard rate."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-warehouse-record","__idx":25},"children":["Example Warehouse Record"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example shows the values recorded for a transaction that uses a formula-based rate."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Consider a rate table configured with:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"\"formula\" : \"MULTIPLY(2, POWER(quantity, 2))\";\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["and an access request containing:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"\"variables\": {\"quantity\": 2}\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The resulting transaction record contains the following values:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_COST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_FORMULA"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MULTIPLY(2, POWER(quantity, 2))"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["METER_FORMULA_VARIABLES"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"quantity\": 2}"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These fields allow reporting systems to determine not only the number of tokens consumed, but also the formula and input values that were used to calculate the token charge."]}]},"headings":[{"value":"Rate Table Formulas","id":"rate-table-formulas","depth":1},{"value":"Rate Table Requirements","id":"rate-table-requirements","depth":2},{"value":"Access Request Behavior When Using Formulas","id":"access-request-behavior-when-using-formulas","depth":2},{"value":"Access Request Prerequisites","id":"access-request-prerequisites","depth":3},{"value":"Access Request Examples","id":"access-request-examples","depth":3},{"value":"Example A: Valid Request Using count","id":"example-a-valid-request-using-count","depth":4},{"value":"Example B: Valid Request Using variables","id":"example-b-valid-request-using-variables","depth":4},{"value":"Example C: Valid Request Using variables with count","id":"example-c-valid-request-using-variables-with-count","depth":4},{"value":"Example D: Invalid Request Using Both count and variables","id":"example-d-invalid-request-using-both-count-and-variables","depth":4},{"value":"Access Request Behavior for Single Variable Rates","id":"access-request-behavior-for-single-variable-rates","depth":3},{"value":"Single Variable Rate: Example Rate Table","id":"single-variable-rate-example-rate-table","depth":4},{"value":"Single Variable Rate: Example Access Request","id":"single-variable-rate-example-access-request","depth":4},{"value":"Single Variable Rate: Example Access Response","id":"single-variable-rate-example-access-response","depth":4},{"value":"Single Variable Rate: Outcome and Key Takeaway","id":"single-variable-rate-outcome-and-key-takeaway","depth":4},{"value":"Access Request Behavior with Multi-Variable Rate Formulas","id":"access-request-behavior-with-multi-variable-rate-formulas","depth":3},{"value":"Multi-Variable Rate: Example Rate Table","id":"multi-variable-rate-example-rate-table","depth":4},{"value":"Multi-Variable Rate: Example Access Request","id":"multi-variable-rate-example-access-request","depth":4},{"value":"Multi-Variable Rate: Example Access Response","id":"multi-variable-rate-example-access-response","depth":4},{"value":"Multi-Variable Rate: Outcome and Key Takeaway","id":"multi-variable-rate-outcome-and-key-takeaway","depth":4},{"value":"Access Request Behavior When Tokens Must Be Consumed From More Than One Line Item","id":"access-request-behavior-when-tokens-must-be-consumed-from-more-than-one-line-item","depth":3},{"value":"General Principle","id":"general-principle","depth":4},{"value":"Formula Propagation Across Multiple Line Items—Generic Example","id":"formula-propagation-across-multiple-line-itemsgeneric-example","depth":4},{"value":"Formula Propagation Across Multiple Line Items—Concrete Example","id":"formula-propagation-across-multiple-line-itemsconcrete-example","depth":4},{"value":"Key Takeaway","id":"key-takeaway","depth":4},{"value":"Reporting","id":"reporting","depth":2},{"value":"Example Warehouse Record","id":"example-warehouse-record","depth":3}],"frontmatter":{"markdown":{"toc":{"depth":4}},"seo":{"title":"Rate Table Formulas"}},"lastModified":"2026-09-23T09:44:37.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/dynamicmonetization/guides/rate-table-formulas","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}