taggalongRevenue Cloud field guide
Menu
Usage · Lab

Record usage, rate it, and preview the invoice

Drafted, not yet confirmed · your lab org

You'll record a month of database usage against two assets, process it, and read how Revenue Cloud turned it into charges: the grant used first, the tier rate for the rest, and tokens rated in two steps. Then you'll preview the invoice before you generate it.

Your lab org comes with a sample company, QuantumBit. Its products, price books and billing setup are there because the labs use them, so leave them as they are. Everything a lab names starts with TGFG-, so you can always tell your work from QuantumBit's.

Before you start

To do this lab you need a lab org of your own, with this lab set up in it. This page lists what the lab needs, so you can set it up by hand. The lab kit does it for you. Start your own lab

Open your lab org with cci org browser my-lab, or from Org Launcher if you set it up. Track your orgs

You need a Revenue Cloud org built from Salesforce's launchpad, Revenue Cloud Foundations, with its QuantumBit sample catalog.

The setup makes these for you, in USD on the Standard Price Book:

It makes Called What it's for
An account with a billing and shipping address TGFG-Usage Lab, at 4300 Main Street, Philadelphia, PA 19127, US The customer
A contact and a default billing profile TGFG Usage Lab Contact, [email protected], and TGFG-Usage Lab Billing An order won't activate without a shipping address and a bill-to contact
Two subscriptions, sold through quote, order and activation QuantumBit Database (QB-DB) and QuantumBit Database (Token Based) (QB-DB-TOKEN), Term Annual, 12,000 a year each, billed monthly in advance The two assets you record usage against

Both subscriptions start on the first day of the month three months back and end one day short of a year later. We call that first month the usage month: it's the one you record into. The setup records no usage, processes nothing and makes no invoice.

Record your usage before anyone processes usage. The first time an account's usage is processed, every past month with no usage yet closes for good, and usage recorded into it later is never rated, with no error. Processing runs for the whole org, and the launchpad org runs it every night at midnight. If the night passes before you record, or someone processes usage first, run the setup again.

Done this lab before? An account that has had usage processed can't be used again, so the setup sells to the next free name: TGFG-Usage Lab 2, then TGFG-Usage Lab 3. Use the name it gives you wherever a step says TGFG-Usage Lab.

Every step of this lab has been clicked through on screen in a fresh lab org.

Steps

  1. Find the two assets

    Account

    Why Activating the order creates an asset for each usage product, and every usage record you add links to one of them.

    Go to App Launcher then Revenue Cloud then Revenue Cloud then Accounts then TGFG-Usage Lab then Assets

    You should see: a Managed Assets (2) card with QuantumBit Database and QuantumBit Database (Token Based), each with Current Quantity 1.00 and Current Monthly Recurring Revenue USD 1,000.00. Lifecycle Start Date is the first day of the usage month and Lifecycle End Date one day short of a year later, both at midnight UTC, so west of UTC they show the evening before: in US Pacific time, the last day of the month before at 5:00 PM.

  2. Read the wallets

    Usage Entitlement Bucket

    Why Activation also creates the allowances: an entitlement for each usage resource on each asset, and a wallet for each resource, which grants fill and usage draws down.

    Go to TGFG-Usage Lab then Assets then the arrow at the end of the QuantumBit Database row then View then Wallets & Rates

    The account's own Usage tab has a Wallets subtab, but it reads "No Wallets found for this Account": these wallets belong to the assets, so open each asset. Clicking the asset's name only opens a side panel; View in the row's arrow menu opens the asset record. Then do the same for QuantumBit Database (Token Based).

    You should see: a Wallets card per usage resource and a Rates list. QuantumBit Database: Compute Time with Total Balance 0 Minutes, Data Storage with Total Balance 10 Terabyte, and Data Throughput with 0 Gigabyte; Rates read Data Storage 10 USD and Compute Time 0.004 USD, each marked as tiered, and Data Throughput 0.1 USD. The token plan: Compute Time (Token) 0 Minutes, Data Storage (Token) 0 Terabyte and Quantum Tokens 10000 Tokens; Rates read Quantum Tokens 0.5 USD, Data Storage (Token) 10 Tokens and Compute Time (Token) 5 Tokens. Each card also reads "Available: 0" before any usage is processed. View Details on the Data Storage wallet, then its Wallet Statement tab, shows one Credit of 10 for the usage month.

  3. Predict the charge

    Rate Card

    Why Rating reads the asset's rate cards. A grant is an allowance the price already pays for, so only usage above it is rated, and a tier rate card sets the rate by how much is used.

    Go to App Launcher then Rate Cards then Rate Cards then Tier Rate Card then Related then Rate Card Entries then View All

    The card holds dozens of entries for many products and currencies, and the list has no currency column. Open the entries whose Product is exactly QuantumBit Database (not the Quantity Commit, Monetary Commit or Token Commit products) and whose Usage Resource is Compute Time, then Data Storage, until the entry's header reads Rate Unit Of Measure USD. On its Related tab, click View All under Rate Adjustments By Tier: the card itself hides the Adjustment Value column.

    Resource Tiers Rates
    Compute Time, a minute 1 to 1,000 / 1,000 to 3,000 / 3,000 to 6,000 / above 6,000 Override 0.004 / 0.0045 / 0.005 / 0.006
    Data Storage, a terabyte 1 to 10 / 10 to 25 / 25 to 100 / above 100 Percentage 0, then Override 12.5 / 15 / 18

    On the token plan, the Base Rate Card turns a minute into 5 tokens and a terabyte into 10, and charges 0.50 a token. Work out what 5,000 minutes and 50 TB cost on each plan, after the grants.

    You should see: four tiers on each USD entry, with Lower Bound, Upper Bound, Adjustment Type and Adjustment Value as in the table; the top tier's Upper Bound reads 999,999,999. You check your sums at step 9. The same tiers show again beside the form when you record usage in step 6.

  4. Preview the invoices

    Order

    Why Salesforce's documentation says a preview shows the invoices for the next two billing periods, with estimated tax, before anything is billed.

    Go to TGFG-Usage Lab then Related then Orders then the order then the arrow at the end of the header then Preview Invoices

    Field Set it to Why
    Preview Date Leave it at today The first preview holds everything due by today.
    Billing Periods 2 It opens on 1; 2 shows the next period too.

    Click Preview. The second invoice's sections start folded: click Invoice Information, Invoice Line Items and Invoice Summary to open them.

    You should see: "2 invoice previews were generated.", and no new record. Invoice Preview 1/3, dated today, catches the subscriptions up: a line per plan per month from the usage month to this one, each Quantity 1, Unit Price $12,000.00, Tax $100.00 and Amount $1,100.00 (Amount includes the tax), with Total Amount $8,000.00, Total Tax Amount $800.00 and Total Amount With Tax $8,800.00. Invoice Preview 2/3, dated a month from today, holds next month: $2,000.00 plus $200.00. Neither has usage yet. Invoice Preview 3/3 reads "No invoice preview is available" over the error "Custom fulfillment scope configuration not found for scope name: [Group_Identifier]" and a list of step definition IDs: it comes from the order's fulfillment plan, which couldn't be built for this order (the order's Fulfillment tab reads "Nothing to see here...yet"). It isn't a billing error: the two previews above are complete, and the assets and their usage allowances were still made.

  5. Preview through the API

    Terminal

    Why The Invoice Preview API gives the same preview as data. An order or an account works as it is; Salesforce's help says a quote needs a custom procedure plan first.

    Go to Terminal then Claude Code

    Ask Claude Code:

    In my Revenue Cloud practice org, POST to /services/data/v66.0/commerce/invoicing/invoices/collection/actions/preview with {"billingTransactionId":"<the TGFG-Usage Lab order's Id>","numberOfBillingPeriods":2,"previewDate":"<today as YYYY-MM-DD>"} and show me each invoice's date, totals and lines.
    

    You should see: the same two invoices, in invoiceDetailList. The first has totalAmount 8000, totalTaxAmount 800 and totalAmountWithTax 8800 across 8 lines in invoiceLineDetailList, each with quantity 1, unitPrice 12000 (the yearly price), chargeAmount 1000, taxAmount 100 and lineAmount 1100. The second has 2000, 200 and 2200. errorsList holds the same fulfillment error as Invoice Preview 3/3, with errorCode DRO_DATA_ACCESS_ERROR.

  6. Record a month of usage

    Transaction Journal

    Why Usage arrives as transaction journals: an amount of one resource, used by one asset, on one date. The launchpad's guide says to record into a past month, before that month is processed.

    Go to TGFG-Usage Lab then Usage then Add Usage then Usage Uploader then Single Entry

    Field Set it to Why
    Select Asset QuantumBit Database (QuantumBit Database), then QuantumBit Database (Token Based) (QuantumBit Database (Token Based)) Usage is recorded against the asset the customer bought.
    Usage Resource Compute Time, then Data Storage. On the token plan, Compute Time (Token), then Data Storage (Token) What was used. Each plan lists its own resources.
    Unit of Measure Leave it The uploader fills in the resource's own unit: Minutes (m) or Terabyte (TB).
    Quantity 5000 for compute, 50 for storage The same usage on both plans, so you can compare them.
    Transaction Date The 15th of the usage month, typed the way the field's hint shows ("Format: Dec 31, 2024") or picked from the calendar A past month: only a month that has ended is rated in full.

    Click Upload Usage after each entry, four in all. After each upload the form goes back to the first resource, a quantity of 1.00 and today's date, so set all three again. The Single Entry tab appears once an asset is chosen; if the form is blank after you switch asset, click Single Entry. Leave Process Usage below it alone until the next step.

    You should see: a "Success" message, "Usage record created", after each upload. Beside the form, Rate Cards shows the resource's rates and tiers, and Usage Grants its grant: Total: 10 for Data Storage, Total: 0 for the others. On View Usage, the Usage card has four rows, one per entry, each with Status Pending: usage recorded, not yet counted. Usage Summaries and Liable Summaries read "No records found." West of UTC, Activity Date shows the 14th: the date is saved as midnight UTC on the 15th.

  7. Process the usage

    Flow

    Why Process Usage runs the launchpad's usage orchestration flow, which turns journals into usage summaries, then ratable summaries, then liable summaries. The launchpad's guide says it takes several passes.

    Go to TGFG-Usage Lab then Usage then Add Usage then Usage Orchestration then Process Usage

    The card says "Processing typically takes around 15 minutes." Click Process Usage, wait two or three minutes, and click it again. Keep going until the four rows in the Usage card on View Usage read Processed, and then until the usage month's rows in the Liable Summaries card read ReadyForInvoicing. Each card has a refresh button: use it, or reload the page, before you decide nothing has changed. Expect about ten minutes and three clicks.

    You should see: "Processing Started" and "Usage orchestration has been initiated." each time. Processed means the usage has been counted, not rated: rating goes on afterwards in background jobs. The card's Monitor Workflow Services link opens Setup in a new browser tab, where the Batch Jobs list shows runtime_industries_usage__CreateEmptySummaries and Create Usage Summary_v4. The Usage Summaries card fills with a row per resource per day, from the usage month to the end of this month. This month's summaries stay InProgress: Salesforce's help says a period's usage is completed only after the period ends and a wait for late usage, 3 days by default.

  8. Read the usage summaries

    Usage Summary

    Why A usage summary adds up the journals for one resource and period, and draws down the grant. Debited Units is what the grant absorbed, and Overage Units is what's left to rate.

    Go to TGFG-Usage Lab then Assets then the arrow at the end of the QuantumBit Database row then View then Usage Data then Usage Summaries

    The account's View Usage tab has a Usage Summaries card too, but it holds hundreds of rows, ten to a page, and doesn't re-sort. The asset's Usage Data tab has the same card for that asset alone: click the Consumption Units header twice, so it sorts from the largest down, and the rows with usage come first. Open each one by its Name. Then do the same on QuantumBit Database (Token Based), where the two Quantum Tokens rows differ by Consumption Units:

    Resource Consumption Units Debited Units Overage Units
    Compute Time 5,000 0 5,000
    Data Storage 50 10 40
    Compute Time (Token) 5,000 0 5,000
    Data Storage (Token) 50 0 50
    Quantum Tokens, from compute 25,000 9,500 15,500
    Quantum Tokens, from storage 500 500 0

    You should see: those numbers. The 10 TB grant took the first 10 of the 50 TB. The token grant took 10,000 of the 25,500 tokens, the storage tokens first and then 9,500 of the compute tokens, so 15,500 tokens are left to rate. The rows are dated the 15th, or the 14th west of UTC. Every other day's row reads 0 Consumption Units. A summary's Status reads Ratable Summary Complete, or Liable Summary Complete once step 10's summary has been made.

  9. Check your prediction

    Usage Ratable Summary

    Why A ratable summary rates a month's overage for one resource. The month is rated as a whole, so the tier its total falls in sets the rate for all of it.

    Go to The Data Storage usage summary from step 8 then Ratable Summary

    Ratable Summary is a field on the usage summary's Details tab: click its link. The ratable summary's header shows Status, Overage Quantity and Total Amount, and its Details tab adds Tier Quantity and Net Unit Rate Unit Of Measure. The page shows no rate itself: Total Amount divided by Tier Quantity gives it. Its Start Date Time and End Date Time cover the whole usage month. Do the same from the other usage summaries in step 8.

    You should see: Status Rating Complete. Data Storage: Tier Quantity 40 and Total Amount 600, a rate of 15. Compute Time: 5,000 and 25, a rate of 0.005, which makes 625 for QuantumBit Database's month. The token plan rates in two steps. First each resource turns into tokens, with Net Unit Rate Unit Of Measure Tokens: Compute Time (Token) 5,000 and 25,000, 5 tokens each, and Data Storage (Token) 50 and 500, 10 each. Then the tokens are rated in dollars: the compute tokens' Quantum Tokens summary reads 15,500 and 7,750, a rate of 0.5, and the storage tokens' one, whose Source Usage Resource is Data Storage (Token), reads 0 and 0, because the grant took all 500. That leaves 7,750 for the token plan's month.

  10. Read the liable summaries

    Liable Summary

    Why The liable summary is the invoice-ready record: the overage and its amount for one resource and billing period. Billing invoices it once it reads Ready For Invoicing.

    Go to TGFG-Usage Lab then Usage then View Usage then Liable Summaries

    The card has a row per resource per month, ten to a page, and no resource column. Find the usage month by Start Date Time on both pages (west of UTC it shows the last day of the month before), and tell its rows apart by Asset and Unit of Measure: Tokens on the token plan, and Minutes, Terabyte and Gigabyte on QuantumBit Database. Refresh the card if it still shows the rows as New.

    You should see: a row per resource for the usage month, each with Status ReadyForInvoicing: Tokens with Total Used Quantity 25,500 and Overage Quantity 15,500, Minutes 5,000 and 5,000, Terabyte 50 and 40, Gigabyte 0 and 0. Later months read 0, and this month's rows read InProgress. Overage Amount is $0.00 on every row: the launchpad's guide records this as a defect in its sample data, whose usage billing products carry no price.

  11. Preview again

    Order

    Why The same preview as before, to see what usage adds. Usage is billed after its month ends, while the subscription is billed in advance.

    Go to TGFG-Usage Lab then Related then Orders then the order then the arrow at the end of the header then Preview Invoices

    Set Billing Periods to 2 again and click Preview. Then run the API preview from step 5 again.

    You should see: the same totals, $8,000.00 plus $800.00 and then $2,000.00 plus $200.00, but Invoice Preview 1/3 now also has usage lines, four for each month that processing has closed: 20 lines in all. The usage month's lines read Compute Time 5000, Data Throughput 0, Data Storage 50 and Quantum Tokens 25500, and later months read 0, each with Unit Price, Tax and Amount $0.00. A usage line's quantity is everything used, before the grant, and its charge is 0 for the reason in step 10. Invoice Preview 3/3 still shows the fulfillment error, and the API's first invoice has 20 lines.

  12. Generate a draft invoice

    Invoice

    Why Generate Invoices bills every billing schedule that's due before the target date. A draft carries estimated tax, and Salesforce's help says a draft doesn't move the liable summaries: only posting marks them Invoiced.

    Go to TGFG-Usage Lab then the arrow at the end of the header then Generate Invoices

    Field Set it to Why
    Target Date Leave it at today Every schedule due before it is billed.
    Invoice Date Leave it at today The date the invoice shows.
    Status Draft So you can check it first and post it later.

    Click Generate. It works on this account's billing schedules only. Then open the Billing tab and run the API preview from step 5 once more.

    You should see: "Generating invoices..." and "We'll notify you when the process is complete." Within a minute, the Billing tab's Invoices (1) list shows the invoice with Status Draft, Total with Tax USD 8,800.00 and Balance USD 8,800.00; reload the page if it isn't there yet. The Settlements & Adjustments card above it opens on the Unpaid Invoices view, which doesn't list a draft: switch its View to All Invoices to see it there. Open the invoice: Total Charges USD 8,000.00, Total Tax USD 800.00 and Total with Tax USD 8,800.00, matching the first preview. The API preview now returns no invoices, with the error "The invoice preview can't be generated because no invoices were found.": the draft holds every period up to the target date, which is why you preview first.

  13. Read the draft's lines

    Invoice Line

    Why A usage line is billed under its usage resource's usage definition product, the one Billing uses for tax and invoicing, and it carries the overage quantity beside the quantity used.

    Go to TGFG-Usage Lab then Billing then Invoices (1) then the draft invoice then Invoice Lines

    The Invoice Lines (20) card isn't in date order and scrolls inside itself. Open a usage line by its Name to see the product it's billed under. Leave the invoice as a draft: Post Draft Invoice would bill the account. The line page doesn't show the overage, so ask Claude Code:

    In my Revenue Cloud practice org, list the lines of TGFG-Usage Lab's draft invoice with each line's name, product, start date, Quantity, UsageOverageQuantity and ChargeAmount.
    

    You should see: eight subscription lines, each with Quantity 1.00, Unit Price USD 12,000.00 and Line Amount USD 1,100.00 (a charge of 1,000 and tax of 100), and the preview's twelve usage lines, named Compute Time, Data Throughput, Data Storage and Quantum Tokens, each at USD 0.00. A usage line's Product is Compute Time, Data Storage, Quantum Tokens Definition, or QuantumBit Database itself for Data Throughput. From Claude Code, the usage month's lines have UsageOverageQuantity 5000, 40 and 15500: the overage step 9 rated at 625 and 7,750.

What to take away

Usage runs on its own chain beside the subscription. Activation creates the entitlements and wallets. Usage arrives as transaction journals, and processing turns them into usage, ratable and liable summaries. The grant is used first, at no charge, the tier sets the rate for the rest, and a token plan rates twice: usage into tokens, then tokens into money. Usage is billed after its month ends, the subscription in advance.

Two habits keep usage honest. Record a month's usage before it's processed, because a closed month never reopens. And preview before you generate: a preview creates nothing, while a draft holds the periods it bills.

The billing lab picks up where this one stops: posting the invoice and crediting it.

The reasons in each step come from Salesforce's documentation, the launchpad's own usage guides and, in a few places, what we checked in a Revenue Cloud org. The guide pages list the sources: Usage and Billing.

Back to the guide page