HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestripeapi-3.0.0.0Haskell2010

StripeAPI.Operations.PostSubscriptionItemsSubscriptionItemUsageRecords

Contains the different functions to run the operation postSubscriptionItemsSubscriptionItemUsageRecords

  • 4 types
  • 2 values
  • Packagestripeapi-3.0.0.0
  • Exports6
  • LanguageHaskell2010
  • LicenceMIT
  • SourcePostSubscriptionItemsSubscriptionItemUsageRecords.hs
valuepostSubscriptionItemsSubscriptionItemUsageRecords
  1. :: MonadHTTP m
  2. => Text

    subscription_item

  3. -> PostSubscriptionItemsSubscriptionItemUsageRecordsRequestBody

    The request body to send

  4. -> ClientT m (Response PostSubscriptionItemsSubscriptionItemUsageRecordsResponse)

    Monadic computation which returns the result of the operation

#
POST /v1/subscription_items/{subscription_item}/usage_records

<p>Creates a usage record for a specified subscription item and date, and fills it with a quantity.</p>

<p>Usage records provide <code>quantity</code> information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the <a href="https://stripe.com/docs/billing/subscriptions/metered-billing">metered billing</a> plan, Stripe helps you send accurate invoices to your customers.</p>

<p>The default calculation for usage is to add up all the <code>quantity</code> values of the usage records within a billing period. You can change this default behavior with the billing plan’s <code>aggregate_usage</code> <a href="/docs/api/plans/create#create_plan-aggregate_usage">parameter</a>. When there is more than one usage record with the same timestamp, Stripe adds the <code>quantity</code> values together. In most cases, this is the desired resolution, however, you can change this behavior with the <code>action</code> parameter.</p>

<p>The default pricing model for metered billing is <a href="/docs/api/plans/object#plan_object-billing_scheme">per-unit pricing</a>. For finer granularity, you can configure metered billing to have a <a href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing</a> model.</p>

Defines the object schema located at paths./v1/subscription_items/{subscription_item}/usage_records.POST.requestBody.content.application/x-www-form-urlencoded.schema in the specification.

Constructors

Instances4Eq, Show, FromJSON, ToJSON

Defines the enum schema located at paths./v1/subscription_items/{subscription_item}/usage_records.POST.requestBody.content.application/x-www-form-urlencoded.schema.properties.action in the specification.

Valid values are `increment` (default) or `set`. When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. The `set` action will overwrite the usage quantity at that timestamp. If the subscription has billing thresholds, `increment` is the only allowed value.

Constructors

Instances4Eq, Show, FromJSON, ToJSON

Defines the oneOf schema located at paths./v1/subscription_items/{subscription_item}/usage_records.POST.requestBody.content.application/x-www-form-urlencoded.schema.properties.timestamp.anyOf in the specification.

The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`, and must not be in the future. When passing `"now"`, Stripe records usage for the current time. Default is `"now"` if a value is not provided.

Instances4Eq, Show, FromJSON, ToJSON

Represents a response of the operation postSubscriptionItemsSubscriptionItemUsageRecords.

The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), PostSubscriptionItemsSubscriptionItemUsageRecordsResponseError is used.

Instances2Eq, Show