Skip to main content
POST
Usage Records
The usage endpoints let an installed app charge per event — one credit per SMS sent, per AI generation, per label printed — on top of an optional flat subscription (Shopify’s appUsageRecordCreate). The metered component is declared in pricing.usage of your app (see Usage Billing). Auth: app access token (OAuth). The installation is resolved from the token — apps never pass an installationId.
Money units. Every *Cents field is in the minor unit of the app’s pricing currency (cents for USD/EUR; whole units for zero-decimal currencies such as JPY). Unit prices may be sub-cent (e.g. 0.005), so amountCents, accruedAmountCents and remainingCents can carry up to four decimals. capAmountCents is always a whole number of cents.

How a usage event is charged

  1. The cost (quantity × unitAmount) is reserved against the merchant-approved cap in one atomic step. Concurrent calls can never push the period’s accrual past the cap.
  2. The usage is reported to Stripe on the installation’s metered subscription item. If Stripe refuses it, the reservation is released and the call returns 502.
  3. A usage billing transaction is recorded (status pending); the period’s usage is invoiced with the next subscription invoice.
Usage can be recorded while the installation’s billing is active, trial or past_due (the 7-day grace window). A cancellation scheduled for the end of the period keeps billing active until then, so usage keeps working until the period ends. After billing is cancelled or the install is disabled, the call returns 402.

Request

integer
required
Units consumed by this event. A positive integer — scale your unit instead of sending fractions (tokens, not kilo_tokens).
string
Optional, at most 255 characters. Send one for every real-world event. A retry with the same key does not bill or count again: it returns the first call’s result with idempotentReplay: true. The key is also sent to Stripe as the idempotency key (namespaced to the installation).

Response

string
ISO timestamp of the usage record.
integer
The recorded quantity.
number
Unit price from the app’s pricing (major units, e.g. dollars).
string
Pricing currency (ISO 4217, upper case).
number
Cost of this event in minor units.
number
Usage accrued in the current period after this event.
integer | null
Merchant-approved cap (null when the app declares no cap).
number | null
Headroom left under the cap.
string
Stripe usage-record id.
boolean
Present (true) when the request repeated an idempotencyKey already recorded.

Cap exceeded — 402

When the event would take the period’s accrual past the cap, nothing is recorded or charged:
Branch on code (stable). message repeats the same payload as a JSON string for apps written against the earlier shape. To keep charging, stop the metered action and request a higher cap.

Errors

Errors use the App API error body { "errors": { "base": ["…"] } }.

See also