Skip to Content
Paycose Docs
Meters

Meters

The billing.meter object

A meter counts, sums or keeps the latest value of the usage events you send for one event_name, so a usage-based price can bill each customer for what they used. It has the same shape as Stripe's billing meter.

Attributes

  • idstringRequired

    Unique identifier for the object.

  • objectstringRequired

    String naming the object's type.

  • livemodebooleanRequired

    true when the object exists in live mode, false in test mode.

  • createdtimestampRequired

    Time the object was created, in Unix seconds.

  • updatedtimestampRequired

    Time the object last changed, in Unix seconds.

  • customer_mappingobjectRequired

    How the meter finds the customer of each event: the payload key that holds the customer's ID.

    Show child attributes
    • customer_mapping.event_payload_keystringRequired

      The payload key whose value is the customer's ID; customer_id unless the meter set another.

    • customer_mapping.typestringRequired

      How the key maps to a customer; always by_id.

      • by_id

        The key holds the customer's ID.

  • default_aggregationobjectRequired

    How the meter combines the events it records.

    Show child attributes
    • default_aggregation.formulastringRequired

      The formula the meter aggregates its events with.

      • sum

        Adds up the numeric value in each event's payload.

      • count

        Counts the events.

      • last

        Takes the value of the latest event in the window.

  • display_namestringRequired

    Human-readable name of the meter.

  • event_namestringRequired

    Name of the usage events this meter records, unique among your meters. Send it as event_name on POST /meter_events.

  • event_time_windowenumRequiredNullable

    Time window the meter's events are pre-aggregated over, set only on a sum meter. Each event then carries the total for its UTC hour or day: only the latest event per customer and window counts, and the meter sums those values, the same way in event summaries, upcoming invoices and at the billing provider. Null when not set.

    • day

      Events are pre-aggregated per day.

    • hour

      Events are pre-aggregated per hour.

    • null
  • statusenumRequired

    Whether the meter is active.

    • active

      The meter is in use.

    • inactive

      The meter was deactivated with POST /meters/{id}/deactivate; status_transitions.deactivated_at says when.

  • status_transitionsobjectRequired

    When the meter's status last changed.

    Show child attributes
    • status_transitions.deactivated_attimestampRequiredNullable

      Unix timestamp in seconds.

  • value_settingsobjectRequiredNullable

    Where the meter reads each event's value: the payload key that holds the number. Null for a count meter, which reads no value.

    Show child attributes
    • value_settings.event_payload_keystringRequired

      The payload key whose value is the event's number; value unless the meter set another.

  • metadataobjectRequired

    Key-value pairs you attach to the object for your own use. Paycose never reads or changes them.