PersonalBusinessEnterprise
    In a rush? Schedule an Appointment
    Fetching local time...
    Anytime CapitalforBusiness
    Pricing

    Get started

    • Overview
    • Quickstart
    • Test mode
    • Guides & recipes
    • Switch from Stripe
    • Import from Shopify
    • Import from WooCommerce
    • Import from Square
    • Import a CSV file
    • Stripe API mapping
    • Pricing
    • Support
    • FAQ

    Payments

    • Checkout & website
    • Guide: Next.js checkout
    • In person (QR)
    • Payment methods
    • Stablecoin checkout
    • Guide: take stablecoins
    • Fraud rules & 3D Secure
    • Dispute evidence
    • International customers
    • Guide: safe refunds
    • Bank transfers on invoices

    Billing

    • Subscription discounts
    • Guide: sell subscriptions
    • Usage billing
    • Guide: report usage

    Money movement

    • Payout options
    • Guide: reconcile payouts
    • Accounting sync
    • Revenue analytics

    Developers

    • Authentication
    • Errors & retries
    • Pagination
    • Idempotency
    • Rate limits
    • Webhooks
    • Verify webhooks
    • Node SDK (preview)
    • CLI (preview)
    • Postman collection

    AI

    • AI agents hub
    • Safe AI agents
    • Custom agents
    • Prompt library

    Integrations

    • Website builders
    • Shopify
    • Shopify orders by invoice
    • WooCommerce
    • Zapier
    • Slack, Discord and Teams

    Reference

    • Payments
    • Refunds
    • Disputes
    • Payment links
    • Invoices
    • Customers
    • Products
    • Subscriptions & plans
    • Discount codes
    • Meters & usage events
    • Payouts & balance
    • Webhook endpoints
    • Events
    • Test helpers
    • OpenAPI spec
    • Error codes
    • Changelog
    • Glossary

    For AI tools

    • llms-full.txt
    • MCP server
    • openapi.json
    Docs menu · Guide: report usage

    Get started

    • Overview
    • Quickstart
    • Test mode
    • Guides & recipes
    • Switch from Stripe
    • Import from Shopify
    • Import from WooCommerce
    • Import from Square
    • Import a CSV file
    • Stripe API mapping
    • Pricing
    • Support
    • FAQ

    Payments

    • Checkout & website
    • Guide: Next.js checkout
    • In person (QR)
    • Payment methods
    • Stablecoin checkout
    • Guide: take stablecoins
    • Fraud rules & 3D Secure
    • Dispute evidence
    • International customers
    • Guide: safe refunds
    • Bank transfers on invoices

    Billing

    • Subscription discounts
    • Guide: sell subscriptions
    • Usage billing
    • Guide: report usage

    Money movement

    • Payout options
    • Guide: reconcile payouts
    • Accounting sync
    • Revenue analytics

    Developers

    • Authentication
    • Errors & retries
    • Pagination
    • Idempotency
    • Rate limits
    • Webhooks
    • Verify webhooks
    • Node SDK (preview)
    • CLI (preview)
    • Postman collection

    AI

    • AI agents hub
    • Safe AI agents
    • Custom agents
    • Prompt library

    Integrations

    • Website builders
    • Shopify
    • Shopify orders by invoice
    • WooCommerce
    • Zapier
    • Slack, Discord and Teams

    Reference

    • Payments
    • Refunds
    • Disputes
    • Payment links
    • Invoices
    • Customers
    • Products
    • Subscriptions & plans
    • Discount codes
    • Meters & usage events
    • Payouts & balance
    • Webhook endpoints
    • Events
    • Test helpers
    • OpenAPI spec
    • Error codes
    • Changelog
    • Glossary

    For AI tools

    • llms-full.txt
    • MCP server
    • openapi.json
    DocsBillingGuide: report usage

    Bill usage with meters: send usage from your app

    Send usage from your app to Anytime Capital meters in safe, idempotent batches of 100, read a customer's usage back, and let it bill on their subscription.

    View as MarkdownOpen in Claude

    Usage billing charges customers for what they use. You make a meter once in the dashboard; your app sends a usage event for each billable thing; each period, usage over the included units is invoiced and charged to the customer's saved card. How periods, rounding and invoices work is on Usage billing; every field is on Meters & usage events.

    1. Make a meter

    1. In Subscriptions → Meters, create one: a name for invoices, the eventName your code will send (say api_call), how events add up (sum, count, max or last), the unit price and any included units.
    2. Attach it to a subscription plan to bill usage on top of the plan's price, or bill customers each calendar month without a plan.
    3. Create an API key with subscriptions write for the reporter.

    2. Send usage

    Usage is matched to customers by email, so send customerEmail (or a customerId whose customer has an email). Give each event an idempotencyKey that's unique to the thing it counts, such as the request id: resending the same event never counts it twice, so the reporter can retry freely.

    usage.mjs
    // usage.mjs — Node.js 18+. record() as things happen; batches go out every 10 seconds.
    const API = "https://anytime-capital.com/api/v1";
    const headers = {
      Authorization: `Bearer ${process.env.ANYTIME_API_KEY}`, // subscriptions:write
      "Content-Type": "application/json",
    };
    
    // In production, keep this in a table or durable queue so a restart loses nothing.
    const queue = [];
    let flushing = false;
    
    /** One billable thing. `id` must be unique to it, such as your request id: it is the event's idempotencyKey. */
    export function record({ eventName, customerEmail, value = 1, id }) {
      queue.push({ eventName, customerEmail, value, idempotencyKey: id, timestamp: new Date().toISOString() });
    }
    
    /** Sends everything queued, 100 at a time. Safe to repeat: each idempotencyKey counts once. */
    export async function flush() {
      if (flushing) return;
      flushing = true;
      try {
        while (queue.length > 0) {
          const batch = queue.slice(0, 100);
          let res;
          try {
            res = await fetch(`${API}/meter-events/batch`, { method: "POST", headers, body: JSON.stringify({ events: batch }) });
          } catch {
            return; // network: keep the queue, the next flush sends the same events again
          }
          if (res.status === 429 || res.status >= 500) return; // try again on the next tick, same events
          const result = await res.json();
          if (!res.ok) throw new Error(`${result.error.code}: ${result.error.message}`); // the batch's own shape
    
          for (const outcome of result.data) {
            if (outcome.status === "refused") {
              // PERIOD_CLOSED, TIMESTAMP_TOO_OLD, METER_NOT_FOUND…: won't succeed on a retry. Log it and move on.
              console.error("usage event refused", batch[outcome.index].idempotencyKey, outcome.error.code, outcome.error.message);
            }
          }
          queue.splice(0, batch.length); // created and duplicate both mean it's counted
        }
      } finally {
        flushing = false;
      }
    }
    
    setInterval(() => flush().catch((error) => console.error(error)), 10_000);
    
    // Example: bill one API call for the customer who made it.
    record({ eventName: "api_call", customerEmail: "jordan@example.com", id: "req_7f3a9c" });
    usage.py
    # usage.py — pip install requests. One event at a time, safe to retry.
    import os
    import uuid
    from datetime import datetime, timezone
    
    import requests
    
    API = "https://anytime-capital.com/api/v1"
    HEADERS = {"Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}"}
    
    
    def record_usage(event_name, customer_email, value=1, key=None):
        event = {
            "eventName": event_name,
            "customerEmail": customer_email,
            "value": value,
            "timestamp": datetime.now(timezone.utc).isoformat(),
            "idempotencyKey": key or str(uuid.uuid4()),  # pass your own request id to make retries safe
        }
        res = requests.post(f"{API}/meter-events", headers=HEADERS, json=event, timeout=30)
        body = res.json()
        if res.status_code in (200, 201):  # 200: already recorded under this key
            return body
        raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
    
    
    print(record_usage("api_call", "jordan@example.com", key="req_7f3a9c"))

    Send it promptly

    A timestamp more than 5 minutes ahead, more than 400 days ago, or inside a period that has already been billed is refused. Send usage as it happens, and keep the reporter's queue short.

    3. Show customers their usage

    Usage this month
    // Show a customer their usage this month (subscriptions:read).
    const params = new URLSearchParams({
      customerEmail: "jordan@example.com",
      from: new Date().toISOString().slice(0, 8) + "01", // the 1st of this month, UTC
    });
    const res = await fetch(`https://anytime-capital.com/api/v1/meters/mtr_8fKq2LmNpR4sT6vW9xYz/usage?${params}`, {
      headers: { Authorization: `Bearer ${process.env.ANYTIME_API_KEY}` },
    });
    const usage = await res.json();
    if (!res.ok) throw new Error(`${usage.error.code}: ${usage.error.message}`);
    console.log(usage.quantity, usage.daily); // "1210", [{ date: "2026-10-01", quantity: "480" }, …]

    Windows run from from to to (now, by default), at most 366 days, with one point per UTC day. What a period will cost is on the subscriber's details in the dashboard.

    PreviousUsage billingNext Payout options

    Anytime Capital is a fintech company, not a bank. Payment processing, banking and payout services are provided by Anytime Capital's licensed partners. Rates shown are for US card payments; international cards, currency conversion and disputes may carry additional fees shown in your dashboard before you accept a payment.

    On this page

    • 1. Make a meter
    • 2. Send usage
    • 3. Show customers their usage
    Anytime Capital
    (470) 748-2530
    App Store

    Business

    • Business Checking
    • Business Debit Cards
    • Payments
    • Ecommerce Payments
    • Invoicing
    • Developer Docs

    Solutions

    • CPAs & Accountants
    • Financial Advisors
    • Boat & Auto Dealerships
    • Dental & Medical Practices
    • Creators & Coaches
    • All solutions

    Crypto

    • Crypto Wallet
    • Tether Wallet
    • Buy Digital Assets
    • Explore Markets
    • Security & Licenses
    • Compare Platforms
    • Bitcoin ATM Alternative

    Company

    • Our Story
    • Schedule Appointment
    • Careers
    • Media & Press
    • Investor Relations
    • FAQ

    Branches

    • Atlanta, Georgia
    • Miami, Florida
    • Houston, Texas
    • All branches

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Your Privacy Choices
    • Fraud Notice

    © 2026 Anytime Capital LLC. Anytime Capital is a fintech company, not a bank.

    The Anytime Capital Mastercard® Prepaid Card is issued by Pathward®, N.A., Member FDIC. Mastercard® is a registered trademark of Mastercard International Incorporated. All other trademarks and service marks belong to their respective owners.

    Mastercard