generated

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package generated provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes        bearerAuthContextKey        = "BearerAuth.Scopes"
	MetricsTokenScopes      metricsTokenContextKey      = "MetricsToken.Scopes"
	PostmarkBasicAuthScopes postmarkBasicAuthContextKey = "PostmarkBasicAuth.Scopes"
	SessionCookieScopes     sessionCookieContextKey     = "SessionCookie.Scopes"
)

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type APIKey

type APIKey struct {
	// CreatedAt When the key was created.
	CreatedAt time.Time `json:"created_at"`

	// ExpiresAt When the key stops working. Also set on the old key during a
	// rotation grace period, and copied to the new key when the old
	// one had it. Absent for a key that does not expire.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// Id The key's id (`hc_key_…`). Use it to revoke or rotate the key.
	Id string `json:"id"`

	// KeyPrefix The key's type and mode prefix plus the first 12 characters of
	// its secret part. Enough to tell keys apart; never the full key.
	KeyPrefix string `json:"key_prefix"`

	// KeyType `secret` can read and change everything in its mode of the
	// account, except team members and the test email, which need a
	// dashboard sign-in. `ingest` can only send usage events and call
	// `GET /v1/whoami`, for LiteLLM or another gateway.
	KeyType APIKeyKeyType `json:"key_type"`

	// LastUsedAt When the key last authenticated a request. Each server updates
	// it at most once a minute, so it can lag a little. Absent until
	// the key is first used.
	LastUsedAt time.Time `json:"last_used_at,omitempty"`

	// Livemode True for a live-mode key (`…_live_…`), false for a test-mode key. A key reaches only its own mode's data.
	Livemode bool `json:"livemode"`

	// Name The label shown in the key list.
	Name string `json:"name"`

	// RevokedAt When the key was revoked. Absent unless it was revoked. A revoked key gets 401.
	RevokedAt time.Time `json:"revoked_at,omitempty"`

	// TenantId The account the key belongs to.
	TenantId string `json:"tenant_id"`
}

APIKey An API key's details. The key's value is never returned here: only `POST /v1/api-keys` and `POST /v1/api-keys/{id}/rotate` show it, once, as `raw_key`.

type APIKeyCreated

type APIKeyCreated struct {
	// Key An API key's details. The key's value is never returned here: only
	// `POST /v1/api-keys` and `POST /v1/api-keys/{id}/rotate` show it,
	// once, as `raw_key`.
	Key APIKey `json:"key"`

	// RawKey The full key: its prefix (`hc_secret_test_`, `hc_ingest_live_`
	// and so on) and 64 hex characters. Shown only once; store it now.
	// Hardcount keeps only a salted hash.
	RawKey string `json:"raw_key"`
}

APIKeyCreated A new API key and its full value. `raw_key` appears only in this answer.

type APIKeyKeyType

type APIKeyKeyType string

APIKeyKeyType `secret` can read and change everything in its mode of the account, except team members and the test email, which need a dashboard sign-in. `ingest` can only send usage events and call `GET /v1/whoami`, for LiteLLM or another gateway.

const (
	APIKeyKeyTypeIngest APIKeyKeyType = "ingest"
	APIKeyKeyTypeSecret APIKeyKeyType = "secret"
)

Defines values for APIKeyKeyType.

func (APIKeyKeyType) Valid

func (e APIKeyKeyType) Valid() bool

Valid indicates whether the value is a known member of the APIKeyKeyType enum.

type APIKeyRotation

type APIKeyRotation struct {
	// NewKey An API key's details. The key's value is never returned here: only
	// `POST /v1/api-keys` and `POST /v1/api-keys/{id}/rotate` show it,
	// once, as `raw_key`.
	NewKey APIKey `json:"new_key"`

	// OldKey An API key's details. The key's value is never returned here: only
	// `POST /v1/api-keys` and `POST /v1/api-keys/{id}/rotate` show it,
	// once, as `raw_key`.
	OldKey APIKey `json:"old_key"`

	// RawKey The new key's full value. Shown only once; store it now.
	RawKey string `json:"raw_key"`
}

APIKeyRotation The result of rotating a key: the old key as it now stands (revoked, or expiring at the end of the grace period), the new key, and the new key's full value.

type AcceptInvitationJSONBody added in v0.9.2

type AcceptInvitationJSONBody struct {
	// Password Required when no account has the invited email: at least
	// 12 characters, at most 72 bytes, and not one of the most
	// common passwords. Ignored otherwise.
	Password string `json:"password,omitempty"`

	// Token The token from the invite link.
	Token string `json:"token"`
}

AcceptInvitationJSONBody defines parameters for AcceptInvitation.

type AcceptInvitationJSONRequestBody added in v0.9.2

type AcceptInvitationJSONRequestBody AcceptInvitationJSONBody

AcceptInvitationJSONRequestBody defines body for AcceptInvitation for application/json ContentType.

type ActivateSubscriptionParams added in v0.9.2

type ActivateSubscriptionParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ActivateSubscriptionParams defines parameters for ActivateSubscription.

type ActivityActor

type ActivityActor struct {
	// Kind The kind of actor.
	Kind ActivityActorKind `json:"kind"`

	// Name The person's name or email, the API key's name, or the customer's display name. Absent for `automatic` and when no name is known.
	Name string `json:"name,omitempty"`

	// Via Where the customer acted. Set only for `customer`.
	Via ActivityActorVia `json:"via,omitempty"`
}

ActivityActor Who did it. `person` and `api_key` carry the name (a person's email when they have no name), `customer` says where through `via`, and `automatic` is anything Hardcount did on its own. Absent when no fact written with the row names one.

type ActivityActorKind

type ActivityActorKind string

ActivityActorKind The kind of actor.

const (
	ActivityActorKindApiKey    ActivityActorKind = "api_key"
	ActivityActorKindAutomatic ActivityActorKind = "automatic"
	ActivityActorKindCustomer  ActivityActorKind = "customer"
	ActivityActorKindPerson    ActivityActorKind = "person"
)

Defines values for ActivityActorKind.

func (ActivityActorKind) Valid

func (e ActivityActorKind) Valid() bool

Valid indicates whether the value is a known member of the ActivityActorKind enum.

type ActivityActorVia

type ActivityActorVia string

ActivityActorVia Where the customer acted. Set only for `customer`.

const (
	PaymentPage ActivityActorVia = "payment_page"
	Portal      ActivityActorVia = "portal"
)

Defines values for ActivityActorVia.

func (ActivityActorVia) Valid

func (e ActivityActorVia) Valid() bool

Valid indicates whether the value is a known member of the ActivityActorVia enum.

type ActivityLine

type ActivityLine struct {
	// Actor Who did it. `person` and `api_key` carry the name (a person's email
	// when they have no name), `customer` says where through `via`, and
	// `automatic` is anything Hardcount did on its own. Absent when no fact
	// written with the row names one.
	Actor ActivityActor `json:"actor,omitempty"`

	// Amount An amount on an activity row. The dashboard formats it, for example as `$86.50`.
	Amount ActivityMoney `json:"amount,omitempty"`

	// Detail The meta line before the actor. Each item is one segment, shown
	// joined by " · "; a segment's parts read as one phrase, for
	// example a money part followed by the text " refunded to card".
	// An empty list when there is nothing to add.
	Detail [][]ActivityPart `json:"detail"`

	// Id The row's stable key: the event's `id` on an invoice timeline
	// row, the audit entry's id on a subscription timeline row,
	// `dunning:` and the event's id on a dunning run event (the same
	// key the invoice timeline gives that event), and `email:` and
	// the email's id on a sent email (likewise).
	Id string `json:"id"`

	// Kind Machine name of the event.
	Kind string `json:"kind"`

	// OccurredAt When the event happened, on the entity's calendar (the test clock's time for an entity on a test clock).
	OccurredAt time.Time `json:"occurred_at"`

	// Problem What went wrong or what it means, on failure and warning rows whose title does not say it all. Absent otherwise.
	Problem string `json:"problem,omitempty"`

	// RecordedAt The real-world time of the event. Set only for an entity on a test clock, when it is known.
	RecordedAt time.Time `json:"recorded_at,omitempty"`

	// Title What happened, in plain words with no values, for example "Payment failed".
	Title string `json:"title"`

	// Tone neutral: something happened. success: money arrived, or was
	// returned as intended. warning: needs a look, or money will not
	// be collected. failure: an attempt failed.
	Tone ActivityLineTone `json:"tone"`
}

ActivityLine One activity row, with every word written by the server: a title with no values, the amount when the event moves money, asks for it or cancels money owed, a problem line on failure and warning rows, the meta line's parts and the actor, a tone, and the event's time on the entity's calendar. `recorded_at` is the real-world time, set only for an entity on a test clock. The invoice payment timeline and dunning run events carry it.

type ActivityLineTone

type ActivityLineTone string

ActivityLineTone neutral: something happened. success: money arrived, or was returned as intended. warning: needs a look, or money will not be collected. failure: an attempt failed.

const (
	ActivityLineToneFailure ActivityLineTone = "failure"
	ActivityLineToneNeutral ActivityLineTone = "neutral"
	ActivityLineToneSuccess ActivityLineTone = "success"
	ActivityLineToneWarning ActivityLineTone = "warning"
)

Defines values for ActivityLineTone.

func (ActivityLineTone) Valid

func (e ActivityLineTone) Valid() bool

Valid indicates whether the value is a known member of the ActivityLineTone enum.

type ActivityLink struct {
	// Id The object's id, to fetch or link to it.
	Id string `json:"id"`

	// Kind The kind of object.
	Kind ActivityLinkKind `json:"kind"`

	// Label The text to show for the link, such as a credit note number or a subscription's name.
	Label string `json:"label"`
}

ActivityLink An object the row's own data names, which still exists.

type ActivityLinkKind

type ActivityLinkKind string

ActivityLinkKind The kind of object.

const (
	ActivityLinkKindCreditNote   ActivityLinkKind = "credit_note"
	ActivityLinkKindInvoice      ActivityLinkKind = "invoice"
	ActivityLinkKindSubscription ActivityLinkKind = "subscription"
)

Defines values for ActivityLinkKind.

func (ActivityLinkKind) Valid

func (e ActivityLinkKind) Valid() bool

Valid indicates whether the value is a known member of the ActivityLinkKind enum.

type ActivityMoney

type ActivityMoney struct {
	// Cents The amount in the currency's minor unit (cents for USD).
	Cents int64 `json:"cents"`

	// Currency The currency, as an uppercase ISO 4217 code.
	Currency string `json:"currency"`
}

ActivityMoney An amount on an activity row. The dashboard formats it, for example as `$86.50`.

type ActivityPart

type ActivityPart struct {
	// Link An object the row's own data names, which still exists.
	Link ActivityLink `json:"link,omitempty"`

	// Money An amount on an activity row. The dashboard formats it, for example as `$86.50`.
	Money ActivityMoney `json:"money,omitempty"`

	// Text Plain words to show as they are.
	Text string `json:"text,omitempty"`

	// Time A time to format for the reader, such as a retry date.
	Time time.Time `json:"time,omitempty"`
}

ActivityPart One piece of a meta segment. Exactly one field is set.

type AddInvoiceLineItemJSONRequestBody

type AddInvoiceLineItemJSONRequestBody = InvoiceLineItemInput

AddInvoiceLineItemJSONRequestBody defines body for AddInvoiceLineItem for application/json ContentType.

type AddInvoiceLineItemParams

type AddInvoiceLineItemParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AddInvoiceLineItemParams defines parameters for AddInvoiceLineItem.

type AddPlanPriceJSONRequestBody

type AddPlanPriceJSONRequestBody = PriceInput

AddPlanPriceJSONRequestBody defines body for AddPlanPrice for application/json ContentType.

type AddPlanPriceParams

type AddPlanPriceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AddPlanPriceParams defines parameters for AddPlanPrice.

type AddSubscriptionItemJSONBody

type AddSubscriptionItemJSONBody struct {
	// PlanId The plan to add (`hc_pln_…`). Not archived, and not already on the subscription.
	PlanId string `json:"plan_id"`

	// Quantity How many of the plan to bill. 0 or absent means 1.
	Quantity int64 `json:"quantity,omitempty"`
}

AddSubscriptionItemJSONBody defines parameters for AddSubscriptionItem.

type AddSubscriptionItemJSONRequestBody

type AddSubscriptionItemJSONRequestBody AddSubscriptionItemJSONBody

AddSubscriptionItemJSONRequestBody defines body for AddSubscriptionItem for application/json ContentType.

type AddSubscriptionItemParams

type AddSubscriptionItemParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AddSubscriptionItemParams defines parameters for AddSubscriptionItem.

type AdjustCreditsJSONBody

type AdjustCreditsJSONBody struct {
	// AmountCents Positive adds credit, negative removes it, in the
	// currency's minor unit (cents for USD). Not zero.
	AmountCents int64 `json:"amount_cents"`

	// Currency ISO 4217 code of the balance to change. Case-insensitive; stored uppercase.
	Currency string `json:"currency"`

	// CustomerId The customer whose credit to change (`hc_cus_…`).
	CustomerId string `json:"customer_id"`

	// Description Why you change the balance. Shown on the ledger entry. Must not be blank.
	Description string `json:"description"`
}

AdjustCreditsJSONBody defines parameters for AdjustCredits.

type AdjustCreditsJSONRequestBody

type AdjustCreditsJSONRequestBody AdjustCreditsJSONBody

AdjustCreditsJSONRequestBody defines body for AdjustCredits for application/json ContentType.

type AdjustCreditsParams

type AdjustCreditsParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AdjustCreditsParams defines parameters for AdjustCredits.

type AdvanceTestClockJSONBody added in v0.9.2

type AdvanceTestClockJSONBody struct {
	// FrozenTime The clock's new time, RFC 3339. Must be after its
	// current `frozen_time` and at most one year after it.
	FrozenTime time.Time `json:"frozen_time"`
}

AdvanceTestClockJSONBody defines parameters for AdvanceTestClock.

type AdvanceTestClockJSONRequestBody added in v0.9.2

type AdvanceTestClockJSONRequestBody AdvanceTestClockJSONBody

AdvanceTestClockJSONRequestBody defines body for AdvanceTestClock for application/json ContentType.

type AdvanceTestClockParams added in v0.9.2

type AdvanceTestClockParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AdvanceTestClockParams defines parameters for AdvanceTestClock.

type AggregateUsageEventsParams

type AggregateUsageEventsParams struct {
	// CustomerId Only this customer's events (`hc_cus_…`, the Hardcount ID, not your external ID).
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// MeterId Only this meter's events (`hc_mtr_…`).
	MeterId string `form:"meter_id,omitempty" json:"meter_id,omitempty"`

	// From Events at or after this time. RFC 3339, or a date (YYYY-MM-DD) meaning 00:00:00 UTC.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Events before this time, exclusive. RFC 3339, or a date (YYYY-MM-DD) meaning 23:59:59.999999 UTC that day, so the day is included.
	To string `form:"to,omitempty" json:"to,omitempty"`

	// Dimensions Comma-separated key=value pairs matched against event dimensions,
	// same syntax as `GET /v1/usage-events`. Example:
	// `model=gpt-4o,token_type=input`.
	Dimensions string `form:"dimensions,omitempty" json:"dimensions,omitempty"`

	// Tz IANA time zone for the calendar days of `by_meter[].daily`
	// (default UTC). An unknown name returns 422.
	Tz string `form:"tz,omitempty" json:"tz,omitempty"`
}

AggregateUsageEventsParams defines parameters for AggregateUsageEvents.

type AnalyticsMrrMovementPoint

type AnalyticsMrrMovementPoint struct {
	// Churned MRR of subscriptions canceled in the bucket, as a positive amount in the currency's minor unit.
	Churned int64 `json:"churned"`

	// Contraction MRR removed in the bucket by item removals and plan or quantity decreases, as a positive amount in the currency's minor unit.
	Contraction int64 `json:"contraction"`

	// Date Bucket start, `YYYY-MM-DD` (or `YYYY-MM` for `12m`), in UTC.
	Date string `json:"date"`

	// Expansion MRR added in the bucket by item adds and plan or quantity increases, in the currency's minor unit.
	Expansion int64 `json:"expansion"`

	// Net `new` + `expansion` - `contraction` - `churned` for the bucket, in the currency's minor unit.
	Net int64 `json:"net"`

	// New MRR of subscriptions activated in the bucket, in the currency's minor unit.
	New int64 `json:"new"`
}

AnalyticsMrrMovementPoint MRR movement in one bucket of `GET /v1/analytics/mrr-movement`: a UTC day, or a UTC month for `12m`. Amounts are in the minor unit of the account's default currency (cents for USD). Expansion and contraction count only subscriptions that were active for the whole requested window.

type AnalyticsMrrMovementTotals

type AnalyticsMrrMovementTotals struct {
	// Churned MRR of subscriptions canceled in the window, as a positive amount in the currency's minor unit.
	Churned int64 `json:"churned"`

	// Contraction MRR removed by item removals and plan or quantity decreases, as a positive amount in the currency's minor unit.
	Contraction int64 `json:"contraction"`

	// Expansion MRR added by item adds and plan or quantity increases, in the currency's minor unit.
	Expansion int64 `json:"expansion"`

	// Net The overall change, `new` + `expansion` - `contraction` - `churned`, in the currency's minor unit. Can be negative.
	Net int64 `json:"net"`

	// New MRR of subscriptions activated in the window, in the currency's minor unit.
	New int64 `json:"new"`
}

AnalyticsMrrMovementTotals How MRR (monthly recurring revenue from plan base fees) changed over the whole window, in the minor unit of the account's default currency (cents for USD). `churned` and `contraction` are positive amounts. `net` = `new` + `expansion` - `contraction` - `churned`. Expansion and contraction count only subscriptions that were active for the whole window: a subscription activated or canceled inside it counts only in `new` or `churned`. Test-clock subscriptions are left out.

type AnalyticsOverview

type AnalyticsOverview struct {
	// ActiveCustomers Customer records with status `active`. Includes customers with
	// no subscription or only canceled ones; `live_customers` counts
	// the customers you bill.
	ActiveCustomers int `json:"active_customers"`

	// ActiveSubscriptions Subscriptions with status `active`.
	ActiveSubscriptions int `json:"active_subscriptions"`

	// Arr `mrr` times 12.
	Arr int64 `json:"arr"`

	// ArrPrev `mrr_prev` times 12.
	ArrPrev int64 `json:"arr_prev"`

	// AvgInvoiceValue Average total of invoices paid in the window.
	AvgInvoiceValue int64 `json:"avg_invoice_value"`

	// CreditBalanceByCurrency Customers' credit balances added up per currency, `currency` first, then largest. A currency whose balance is zero is left out. Customers on a test clock are not counted.
	CreditBalanceByCurrency []struct {
		// AmountCents Credit customers hold in this currency, in its minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// Currency Three-letter currency code, in upper case.
		Currency string `json:"currency"`
	} `json:"credit_balance_by_currency"`

	// Currency The account's default currency (USD when none is set). Every money field uses it, except `credit_balance_by_currency` and `outstanding_by_currency`, which carry their own.
	Currency string `json:"currency"`

	// DunningActive Dunning runs (automatic payment retries) still in progress.
	DunningActive int `json:"dunning_active"`

	// DunningRecoveryRate Dunning runs opened in the window that a payment closed (`resolution` is `payment_recovered` and the invoice has `amount_paid_cents` above 0), divided by all runs opened in the window. A run closed by a void, a write-off, or a credit note or customer credit that left nothing due is not recovered. 0 when none were opened.
	DunningRecoveryRate float64 `json:"dunning_recovery_rate"`

	// FailedPayments Open invoices created in the window whose payment failed. A voided or written-off invoice is not counted. All currencies.
	FailedPayments int `json:"failed_payments"`

	// FailedPaymentsPrev `failed_payments` for the previous window.
	FailedPaymentsPrev int `json:"failed_payments_prev"`

	// LiveCustomers Customers with at least one `active` or `trialing` subscription now.
	LiveCustomers int `json:"live_customers"`

	// LiveCustomersPrev `live_customers` at the start of the window, rebuilt from
	// subscription start and cancel times.
	LiveCustomersPrev int `json:"live_customers_prev"`

	// LogoChurnRate Subscriptions canceled in the window, divided by subscriptions active at its start. 0 when none were active.
	LogoChurnRate float64 `json:"logo_churn_rate"`

	// Mrr MRR now, from plan base fees only (base amount times quantity,
	// yearly plans divided by 12) on `active` subscriptions with plans
	// in `currency`. Trialing subscriptions and usage charges are not
	// counted.
	Mrr int64 `json:"mrr"`

	// MrrMovement How MRR (monthly recurring revenue from plan base fees) changed over
	// the whole window, in the minor unit of the account's default
	// currency (cents for USD). `churned` and `contraction` are positive
	// amounts. `net` = `new` + `expansion` - `contraction` - `churned`.
	// Expansion and contraction count only subscriptions that were active
	// for the whole window: a subscription activated or canceled inside
	// it counts only in `new` or `churned`. Test-clock subscriptions are
	// left out.
	MrrMovement AnalyticsMrrMovementTotals `json:"mrr_movement"`

	// MrrPrev MRR at the start of the window, rebuilt from item change history.
	MrrPrev int64 `json:"mrr_prev"`

	// NewCustomers Customers created in the window.
	NewCustomers int `json:"new_customers"`

	// Nrr Net revenue retention: (`mrr_prev` + expansion - contraction -
	// churned) divided by `mrr_prev`. Can be above 1. 0 when
	// `mrr_prev` is 0.
	Nrr float64 `json:"nrr"`

	// OpenInvoices Finalized invoices whose payment has not succeeded. All currencies.
	OpenInvoices int `json:"open_invoices"`

	// OutstandingAr Amount due on finalized invoices whose payment has not succeeded, in `currency` only.
	OutstandingAr int64 `json:"outstanding_ar"`

	// OutstandingByCurrency Amount due on the invoices `open_invoices` counts, one entry per
	// currency. `currency` comes first, then the largest amount. Empty
	// when nothing is owed.
	OutstandingByCurrency []struct {
		// AmountCents Amount due in this currency, in its minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// Currency Three-letter currency code, in upper case.
		Currency string `json:"currency"`
	} `json:"outstanding_by_currency"`

	// PaidInvoices Invoices in `currency` paid in the window.
	PaidInvoices int `json:"paid_invoices"`

	// Period The window an analytics call covers, ending now: the last 7, 30 or
	// 90 days, or `12m` for the last 365 days in monthly buckets. The
	// other periods use daily buckets.
	Period AnalyticsPeriod `json:"period"`

	// RefundsNeedingAttention Issued credit notes whose refund failed or has an unknown
	// result, has stayed pending for 72 hours since the note last
	// changed, or owes a refund that has not started an hour after the
	// note last changed. Test-clock credit notes are not counted.
	RefundsNeedingAttention int `json:"refunds_needing_attention"`

	// Revenue What paid the invoices paid in the window (payment plus customer credit applied). A credit note that lowered an invoice before it was paid is not counted.
	Revenue int64 `json:"revenue"`

	// RevenueChurnRate Churned MRR divided by `mrr_prev`. 0 when `mrr_prev` is 0.
	RevenueChurnRate float64 `json:"revenue_churn_rate"`

	// RevenuePrev `revenue` for the previous window.
	RevenuePrev int64 `json:"revenue_prev"`

	// TrialingSubscriptions Subscriptions with status `trialing`.
	TrialingSubscriptions int `json:"trialing_subscriptions"`

	// UsageEvents Usage events with a timestamp in the window.
	UsageEvents int64 `json:"usage_events"`
}

AnalyticsOverview The dashboard's headline metrics, from `GET /v1/analytics/overview`. "The window" is the requested period, ending now. "The previous window" is the one of equal length before it. Money is in the minor unit of `currency` (cents for USD). Rates are fractions, so 0.05 means 5%. Customers, subscriptions and invoices on test clocks are left out of every figure.

type AnalyticsPeriod

type AnalyticsPeriod string

AnalyticsPeriod The window an analytics call covers, ending now: the last 7, 30 or 90 days, or `12m` for the last 365 days in monthly buckets. The other periods use daily buckets.

const (
	N12m AnalyticsPeriod = "12m"
	N30d AnalyticsPeriod = "30d"
	N7d  AnalyticsPeriod = "7d"
	N90d AnalyticsPeriod = "90d"
)

Defines values for AnalyticsPeriod.

func (AnalyticsPeriod) Valid

func (e AnalyticsPeriod) Valid() bool

Valid indicates whether the value is a known member of the AnalyticsPeriod enum.

type AnalyticsRevenuePoint

type AnalyticsRevenuePoint struct {
	// Date Bucket start, `YYYY-MM-DD` (or `YYYY-MM` for `12m`), in UTC.
	Date string `json:"date"`

	// InvoiceCount Invoices paid in the bucket.
	InvoiceCount int `json:"invoice_count"`

	// RevenueCents What paid the invoices paid in the bucket (payment plus customer
	// credit applied), in the minor unit of the default currency
	// (cents for USD). A credit note that lowered an invoice before it
	// was paid is not counted.
	RevenueCents int64 `json:"revenue_cents"`
}

AnalyticsRevenuePoint Paid-invoice revenue in one bucket of `GET /v1/analytics/revenue-chart`: a UTC day, or a UTC month for `12m`. Only invoices in the account's default currency are counted.

type AnalyticsTopMeter

type AnalyticsTopMeter struct {
	// EventName The event name usage events send to reach this meter.
	EventName string `json:"event_name"`

	// Events Usage events on this meter with a timestamp in the window.
	Events int64 `json:"events"`

	// MeterId The meter's id (`hc_mtr_…`).
	MeterId string `json:"meter_id"`

	// MeterName The meter's display name.
	MeterName string `json:"meter_name"`

	// Quantity Summed quantity, as a decimal string.
	Quantity string `json:"quantity"`
}

AnalyticsTopMeter One of the meters with the most usage events in the window, in `GET /v1/analytics/usage`.

type AnalyticsUsagePoint

type AnalyticsUsagePoint struct {
	// Date Bucket start, `YYYY-MM-DD` (or `YYYY-MM` for `12m`), in UTC.
	Date string `json:"date"`

	// Events Usage events with a timestamp in the bucket, over all meters.
	Events int64 `json:"events"`

	// Quantity Summed quantity, as a decimal string.
	Quantity string `json:"quantity"`
}

AnalyticsUsagePoint Usage in one bucket of `GET /v1/analytics/usage`: a UTC day, or a UTC month for `12m`. Events of customers on a test clock are left out.

type AttachStripeRefundToCreditNoteJSONBody added in v0.9.2

type AttachStripeRefundToCreditNoteJSONBody struct {
	// StripeRefundId Stripe's id of the refund you made (`re_…`).
	StripeRefundId string `json:"stripe_refund_id"`
}

AttachStripeRefundToCreditNoteJSONBody defines parameters for AttachStripeRefundToCreditNote.

type AttachStripeRefundToCreditNoteJSONRequestBody added in v0.9.2

type AttachStripeRefundToCreditNoteJSONRequestBody AttachStripeRefundToCreditNoteJSONBody

AttachStripeRefundToCreditNoteJSONRequestBody defines body for AttachStripeRefundToCreditNote for application/json ContentType.

type AttachStripeRefundToCreditNoteParams added in v0.9.2

type AttachStripeRefundToCreditNoteParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

AttachStripeRefundToCreditNoteParams defines parameters for AttachStripeRefundToCreditNote.

type Attention

type Attention struct {
	// Actions Recommended next steps. The first is the main one; the rest are
	// secondary. Absent when there is nothing to do but wait.
	Actions []AttentionActionItem `json:"actions,omitempty"`

	// Code Open, dotted code naming the exact cause, for example
	// `tax.customer_data_invalid` or `payment.declined`. New codes can
	// appear in any release, as with Stripe's error codes.
	Code string `json:"code,omitempty"`

	// Detail Hardcount's own explanation behind `message`: why the state
	// holds, what Hardcount does on its own, and ids support may ask
	// for (for example the payment intent ids of a payment
	// anomaly). Plain text; may contain blank-line paragraph
	// breaks. Never a provider payload: that is
	// `provider_response`.
	Detail string `json:"detail,omitempty"`

	// DocUrl A link to documentation about this reason. No such pages are
	// published yet, so this release always leaves it out.
	DocUrl string `json:"doc_url,omitempty"`

	// DueBy The invoice's payment deadline (its `due_at`). Hardcount does not
	// act on this date; it is shown so you know it. Absent when the
	// reason does not show a deadline or the invoice has none.
	DueBy time.Time `json:"due_by,omitempty"`

	// Message Text that is safe to show as it is: one plain sentence saying
	// what happens and what to do. Facts that must show up front
	// follow on more lines, separated by a newline (`\n`), one sentence
	// each and up to three lines in all: the setup-link email on
	// `no_payment_method` (and on `dunning_exhausted` when no link can
	// be emailed), and the prepaid credit at risk on an unpaid commit
	// invoice. A no-card commit invoice carries all three. The wording
	// can change between releases; switch on `reason` and `code`, not
	// on this text.
	Message string `json:"message"`

	// NextAttemptAt When Hardcount will next retry on its own. Today only a tax
	// retry sets it. Absent when no automatic retry is scheduled.
	NextAttemptAt time.Time `json:"next_attempt_at,omitempty"`

	// Param Dotted path to the field to edit to fix the cause. Today only
	// `tax_location_required` sets it, always to
	// `customer.address.postal_code`, even when the tax ID is what is
	// wrong. Absent otherwise.
	Param string `json:"param,omitempty"`

	// ProviderResponse The provider's response as Hardcount recorded it: the Stripe Tax
	// error (cleaned of its JSON envelope and cut to 500 bytes),
	// or the invoice's `last_payment_error`. Absent when Hardcount did
	// not call the provider or recorded no response.
	ProviderResponse string `json:"provider_response,omitempty"`

	// Reason Why an invoice needs your attention, as a closed code. A code is never
	// reused for another meaning; a retired code stays reserved.
	// `Attention.code` carries the open, provider-specific sub-code.
	// - `tax_calculation_failed`: the tax provider could not calculate
	//   tax. The cause is in `code`.
	// - `tax_location_required`: the customer's billing address or tax ID
	//   is missing or not valid for the tax provider. Edit the billing
	//   profile.
	// - `payment_failed`: the last charge failed. `code` is
	//   `payment.declined` for a decline, `payment.card_refused` when the
	//   bank refused the card for good, or
	//   `payment.authentication_required` when the bank wants the customer
	//   to confirm the payment. Stripe's own message is in
	//   `provider_response`.
	// - `payment_unconfirmed`: a charge got an unclear answer from Stripe.
	//   Hardcount asks Stripe what happened.
	// - `payment_anomaly`: money does not reconcile: a double charge, a
	//   captured amount that differs from the amount booked, a payment in
	//   another currency, or a payment on a voided invoice. Shown even on
	//   paid and voided invoices.
	// - `payment_processing`: a payment may be in progress. Stripe is
	//   still processing a charge (it settles on its own), the customer
	//   has the hosted payment page open (`code` `payment.page_open`), or
	//   a charge is in progress on a written-off invoice (`code`
	//   `payment.recovery_processing`).
	// - `payment_scheduled`: the invoice is queued, and the automatic
	//   charge collects it on its next run.
	// - `awaiting_payment`: the invoice is unpaid and not queued for an
	//   automatic charge. Only invoices written by older releases reach
	//   this state.
	// - `no_payment_method`: the customer has no card ready to charge. The
	//   invoice stays queued, and the automatic charge collects it on its
	//   first run after a card is added, unless collection is paused on
	//   the subscription. When Stripe is not connected for the invoice's
	//   mode, no card can be added online and the invoice is emailed
	//   instead. `message` says which applies.
	// - `dunning_exhausted`: the customer still has no card and automatic
	//   recovery has ended without collecting; the policy's final action
	//   ran. If that action paused collection on the subscription, resume
	//   it too: the automatic charge skips a paused subscription even
	//   after a card is added.
	// - `collection_paused`: the invoice is queued for an automatic charge,
	//   but its subscription has `pause_collection` set, so the automatic
	//   charge skips it. A dunning run already open on the invoice keeps
	//   retrying it through the pause, and `message` then says so. With no
	//   open run it is not charged automatically until collection
	//   resumes.
	// - `commit_exposure`: the invoice funded a prepaid commit and is
	//   unpaid, and the customer can already spend that credit or has
	//   spent it. Prepaid credit is granted when the invoice is issued,
	//   not when it is paid.
	//   This reason is returned only when no other reason applies. When
	//   one does, the exposure is folded into that reason's `message` and
	//   `actions` instead, so do not treat this code as the only sign of
	//   exposure.
	// - `dispute_lost`: the customer disputed a payment on the invoice with
	//   their bank, and the dispute closed as `lost`, so the bank took the
	//   money back. Hardcount leaves the invoice paid and moves no money;
	//   you record the loss. Shown even on paid invoices, which is where
	//   disputes land. On an invoice that
	//   bought prepaid credit, the message also says how much of the
	//   credit is still spendable and names commit relief, because an
	//   ordinary credit note is refused there. When the invoice also has
	//   `payment_anomaly`, that reason stays and its message asks you to
	//   check Stripe before any refund. The disputes are at
	//   `GET /v1/invoices/{id}/disputes`.
	// - `refunded_in_stripe`: a refund of the invoice's payment was made
	//   in Stripe outside Hardcount, and Hardcount did not record it as a
	//   credit note: the invoice was not paid yet, the currency differs,
	//   the invoice bought prepaid credit, Hardcount first saw the refund
	//   more than a day after it was made, a credit note on the invoice
	//   has a failed card refund this refund may replace, or the refund is
	//   more than the invoice had left to refund or credit. `code` is
	//   `payment.refunded_in_stripe.` followed by that review reason.
	//   Record it with a credit note that names the refund
	//   (`stripe_refund_id` on `POST /v1/credit-notes`), attach it to the
	//   credit note whose refund failed
	//   (`POST /v1/credit-notes/{id}/attach-stripe-refund`), or dismiss it
	//   (`POST /v1/invoices/{id}/stripe-refunds/{stripe_refund_id}/dismiss`).
	//   Shown even on paid invoices, which is where refunds land.
	// - `amount_below_minimum`: Stripe refused to charge the invoice, or
	//   refused a payment page for it, because the amount is below
	//   Stripe's minimum charge. The minimum depends on the currency the
	//   Stripe account settles in; Stripe's reply, in
	//   `provider_response`, names it. Nothing was charged, the invoice
	//   stays `finalized` with `payment_status` `pending`, it is not
	//   charged again automatically, dunning does not start (a run already
	//   open ends), and the customer is not emailed. Void it or record a
	//   payment. `POST /v1/invoices/{id}/collect` applies the customer's
	//   credit balance and marks the invoice paid if that covers it, and
	//   otherwise asks Stripe again. Stripe's answer can change (for a
	//   converted charge the minimum is the settlement currency's), and a
	//   different answer ends this reason.
	Reason AttentionReason `json:"reason"`

	// Severity How urgent an `Attention` notice is, most urgent first: `critical`,
	// `warning`, `info`. Sort or filter on it; the dashboard shows one
	// colour per level.
	Severity AttentionSeverity `json:"severity"`

	// Since When the condition started, so you can sort by age. For a tax
	// reason it is when tax was deferred, for `amount_below_minimum`
	// when Stripe refused the amount, for `dispute_lost` when the
	// dispute closed, and for `refunded_in_stripe` when the refund was
	// made. Otherwise it is when the invoice last changed; on a test
	// clock, when it was issued or its last charge failed. Absent when
	// it is not known.
	Since time.Time `json:"since,omitempty"`
}

Attention Why an invoice needs your attention now, and what to do about it. Hardcount works it out each time the invoice is read, from the invoice's tax and payment state and related facts (the customer's card, the dunning run, disputes, refunds made in Stripe); it is never stored. The invoice leaves it out when nothing needs attention. `GET /v1/invoices`, `GET /v1/invoices/{id}` and the finalize, retry-tax and rotate-public-token responses carry it; the other invoice responses and the webhook events do not.

type AttentionAction

type AttentionAction string

AttentionAction A recommended next step, as a closed code. Each code maps to an API route or a dashboard page.

  • `edit_billing_profile`: fix the customer's billing address or tax ID.
  • `retry_tax`: `POST /v1/invoices/{id}/retry-tax`.
  • `retry_payment` and `charge_now`: `POST /v1/invoices/{id}/collect`.
  • `wait_provider`: nothing to do; the provider is expected to answer.
  • `rotate_api_key`: replace the Stripe key under Settings.
  • `reconcile_payment`: open the payment in Stripe and refund or correct it there. Offered on `payment_anomaly`.
  • `review_registration`: check your tax registrations with the tax provider.
  • `send_reminder`: email the customer. On `no_payment_method` and `dunning_exhausted` that is the setup link (`POST /v1/invoices/{id}/resend-setup-link`); otherwise it is the invoice with its payment link (`POST /v1/invoices/{id}/send`).
  • `add_payment_method`: add a card for the customer.
  • `update_payment_method`: send the customer a link to replace a card that was declined.
  • `connect_tax_provider`: connect the tax provider under Settings.
  • `void_invoice`: `POST /v1/invoices/{id}/void`. Offered on prepaid-commit exposure while some granted credit is unspent: voiding retires the unspent balance, and credit already spent is not taken back. Also offered on `amount_below_minimum`.
  • `mark_uncollectible`: `POST /v1/invoices/{id}/mark-uncollectible`. Offered only on a parked invoice (payment status `unknown` with no payment intent recorded), for a customer who paid another way. After the write-off, Hardcount still records a payment that Stripe shows, but it no longer charges the invoice. The dashboard shows it as a secondary action.
const (
	AttentionActionAddPaymentMethod    AttentionAction = "add_payment_method"
	AttentionActionChargeNow           AttentionAction = "charge_now"
	AttentionActionConnectTaxProvider  AttentionAction = "connect_tax_provider"
	AttentionActionEditBillingProfile  AttentionAction = "edit_billing_profile"
	AttentionActionMarkUncollectible   AttentionAction = "mark_uncollectible"
	AttentionActionReconcilePayment    AttentionAction = "reconcile_payment"
	AttentionActionRetryPayment        AttentionAction = "retry_payment"
	AttentionActionRetryTax            AttentionAction = "retry_tax"
	AttentionActionReviewRegistration  AttentionAction = "review_registration"
	AttentionActionRotateApiKey        AttentionAction = "rotate_api_key"
	AttentionActionSendReminder        AttentionAction = "send_reminder"
	AttentionActionUpdatePaymentMethod AttentionAction = "update_payment_method"
	AttentionActionVoidInvoice         AttentionAction = "void_invoice"
	AttentionActionWaitProvider        AttentionAction = "wait_provider"
)

Defines values for AttentionAction.

func (AttentionAction) Valid

func (e AttentionAction) Valid() bool

Valid indicates whether the value is a known member of the AttentionAction enum.

type AttentionActionItem

type AttentionActionItem struct {
	// Code A recommended next step, as a closed code. Each code maps to an API
	// route or a dashboard page.
	// - `edit_billing_profile`: fix the customer's billing address or tax
	//   ID.
	// - `retry_tax`: `POST /v1/invoices/{id}/retry-tax`.
	// - `retry_payment` and `charge_now`: `POST /v1/invoices/{id}/collect`.
	// - `wait_provider`: nothing to do; the provider is expected to answer.
	// - `rotate_api_key`: replace the Stripe key under Settings.
	// - `reconcile_payment`: open the payment in Stripe and refund or
	//   correct it there. Offered on `payment_anomaly`.
	// - `review_registration`: check your tax registrations with the tax
	//   provider.
	// - `send_reminder`: email the customer. On `no_payment_method` and
	//   `dunning_exhausted` that is the setup link
	//   (`POST /v1/invoices/{id}/resend-setup-link`); otherwise it is the
	//   invoice with its payment link (`POST /v1/invoices/{id}/send`).
	// - `add_payment_method`: add a card for the customer.
	// - `update_payment_method`: send the customer a link to replace a
	//   card that was declined.
	// - `connect_tax_provider`: connect the tax provider under Settings.
	// - `void_invoice`: `POST /v1/invoices/{id}/void`. Offered on
	//   prepaid-commit exposure while some granted credit is unspent:
	//   voiding retires the unspent balance, and credit already spent is
	//   not taken back. Also offered on `amount_below_minimum`.
	// - `mark_uncollectible`:
	//   `POST /v1/invoices/{id}/mark-uncollectible`. Offered only on a
	//   parked invoice (payment status `unknown` with no payment intent
	//   recorded), for a customer who paid another way. After the
	//   write-off, Hardcount still records a payment that Stripe shows,
	//   but it no longer charges the invoice. The dashboard shows it as a
	//   secondary action.
	Code AttentionAction `json:"code"`

	// Label A default button label. You can show your own, translated text
	// instead. Absent when there is none.
	Label string `json:"label,omitempty"`
}

AttentionActionItem One recommended next step on an `Attention` notice.

type AttentionReason

type AttentionReason string

AttentionReason Why an invoice needs your attention, as a closed code. A code is never reused for another meaning; a retired code stays reserved. `Attention.code` carries the open, provider-specific sub-code.

  • `tax_calculation_failed`: the tax provider could not calculate tax. The cause is in `code`.
  • `tax_location_required`: the customer's billing address or tax ID is missing or not valid for the tax provider. Edit the billing profile.
  • `payment_failed`: the last charge failed. `code` is `payment.declined` for a decline, `payment.card_refused` when the bank refused the card for good, or `payment.authentication_required` when the bank wants the customer to confirm the payment. Stripe's own message is in `provider_response`.
  • `payment_unconfirmed`: a charge got an unclear answer from Stripe. Hardcount asks Stripe what happened.
  • `payment_anomaly`: money does not reconcile: a double charge, a captured amount that differs from the amount booked, a payment in another currency, or a payment on a voided invoice. Shown even on paid and voided invoices.
  • `payment_processing`: a payment may be in progress. Stripe is still processing a charge (it settles on its own), the customer has the hosted payment page open (`code` `payment.page_open`), or a charge is in progress on a written-off invoice (`code` `payment.recovery_processing`).
  • `payment_scheduled`: the invoice is queued, and the automatic charge collects it on its next run.
  • `awaiting_payment`: the invoice is unpaid and not queued for an automatic charge. Only invoices written by older releases reach this state.
  • `no_payment_method`: the customer has no card ready to charge. The invoice stays queued, and the automatic charge collects it on its first run after a card is added, unless collection is paused on the subscription. When Stripe is not connected for the invoice's mode, no card can be added online and the invoice is emailed instead. `message` says which applies.
  • `dunning_exhausted`: the customer still has no card and automatic recovery has ended without collecting; the policy's final action ran. If that action paused collection on the subscription, resume it too: the automatic charge skips a paused subscription even after a card is added.
  • `collection_paused`: the invoice is queued for an automatic charge, but its subscription has `pause_collection` set, so the automatic charge skips it. A dunning run already open on the invoice keeps retrying it through the pause, and `message` then says so. With no open run it is not charged automatically until collection resumes.
  • `commit_exposure`: the invoice funded a prepaid commit and is unpaid, and the customer can already spend that credit or has spent it. Prepaid credit is granted when the invoice is issued, not when it is paid. This reason is returned only when no other reason applies. When one does, the exposure is folded into that reason's `message` and `actions` instead, so do not treat this code as the only sign of exposure.
  • `dispute_lost`: the customer disputed a payment on the invoice with their bank, and the dispute closed as `lost`, so the bank took the money back. Hardcount leaves the invoice paid and moves no money; you record the loss. Shown even on paid invoices, which is where disputes land. On an invoice that bought prepaid credit, the message also says how much of the credit is still spendable and names commit relief, because an ordinary credit note is refused there. When the invoice also has `payment_anomaly`, that reason stays and its message asks you to check Stripe before any refund. The disputes are at `GET /v1/invoices/{id}/disputes`.
  • `refunded_in_stripe`: a refund of the invoice's payment was made in Stripe outside Hardcount, and Hardcount did not record it as a credit note: the invoice was not paid yet, the currency differs, the invoice bought prepaid credit, Hardcount first saw the refund more than a day after it was made, a credit note on the invoice has a failed card refund this refund may replace, or the refund is more than the invoice had left to refund or credit. `code` is `payment.refunded_in_stripe.` followed by that review reason. Record it with a credit note that names the refund (`stripe_refund_id` on `POST /v1/credit-notes`), attach it to the credit note whose refund failed (`POST /v1/credit-notes/{id}/attach-stripe-refund`), or dismiss it (`POST /v1/invoices/{id}/stripe-refunds/{stripe_refund_id}/dismiss`). Shown even on paid invoices, which is where refunds land.
  • `amount_below_minimum`: Stripe refused to charge the invoice, or refused a payment page for it, because the amount is below Stripe's minimum charge. The minimum depends on the currency the Stripe account settles in; Stripe's reply, in `provider_response`, names it. Nothing was charged, the invoice stays `finalized` with `payment_status` `pending`, it is not charged again automatically, dunning does not start (a run already open ends), and the customer is not emailed. Void it or record a payment. `POST /v1/invoices/{id}/collect` applies the customer's credit balance and marks the invoice paid if that covers it, and otherwise asks Stripe again. Stripe's answer can change (for a converted charge the minimum is the settlement currency's), and a different answer ends this reason.
const (
	AttentionReasonAmountBelowMinimum   AttentionReason = "amount_below_minimum"
	AttentionReasonAwaitingPayment      AttentionReason = "awaiting_payment"
	AttentionReasonCollectionPaused     AttentionReason = "collection_paused"
	AttentionReasonCommitExposure       AttentionReason = "commit_exposure"
	AttentionReasonDisputeLost          AttentionReason = "dispute_lost"
	AttentionReasonDunningExhausted     AttentionReason = "dunning_exhausted"
	AttentionReasonNoPaymentMethod      AttentionReason = "no_payment_method"
	AttentionReasonPaymentAnomaly       AttentionReason = "payment_anomaly"
	AttentionReasonPaymentFailed        AttentionReason = "payment_failed"
	AttentionReasonPaymentProcessing    AttentionReason = "payment_processing"
	AttentionReasonPaymentScheduled     AttentionReason = "payment_scheduled"
	AttentionReasonPaymentUnconfirmed   AttentionReason = "payment_unconfirmed"
	AttentionReasonRefundedInStripe     AttentionReason = "refunded_in_stripe"
	AttentionReasonTaxCalculationFailed AttentionReason = "tax_calculation_failed"
	AttentionReasonTaxLocationRequired  AttentionReason = "tax_location_required"
)

Defines values for AttentionReason.

func (AttentionReason) Valid

func (e AttentionReason) Valid() bool

Valid indicates whether the value is a known member of the AttentionReason enum.

type AttentionSeverity

type AttentionSeverity string

AttentionSeverity How urgent an `Attention` notice is, most urgent first: `critical`, `warning`, `info`. Sort or filter on it; the dashboard shows one colour per level.

const (
	AttentionSeverityCritical AttentionSeverity = "critical"
	AttentionSeverityInfo     AttentionSeverity = "info"
	AttentionSeverityWarning  AttentionSeverity = "warning"
)

Defines values for AttentionSeverity.

func (AttentionSeverity) Valid

func (e AttentionSeverity) Valid() bool

Valid indicates whether the value is a known member of the AttentionSeverity enum.

type AuditLogEntry

type AuditLogEntry struct {
	// Action What was done, such as `create`, `update`, `revoke`, `finalize`
	// or `export`. `GET /v1/audit-log/filters` lists the values in use.
	Action string `json:"action"`

	// ActorId The user id, API key id or customer id, or `system`.
	ActorId string `json:"actor_id"`

	// ActorName A readable name for the actor: the API key's name, the user's
	// email or the customer's display name. Absent when none is known.
	ActorName string `json:"actor_name,omitempty"`

	// ActorType Who did it. `user`: a dashboard member. `api_key`: a request
	// made with an API key. `customer`: a customer acting on a hosted
	// page. `system`: Hardcount itself, such as a background job or a
	// Stripe webhook.
	ActorType AuditLogEntryActorType `json:"actor_type"`

	// CreatedAt When the entry was written, in real time.
	CreatedAt time.Time `json:"created_at"`

	// Id The entry's id (`hc_aud_…`).
	Id string `json:"id"`

	// IpAddress The client address of the request that made the change. Absent for work with no request.
	IpAddress string `json:"ip_address,omitempty"`

	// Metadata Action details. A settings change has `changed`, which lists
	// each changed field with `from` and `to`. Absent when the action
	// has none.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// RequestId Matches the `Hardcount-Request-Id` header of the request that made the change. Absent for work with no request.
	RequestId string `json:"request_id,omitempty"`

	// ResourceId The resource's id. Empty for account-wide resources such as settings, and for exports.
	ResourceId string `json:"resource_id"`

	// ResourceLabel A readable label for the resource, such as an invoice number or
	// a key's name. For a `user` resource, the user's or invitee's
	// email. Absent when there is none.
	ResourceLabel string `json:"resource_label,omitempty"`

	// ResourceType The kind of resource, such as `invoice`, `api_key`, `setting` or `user`.
	ResourceType string `json:"resource_type"`

	// SimEffectiveAt Simulated time, for entries made inside a test clock. Absent otherwise.
	SimEffectiveAt time.Time `json:"sim_effective_at,omitempty"`

	// SubjectDeleted True when the resource no longer exists because its test clock
	// was deleted. The entry is kept. Absent otherwise.
	SubjectDeleted bool `json:"subject_deleted,omitempty"`

	// TenantId The account the entry belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// TestClockId The test clock whose simulation the entry was made in. Absent otherwise.
	TestClockId string `json:"test_clock_id,omitempty"`
}

AuditLogEntry One audit log row: who did what to which resource, and when. `GET /v1/audit-log` lists them.

type AuditLogEntryActorType

type AuditLogEntryActorType string

AuditLogEntryActorType Who did it. `user`: a dashboard member. `api_key`: a request made with an API key. `customer`: a customer acting on a hosted page. `system`: Hardcount itself, such as a background job or a Stripe webhook.

const (
	AuditLogEntryActorTypeApiKey   AuditLogEntryActorType = "api_key"
	AuditLogEntryActorTypeCustomer AuditLogEntryActorType = "customer"
	AuditLogEntryActorTypeSystem   AuditLogEntryActorType = "system"
	AuditLogEntryActorTypeUser     AuditLogEntryActorType = "user"
)

Defines values for AuditLogEntryActorType.

func (AuditLogEntryActorType) Valid

func (e AuditLogEntryActorType) Valid() bool

Valid indicates whether the value is a known member of the AuditLogEntryActorType enum.

type AuditLogFilters

type AuditLogFilters struct {
	// Actions Every `action` value recorded in this mode, sorted A to Z, at most 500.
	Actions []string `json:"actions"`

	// ResourceTypes Every `resource_type` value recorded in this mode, sorted A to Z, at most 500.
	ResourceTypes []string `json:"resource_types"`

	// TestClocks Test clocks seen in the log, most recent activity first, at most 100. Deleted clocks are included.
	TestClocks []struct {
		// Id The test clock's id (`hc_tclk_…`).
		Id string `json:"id"`

		// Name The clock's name, taken from its own audit entries. Empty when the log has none.
		Name string `json:"name"`
	} `json:"test_clocks"`
}

AuditLogFilters The values `GET /v1/audit-log` can filter on, from `GET /v1/audit-log/filters`, for filter menus. Only entries in the caller's mode count.

type BackfillUsageEventJSONBody

type BackfillUsageEventJSONBody struct {
	// Dimensions Scalar labels of the event. A price takes an event whose labels include the price's `dimension_match`.
	Dimensions map[string]interface{} `json:"dimensions,omitempty"`

	// EventName The meter's `event_name` (e.g. "tokens").
	EventName string `json:"event_name"`

	// ExternalCustomerId The customer's external_id (your identifier), not the internal hc_cus_ id.
	ExternalCustomerId string `json:"external_customer_id"`

	// IdempotencyKey Your unique ID for this event. Pick it once, before the
	// first send, and send the same key on every retry of the
	// event. Keys are unique per account and mode (live or
	// test), forever. An event whose key was already used is
	// not stored again: the first event wins and the new body
	// is discarded. So never reuse a key for a different
	// event, such as a batch index or a timestamp that can
	// repeat, or that usage is lost. Empty or whitespace-only
	// keys are refused with 422, and so are keys longer than
	// 255 characters. This is the only dedup key: the usage
	// routes ignore the `Idempotency-Key` header.
	IdempotencyKey string `json:"idempotency_key"`

	// Quantity A JSON number (`5`) or a string holding one (`"5.5"`,
	// for exact decimals). At most 12 decimal places; trailing
	// zeros do not count. Its size must be under 10^26, and it
	// is at most 100 characters. A negative value is a
	// correction. A missing quantity, or any other value, is
	// refused with 422 and `param: quantity`.
	Quantity BackfillUsageEventJSONBody_Quantity `json:"quantity"`

	// Timestamp RFC 3339. Must not be in the future.
	Timestamp time.Time `json:"timestamp"`
}

BackfillUsageEventJSONBody defines parameters for BackfillUsageEvent.

type BackfillUsageEventJSONBodyQuantity0

type BackfillUsageEventJSONBodyQuantity0 = float32

BackfillUsageEventJSONBodyQuantity0 defines parameters for BackfillUsageEvent.

type BackfillUsageEventJSONBodyQuantity1

type BackfillUsageEventJSONBodyQuantity1 = string

BackfillUsageEventJSONBodyQuantity1 defines parameters for BackfillUsageEvent.

type BackfillUsageEventJSONBody_Quantity

type BackfillUsageEventJSONBody_Quantity struct {
	// contains filtered or unexported fields
}

BackfillUsageEventJSONBody_Quantity defines parameters for BackfillUsageEvent.

func (BackfillUsageEventJSONBody_Quantity) AsBackfillUsageEventJSONBodyQuantity0

func (t BackfillUsageEventJSONBody_Quantity) AsBackfillUsageEventJSONBodyQuantity0() (BackfillUsageEventJSONBodyQuantity0, error)

AsBackfillUsageEventJSONBodyQuantity0 returns the union data inside the BackfillUsageEventJSONBody_Quantity as a BackfillUsageEventJSONBodyQuantity0

func (BackfillUsageEventJSONBody_Quantity) AsBackfillUsageEventJSONBodyQuantity1

func (t BackfillUsageEventJSONBody_Quantity) AsBackfillUsageEventJSONBodyQuantity1() (BackfillUsageEventJSONBodyQuantity1, error)

AsBackfillUsageEventJSONBodyQuantity1 returns the union data inside the BackfillUsageEventJSONBody_Quantity as a BackfillUsageEventJSONBodyQuantity1

func (*BackfillUsageEventJSONBody_Quantity) FromBackfillUsageEventJSONBodyQuantity0

func (t *BackfillUsageEventJSONBody_Quantity) FromBackfillUsageEventJSONBodyQuantity0(v BackfillUsageEventJSONBodyQuantity0) error

FromBackfillUsageEventJSONBodyQuantity0 overwrites any union data inside the BackfillUsageEventJSONBody_Quantity as the provided BackfillUsageEventJSONBodyQuantity0

func (*BackfillUsageEventJSONBody_Quantity) FromBackfillUsageEventJSONBodyQuantity1

func (t *BackfillUsageEventJSONBody_Quantity) FromBackfillUsageEventJSONBodyQuantity1(v BackfillUsageEventJSONBodyQuantity1) error

FromBackfillUsageEventJSONBodyQuantity1 overwrites any union data inside the BackfillUsageEventJSONBody_Quantity as the provided BackfillUsageEventJSONBodyQuantity1

func (BackfillUsageEventJSONBody_Quantity) MarshalJSON

func (t BackfillUsageEventJSONBody_Quantity) MarshalJSON() ([]byte, error)

func (*BackfillUsageEventJSONBody_Quantity) MergeBackfillUsageEventJSONBodyQuantity0

func (t *BackfillUsageEventJSONBody_Quantity) MergeBackfillUsageEventJSONBodyQuantity0(v BackfillUsageEventJSONBodyQuantity0) error

MergeBackfillUsageEventJSONBodyQuantity0 performs a merge with any union data inside the BackfillUsageEventJSONBody_Quantity, using the provided BackfillUsageEventJSONBodyQuantity0

func (*BackfillUsageEventJSONBody_Quantity) MergeBackfillUsageEventJSONBodyQuantity1

func (t *BackfillUsageEventJSONBody_Quantity) MergeBackfillUsageEventJSONBodyQuantity1(v BackfillUsageEventJSONBodyQuantity1) error

MergeBackfillUsageEventJSONBodyQuantity1 performs a merge with any union data inside the BackfillUsageEventJSONBody_Quantity, using the provided BackfillUsageEventJSONBodyQuantity1

func (*BackfillUsageEventJSONBody_Quantity) UnmarshalJSON

func (t *BackfillUsageEventJSONBody_Quantity) UnmarshalJSON(b []byte) error

type BackfillUsageEventJSONRequestBody

type BackfillUsageEventJSONRequestBody BackfillUsageEventJSONBody

BackfillUsageEventJSONRequestBody defines body for BackfillUsageEvent for application/json ContentType.

type BillingFailure

type BillingFailure struct {
	// Attempts Failed attempts on the work that is due now. At least 1.
	Attempts int `json:"attempts"`

	// FailedAt When the latest attempt failed.
	FailedAt time.Time `json:"failed_at"`

	// LastError Why the latest attempt failed: a sentence an operator can act
	// on, or a generic line carrying the subscription id as the
	// reference to search the server log for. Never raw error text.
	LastError string `json:"last_error"`

	// MaxAttempts The attempt at which the subscription parks (8).
	MaxAttempts int `json:"max_attempts"`

	// NextAttemptAt The billing run does not attempt the subscription before this
	// instant. The attempt happens on the first run at or after it,
	// so on an hourly schedule it can be up to an hour later. Absent
	// when parked.
	NextAttemptAt time.Time `json:"next_attempt_at,omitempty"`

	// Parked True when automatic attempts have stopped.
	Parked bool `json:"parked"`
}

BillingFailure Present on a subscription while the billing run is failing on the work that subscription has due now (a period close, or a scheduled mid-period cancel). Absent otherwise: a subscription that bills cleanly, or whose due work changed, carries no `billing_failure`.

After each failed attempt the billing run waits before the next one: 15 minutes, 1 hour, 4 hours, 12 hours, then 24 hours three times. The eighth failure parks the subscription (`parked: true`, no `next_attempt_at`). A parked subscription is not attempted again until `POST /v1/subscriptions/{id}/retry-billing` is called.

Never set on a subscription attached to a test clock.

type BodyNotAllowed added in v0.9.2

type BodyNotAllowed = Error

BodyNotAllowed The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type BootstrapJSONBody

type BootstrapJSONBody struct {
	// OwnerEmail The owner's dashboard sign-in email. One plain address whose domain has a dot.
	OwnerEmail string `json:"owner_email,omitempty"`

	// OwnerPassword 12 or more characters, at most 72 bytes, and not a common password from a leaked-password list. Omit to have Hardcount generate one.
	OwnerPassword string `json:"owner_password,omitempty"`

	// TenantName The account's name.
	TenantName string `json:"tenant_name,omitempty"`

	// Token The value of `HARDCOUNT_BOOTSTRAP_TOKEN`. Or send it as a Bearer token.
	Token string `json:"token,omitempty"`
}

BootstrapJSONBody defines parameters for Bootstrap.

type BootstrapJSONRequestBody

type BootstrapJSONRequestBody BootstrapJSONBody

BootstrapJSONRequestBody defines body for Bootstrap for application/json ContentType.

type BootstrapResult

type BootstrapResult struct {
	// Message A reminder to save the credentials now.
	Message string `json:"message"`

	// OwnerEmail The owner's dashboard sign-in email.
	OwnerEmail string `json:"owner_email"`

	// OwnerPassword The owner's dashboard password: the one you sent, or the
	// generated one (24 hex characters).
	OwnerPassword string `json:"owner_password"`

	// PasswordGenerated True when Hardcount generated `owner_password` because the request sent none.
	PasswordGenerated bool `json:"password_generated"`

	// SecretKeyLive Live-mode secret key (`hc_secret_live_...`).
	SecretKeyLive string `json:"secret_key_live"`

	// SecretKeyTest Test-mode secret key (`hc_secret_test_...`).
	SecretKeyTest string `json:"secret_key_test"`

	// Tenant An account: one business that bills its customers with Hardcount.
	// It has separate test and live data. `POST /v1/bootstrap` creates
	// the first one.
	Tenant Tenant `json:"tenant"`
}

BootstrapResult What `POST /v1/bootstrap` returns: the new account, its owner's dashboard sign-in, and one test and one live secret key. This answer is the only place the keys appear.

type CancelSubscriptionParams

type CancelSubscriptionParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CancelSubscriptionParams defines parameters for CancelSubscription.

type CheckPasswordResetToken200JSONResponseBodyValid

type CheckPasswordResetToken200JSONResponseBodyValid bool

CheckPasswordResetToken200JSONResponseBodyValid defines parameters for CheckPasswordResetToken.

Defines values for CheckPasswordResetToken200JSONResponseBodyValid.

func (CheckPasswordResetToken200JSONResponseBodyValid) Valid

Valid indicates whether the value is a known member of the CheckPasswordResetToken200JSONResponseBodyValid enum.

type CheckPasswordResetTokenParams

type CheckPasswordResetTokenParams struct {
	// Token The token from the reset link.
	Token string `form:"token" json:"token"`
}

CheckPasswordResetTokenParams defines parameters for CheckPasswordResetToken.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CollectInvoicePaymentParams

type CollectInvoicePaymentParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CollectInvoicePaymentParams defines parameters for CollectInvoicePayment.

type ConfirmPasswordResetJSONBody added in v0.9.2

type ConfirmPasswordResetJSONBody struct {
	// Password The new password: at least 12 characters, at most 72
	// bytes, and not one of the most common passwords.
	Password string `json:"password"`

	// Token The token from the reset link.
	Token string `json:"token"`
}

ConfirmPasswordResetJSONBody defines parameters for ConfirmPasswordReset.

type ConfirmPasswordResetJSONRequestBody added in v0.9.2

type ConfirmPasswordResetJSONRequestBody ConfirmPasswordResetJSONBody

ConfirmPasswordResetJSONRequestBody defines body for ConfirmPasswordReset for application/json ContentType.

type ConnectStripeJSONBody

type ConnectStripeJSONBody struct {
	// Livemode false = test-mode keys, true = live-mode keys.
	Livemode bool `json:"livemode"`

	// PublishableKey Publishable (`pk_`) key for this mode.
	PublishableKey string `json:"publishable_key"`

	// SecretKey Secret (`sk_`) or restricted (`rk_`) key for this mode.
	SecretKey string `json:"secret_key"`

	// WebhookSecret Optional. The `whsec_` signing secret of the Stripe webhook endpoint. Can be added later with PATCH.
	WebhookSecret string `json:"webhook_secret,omitempty"`
}

ConnectStripeJSONBody defines parameters for ConnectStripe.

type ConnectStripeJSONRequestBody

type ConnectStripeJSONRequestBody ConnectStripeJSONBody

ConnectStripeJSONRequestBody defines body for ConnectStripe for application/json ContentType.

type ConnectStripeParams

type ConnectStripeParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ConnectStripeParams defines parameters for ConnectStripe.

type CreateApiKeyJSONBody

type CreateApiKeyJSONBody struct {
	// ExpiresAt Optional. Must be in the future. Omit for a key that does not expire.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// KeyType `secret` for full access, or `ingest` for a key that can only send usage events.
	KeyType CreateApiKeyJSONBodyKeyType `json:"key_type,omitempty"`

	// Name Label shown in the key list. Must not be blank.
	Name string `json:"name"`
}

CreateApiKeyJSONBody defines parameters for CreateApiKey.

type CreateApiKeyJSONBodyKeyType

type CreateApiKeyJSONBodyKeyType string

CreateApiKeyJSONBodyKeyType defines parameters for CreateApiKey.

const (
	CreateApiKeyJSONBodyKeyTypeIngest CreateApiKeyJSONBodyKeyType = "ingest"
	CreateApiKeyJSONBodyKeyTypeSecret CreateApiKeyJSONBodyKeyType = "secret"
)

Defines values for CreateApiKeyJSONBodyKeyType.

func (CreateApiKeyJSONBodyKeyType) Valid

Valid indicates whether the value is a known member of the CreateApiKeyJSONBodyKeyType enum.

type CreateApiKeyJSONRequestBody

type CreateApiKeyJSONRequestBody CreateApiKeyJSONBody

CreateApiKeyJSONRequestBody defines body for CreateApiKey for application/json ContentType.

type CreateApiKeyParams

type CreateApiKeyParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateApiKeyParams defines parameters for CreateApiKey.

type CreateCreditNoteJSONBody added in v0.9.2

type CreateCreditNoteJSONBody struct {
	// AutoIssue True issues the note in the same call. If the issue fails,
	// the draft is voided and the error is returned. Defaults to
	// false (the note stays a draft).
	AutoIssue bool `json:"auto_issue,omitempty"`

	// CommitRelief Mutually exclusive with lines and credit_amount_cents. The
	// relief's split goes in here, not at the top level: a top-level
	// `refund_amount_cents`, `out_of_band_amount_cents` or
	// `refund_type` is a 422. Example after a lost dispute:
	// `{"invoice_id": "hc_inv_…", "commit_relief": {"retire_all": true, "out_of_band_amount_cents": 5000}}`.
	CommitRelief struct {
		// InvoiceId Optional. Defaults to the top-level invoice_id.
		InvoiceId string `json:"invoice_id,omitempty"`

		// OutOfBandAmountCents Optional. Part of the cash paid back outside Hardcount.
		OutOfBandAmountCents int `json:"out_of_band_amount_cents,omitempty"`

		// Reason Optional. Wins over the top-level `reason`. When both
		// are empty, the note's reason is `commit_relief`.
		Reason string `json:"reason,omitempty"`

		// RefundAmountCents Optional. Part of the cash refunded to the card. With `out_of_band_amount_cents` it must add up to the cash Hardcount works out. When both are left out, the cash goes to the card if the invoice was paid by card, otherwise out of band.
		RefundAmountCents int `json:"refund_amount_cents,omitempty"`

		// RetireAll Retire all the commit credit left at the moment the relief runs, so credit the customer spends meanwhile is not counted. `retire_cents` is then ignored.
		RetireAll bool `json:"retire_all,omitempty"`

		// RetireCents Commit credits to retire, from 1 to what is left of the commit.
		RetireCents int `json:"retire_cents,omitempty"`
	} `json:"commit_relief,omitempty"`

	// CreditAmountCents Part of the total added to the customer's credit balance, in the currency's minor unit (cents for USD). Paid invoices only. Not with commit_relief.
	CreditAmountCents int `json:"credit_amount_cents,omitempty"`

	// InvoiceId The invoice to credit. It must be `finalized` or `paid`.
	InvoiceId string `json:"invoice_id"`

	// Lines The credited amounts, tax included. At least one line for a line-based note; none with `commit_relief`.
	Lines []struct {
		// Description The text printed on the line.
		Description string `json:"description,omitempty"`

		// InvoiceLineItemId Optional. The invoice line this credit line reverses. It must be a line of this invoice.
		InvoiceLineItemId string `json:"invoice_line_item_id,omitempty"`

		// Quantity How many units, 1 or more.
		Quantity int `json:"quantity,omitempty"`

		// UnitAmountCents Credit per unit, tax included, in the currency's minor unit (cents for USD). 1 or more.
		UnitAmountCents int `json:"unit_amount_cents,omitempty"`
	} `json:"lines,omitempty"`

	// OutOfBandAmountCents Part of the total paid back outside Hardcount, in the currency's minor unit (cents for USD). Paid invoices only. Not with commit_relief; put the relief's split inside commit_relief.
	OutOfBandAmountCents int `json:"out_of_band_amount_cents,omitempty"`

	// Reason Why you are crediting, printed on the note. Required for a
	// line-based note. For a relief, `commit_relief.reason` wins;
	// this one is used when that is empty, and `commit_relief`
	// is the reason when both are empty.
	Reason string `json:"reason,omitempty"`

	// RefundAmountCents Part of the total refunded to the card, in the currency's minor unit (cents for USD). Paid invoices only. Not with commit_relief; put the relief's split inside commit_relief.
	RefundAmountCents int `json:"refund_amount_cents,omitempty"`

	// RefundType Older single-channel form. On a paid invoice whose three
	// `*_amount_cents` fields are all 0, `refund` or `credit`
	// puts the whole note in that channel. Not with commit_relief.
	RefundType CreateCreditNoteJSONBodyRefundType `json:"refund_type,omitempty"`

	// StripeRefundId Links a refund made in Stripe outside Hardcount as this
	// note's card refund, like Stripe's `refunds[]`: Hardcount
	// reads the refund from Stripe and calls nothing else
	// there for it. The refund must be of the payment that paid
	// this invoice, not made by Hardcount, and succeeded;
	// `refund_amount_cents` must be its amount,
	// `credit_amount_cents` 0, and `auto_issue` true (the
	// note is issued at once). The caps on the invoice still
	// apply. A refund Hardcount flagged on the invoice
	// (`refunded_in_stripe`) is then marked recorded. Not with
	// commit_relief.
	StripeRefundId string `json:"stripe_refund_id,omitempty"`
}

CreateCreditNoteJSONBody defines parameters for CreateCreditNote.

type CreateCreditNoteJSONBodyRefundType added in v0.9.2

type CreateCreditNoteJSONBodyRefundType string

CreateCreditNoteJSONBodyRefundType defines parameters for CreateCreditNote.

const (
	CreateCreditNoteJSONBodyRefundTypeCredit CreateCreditNoteJSONBodyRefundType = "credit"
	CreateCreditNoteJSONBodyRefundTypeRefund CreateCreditNoteJSONBodyRefundType = "refund"
)

Defines values for CreateCreditNoteJSONBodyRefundType.

func (CreateCreditNoteJSONBodyRefundType) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreateCreditNoteJSONBodyRefundType enum.

type CreateCreditNoteJSONRequestBody added in v0.9.2

type CreateCreditNoteJSONRequestBody CreateCreditNoteJSONBody

CreateCreditNoteJSONRequestBody defines body for CreateCreditNote for application/json ContentType.

type CreateCreditNoteParams added in v0.9.2

type CreateCreditNoteParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateCreditNoteParams defines parameters for CreateCreditNote.

type CreateCustomerJSONBody added in v0.9.2

type CreateCustomerJSONBody struct {
	// AdditionalEmails Addresses to copy on billing emails. Each is checked
	// like `email`, lowercased and deduplicated. None may equal
	// `email`. More than 10 after deduplication is refused with
	// 422.
	AdditionalEmails []string `json:"additional_emails,omitempty"`

	// DisplayName The name shown on invoices, emails and the dashboard.
	// Spaces at the ends are trimmed; then at most 255 bytes
	// (UTF-8).
	DisplayName string `json:"display_name"`

	// Email Where billing emails go. One bare address with a dot in
	// its domain, such as `billing@acme.example`: no display
	// name, quotes or angle brackets.
	Email string `json:"email,omitempty"`

	// ExternalId Your own ID for the customer, such as the account ID in
	// your app. Spaces at the ends are trimmed; then at most
	// 255 bytes (UTF-8). Unique in the account and mode.
	ExternalId string `json:"external_id"`

	// TestClockId Test mode only. Runs the customer on this test clock,
	// which must exist in the account and mode. Fixed after
	// create.
	TestClockId string `json:"test_clock_id,omitempty"`
}

CreateCustomerJSONBody defines parameters for CreateCustomer.

type CreateCustomerJSONRequestBody added in v0.9.2

type CreateCustomerJSONRequestBody CreateCustomerJSONBody

CreateCustomerJSONRequestBody defines body for CreateCustomer for application/json ContentType.

type CreateCustomerParams added in v0.9.2

type CreateCustomerParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateCustomerParams defines parameters for CreateCustomer.

type CreateCustomerPaymentSetupSessionJSONBody

type CreateCustomerPaymentSetupSessionJSONBody struct {
	// ReturnUrl Where Stripe sends the customer afterwards. Defaults to
	// `/payment-method-added` on the server's
	// `CUSTOMER_PORTAL_URL` (`http://localhost:5173` when that
	// is unset).
	ReturnUrl string `json:"return_url,omitempty"`
}

CreateCustomerPaymentSetupSessionJSONBody defines parameters for CreateCustomerPaymentSetupSession.

type CreateCustomerPaymentSetupSessionJSONRequestBody

type CreateCustomerPaymentSetupSessionJSONRequestBody CreateCustomerPaymentSetupSessionJSONBody

CreateCustomerPaymentSetupSessionJSONRequestBody defines body for CreateCustomerPaymentSetupSession for application/json ContentType.

type CreateCustomerPaymentSetupSessionParams

type CreateCustomerPaymentSetupSessionParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateCustomerPaymentSetupSessionParams defines parameters for CreateCustomerPaymentSetupSession.

type CreateDunningPolicyJSONRequestBody

type CreateDunningPolicyJSONRequestBody = DunningPolicyInput

CreateDunningPolicyJSONRequestBody defines body for CreateDunningPolicy for application/json ContentType.

type CreateDunningPolicyParams

type CreateDunningPolicyParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateDunningPolicyParams defines parameters for CreateDunningPolicy.

type CreateInvoiceJSONRequestBody

type CreateInvoiceJSONRequestBody = InvoiceCreateRequest

CreateInvoiceJSONRequestBody defines body for CreateInvoice for application/json ContentType.

type CreateInvoiceParams

type CreateInvoiceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateInvoiceParams defines parameters for CreateInvoice.

type CreateInvoicePreviewJSONBody added in v0.9.2

type CreateInvoicePreviewJSONBody struct {
	// CustomerId Customer to preview the invoice for.
	CustomerId string `json:"customer_id"`

	// Period Optional explicit window, `from` before `to`. Both bounds
	// must be supplied together; partial windows are rejected.
	// Defaults to the subscription's current period.
	Period struct {
		// From Start of the window (included), RFC 3339.
		From time.Time `json:"from"`

		// To End of the window (not included), RFC 3339.
		To time.Time `json:"to"`
	} `json:"period,omitempty"`

	// SubscriptionId Optional. The subscription to preview; it must belong to
	// `customer_id`. Defaults to the customer's active or
	// trialing subscription whose current period started last.
	SubscriptionId string `json:"subscription_id,omitempty"`
}

CreateInvoicePreviewJSONBody defines parameters for CreateInvoicePreview.

type CreateInvoicePreviewJSONRequestBody added in v0.9.2

type CreateInvoicePreviewJSONRequestBody CreateInvoicePreviewJSONBody

CreateInvoicePreviewJSONRequestBody defines body for CreateInvoicePreview for application/json ContentType.

type CreateInvoicePreviewParams added in v0.9.2

type CreateInvoicePreviewParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateInvoicePreviewParams defines parameters for CreateInvoicePreview.

type CreateMeterJSONBody added in v0.9.2

type CreateMeterJSONBody struct {
	// Aggregation How the meter rolls its events into one quantity per
	// billing period. Fixed once the meter has a usage event.
	Aggregation CreateMeterJSONBodyAggregation `json:"aggregation,omitempty"`

	// EventName The `event_name` usage events will send for this meter.
	// Letters, digits, `-` and `_`; at most 100 characters.
	// Unique in the account and mode.
	EventName string `json:"event_name"`

	// Name The display name. Spaces at the ends are trimmed; then at
	// most 255 bytes (UTF-8).
	Name string `json:"name"`

	// Unit The unit of the quantity, such as `tokens` or `seconds`.
	// Empty or left out is `unit`.
	Unit string `json:"unit,omitempty"`
}

CreateMeterJSONBody defines parameters for CreateMeter.

type CreateMeterJSONBodyAggregation added in v0.9.2

type CreateMeterJSONBodyAggregation string

CreateMeterJSONBodyAggregation defines parameters for CreateMeter.

const (
	CreateMeterJSONBodyAggregationCount CreateMeterJSONBodyAggregation = "count"
	CreateMeterJSONBodyAggregationLast  CreateMeterJSONBodyAggregation = "last"
	CreateMeterJSONBodyAggregationMax   CreateMeterJSONBodyAggregation = "max"
	CreateMeterJSONBodyAggregationSum   CreateMeterJSONBodyAggregation = "sum"
)

Defines values for CreateMeterJSONBodyAggregation.

func (CreateMeterJSONBodyAggregation) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreateMeterJSONBodyAggregation enum.

type CreateMeterJSONRequestBody added in v0.9.2

type CreateMeterJSONRequestBody CreateMeterJSONBody

CreateMeterJSONRequestBody defines body for CreateMeter for application/json ContentType.

type CreateMeterParams added in v0.9.2

type CreateMeterParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateMeterParams defines parameters for CreateMeter.

type CreatePlanJSONBody added in v0.9.2

type CreatePlanJSONBody struct {
	// BaseAmountCents The recurring base fee per billing period, in the
	// currency's minor unit (cents for USD). 0 or more; 0 when
	// left out.
	BaseAmountCents int64 `json:"base_amount_cents,omitempty"`

	// BaseBillTiming Required when `base_amount_cents` is above 0. With a base
	// of 0 it may be left out, and the plan is in_arrears;
	// `in_advance` with a base of 0 is refused. See
	// `base_bill_timing` on Plan.
	BaseBillTiming CreatePlanJSONBodyBaseBillTiming `json:"base_bill_timing,omitempty"`

	// BillingInterval How often a subscription to the plan is billed. Fixed after create.
	BillingInterval CreatePlanJSONBodyBillingInterval `json:"billing_interval"`

	// Code Your short name for the plan. Letters, digits, `-` and
	// `_`; at most 100 characters; unique in the account and
	// mode. Fixed after create.
	Code string `json:"code"`

	// Currency ISO 4217 code, such as `USD`, stored in upper case.
	// Zero-decimal currencies such as JPY are refused. Fixed
	// after create.
	Currency string `json:"currency"`

	// Description Your description of the plan.
	Description string `json:"description,omitempty"`

	// Name The display name. Spaces at the ends are trimmed; then at
	// most 255 bytes (UTF-8).
	Name string `json:"name"`

	// Prices The plan's usage prices, created with it in one request.
	// Each takes the plan's currency.
	Prices []PriceInput `json:"prices,omitempty"`

	// Status Optional. A plan is created active; archive it with PATCH.
	Status CreatePlanJSONBodyStatus `json:"status,omitempty"`

	// TaxCode A Stripe product tax code, `txcd_` and 8 digits, such as
	// `txcd_10103001`. Empty or omitted leaves it unset. See
	// `tax_code` on Plan for which invoice lines carry it.
	TaxCode string `json:"tax_code,omitempty"`
}

CreatePlanJSONBody defines parameters for CreatePlan.

type CreatePlanJSONBodyBaseBillTiming added in v0.9.2

type CreatePlanJSONBodyBaseBillTiming string

CreatePlanJSONBodyBaseBillTiming defines parameters for CreatePlan.

const (
	CreatePlanJSONBodyBaseBillTimingInAdvance CreatePlanJSONBodyBaseBillTiming = "in_advance"
	CreatePlanJSONBodyBaseBillTimingInArrears CreatePlanJSONBodyBaseBillTiming = "in_arrears"
)

Defines values for CreatePlanJSONBodyBaseBillTiming.

func (CreatePlanJSONBodyBaseBillTiming) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreatePlanJSONBodyBaseBillTiming enum.

type CreatePlanJSONBodyBillingInterval added in v0.9.2

type CreatePlanJSONBodyBillingInterval string

CreatePlanJSONBodyBillingInterval defines parameters for CreatePlan.

const (
	CreatePlanJSONBodyBillingIntervalMonthly CreatePlanJSONBodyBillingInterval = "monthly"
	CreatePlanJSONBodyBillingIntervalYearly  CreatePlanJSONBodyBillingInterval = "yearly"
)

Defines values for CreatePlanJSONBodyBillingInterval.

func (CreatePlanJSONBodyBillingInterval) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreatePlanJSONBodyBillingInterval enum.

type CreatePlanJSONBodyStatus added in v0.9.2

type CreatePlanJSONBodyStatus string

CreatePlanJSONBodyStatus defines parameters for CreatePlan.

const (
	CreatePlanJSONBodyStatusActive CreatePlanJSONBodyStatus = "active"
)

Defines values for CreatePlanJSONBodyStatus.

func (CreatePlanJSONBodyStatus) Valid added in v0.9.2

func (e CreatePlanJSONBodyStatus) Valid() bool

Valid indicates whether the value is a known member of the CreatePlanJSONBodyStatus enum.

type CreatePlanJSONRequestBody added in v0.9.2

type CreatePlanJSONRequestBody CreatePlanJSONBody

CreatePlanJSONRequestBody defines body for CreatePlan for application/json ContentType.

type CreatePlanParams added in v0.9.2

type CreatePlanParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreatePlanParams defines parameters for CreatePlan.

type CreatePriceOverrideJSONBody

type CreatePriceOverrideJSONBody struct {
	// CustomerId The customer who gets the rate. It must be a customer in
	// this account and mode.
	CustomerId string `json:"customer_id"`

	// Mode As on PriceShape, also for the fields a mode does not use.
	Mode CreatePriceOverrideJSONBodyMode `json:"mode"`

	// PackageAmountCents Price of one package in cents, as a decimal string, with the limits of `unit_amount_cents`. Used when `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents,omitempty"`

	// PackageSize Used when `mode` is `package`. Must be above 0.
	PackageSize int64 `json:"package_size,omitempty"`

	// PriceId The plan price to override.
	PriceId string `json:"price_id"`

	// Reason Your note on why the customer has this rate, such as a
	// contract reference. Spaces at the ends are trimmed.
	Reason string `json:"reason,omitempty"`

	// Tiers Used when `mode` is `graduated`. Each `up_to` is a whole number above the one before. The last tier has `up_to: null` (no upper bound), and only the last. Otherwise 422 with `param` `tiers`.
	Tiers []struct {
		// UnitAmountCents Price per unit in cents in this tier, as a decimal string, with the limits of `unit_amount_cents`. A refusal names `tiers[i].unit_amount_cents` (i counts from 0).
		UnitAmountCents string `json:"unit_amount_cents,omitempty"`

		// UpTo The tier's upper bound in whole units. `null` on the
		// last tier, and only there.
		UpTo int64 `json:"up_to,omitempty"`
	} `json:"tiers,omitempty"`

	// UnitAmountCents Price per unit in cents, as a decimal string. Used when `mode` is `per_unit`. 0 or more, under 10^18, at most 12 decimal places (trailing zeros do not count), and at most 100 characters. A JSON number is also read. A value outside them is refused with 422 and `param` naming the field.
	UnitAmountCents string `json:"unit_amount_cents,omitempty"`
}

CreatePriceOverrideJSONBody defines parameters for CreatePriceOverride.

type CreatePriceOverrideJSONBodyMode

type CreatePriceOverrideJSONBodyMode string

CreatePriceOverrideJSONBodyMode defines parameters for CreatePriceOverride.

const (
	CreatePriceOverrideJSONBodyModeGraduated CreatePriceOverrideJSONBodyMode = "graduated"
	CreatePriceOverrideJSONBodyModePackage   CreatePriceOverrideJSONBodyMode = "package"
	CreatePriceOverrideJSONBodyModePerUnit   CreatePriceOverrideJSONBodyMode = "per_unit"
)

Defines values for CreatePriceOverrideJSONBodyMode.

func (CreatePriceOverrideJSONBodyMode) Valid

Valid indicates whether the value is a known member of the CreatePriceOverrideJSONBodyMode enum.

type CreatePriceOverrideJSONRequestBody

type CreatePriceOverrideJSONRequestBody CreatePriceOverrideJSONBody

CreatePriceOverrideJSONRequestBody defines body for CreatePriceOverride for application/json ContentType.

type CreatePriceOverrideParams

type CreatePriceOverrideParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreatePriceOverrideParams defines parameters for CreatePriceOverride.

type CreateSubscriptionJSONBody added in v0.9.2

type CreateSubscriptionJSONBody struct {
	// BillingTime How monthly periods line up. See the subscription's `billing_time`.
	BillingTime CreateSubscriptionJSONBodyBillingTime `json:"billing_time,omitempty"`

	// Code Your code for the subscription: letters, digits, hyphens
	// and underscores. Unique in your account and mode.
	Code string `json:"code"`

	// CustomerId The customer to bill (`hc_cus_…`), in this account and
	// mode.
	CustomerId string `json:"customer_id"`

	// DisplayName The subscription's name. Must not be blank.
	DisplayName string `json:"display_name"`

	// Items Plan items — a subscription bills one or more plans.
	Items []struct {
		// PlanId A plan of this account (`hc_pln_…`). Each plan can appear once.
		PlanId string `json:"plan_id"`

		// Quantity How many of the plan to bill. At least 1; 0 or absent means 1.
		Quantity int `json:"quantity,omitempty"`
	} `json:"items"`

	// Status Leave it out and the subscription starts now. Without
	// `trial_days` it is `active`, its first period starts
	// today in the account's billing time zone (the clock's
	// day for a customer on a test clock), and a non-zero base
	// fee billed in advance is invoiced now. With `trial_days`
	// above 0 it is `trialing` from now. Send `draft` to create it
	// without starting it: it bills nothing until you activate
	// it with `POST /v1/subscriptions/{id}/activate`. A draft
	// cannot have a trial (`trial_days` above 0). An empty or
	// null `status` is refused.
	Status CreateSubscriptionJSONBodyStatus `json:"status,omitempty"`

	// TrialDays Days of free trial; 0 means no trial. Above 0, the
	// subscription is `trialing` from now and its first paid
	// period starts on the day the trial ends.
	TrialDays int `json:"trial_days,omitempty"`
}

CreateSubscriptionJSONBody defines parameters for CreateSubscription.

type CreateSubscriptionJSONBodyBillingTime added in v0.9.2

type CreateSubscriptionJSONBodyBillingTime string

CreateSubscriptionJSONBodyBillingTime defines parameters for CreateSubscription.

const (
	CreateSubscriptionJSONBodyBillingTimeAnniversary CreateSubscriptionJSONBodyBillingTime = "anniversary"
	CreateSubscriptionJSONBodyBillingTimeCalendar    CreateSubscriptionJSONBodyBillingTime = "calendar"
)

Defines values for CreateSubscriptionJSONBodyBillingTime.

func (CreateSubscriptionJSONBodyBillingTime) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreateSubscriptionJSONBodyBillingTime enum.

type CreateSubscriptionJSONBodyStatus added in v0.9.2

type CreateSubscriptionJSONBodyStatus string

CreateSubscriptionJSONBodyStatus defines parameters for CreateSubscription.

const (
	Draft CreateSubscriptionJSONBodyStatus = "draft"
)

Defines values for CreateSubscriptionJSONBodyStatus.

func (CreateSubscriptionJSONBodyStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the CreateSubscriptionJSONBodyStatus enum.

type CreateSubscriptionJSONRequestBody added in v0.9.2

type CreateSubscriptionJSONRequestBody CreateSubscriptionJSONBody

CreateSubscriptionJSONRequestBody defines body for CreateSubscription for application/json ContentType.

type CreateSubscriptionParams added in v0.9.2

type CreateSubscriptionParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateSubscriptionParams defines parameters for CreateSubscription.

type CreateTestClockJSONBody added in v0.9.2

type CreateTestClockJSONBody struct {
	// FrozenTime The clock's starting time, RFC 3339. Any instant, past or future.
	FrozenTime time.Time `json:"frozen_time"`

	// Name Your name for the clock. Optional; at most 200 bytes
	// after surrounding spaces are trimmed (fewer characters
	// when it has non-ASCII letters).
	Name string `json:"name,omitempty"`
}

CreateTestClockJSONBody defines parameters for CreateTestClock.

type CreateTestClockJSONRequestBody added in v0.9.2

type CreateTestClockJSONRequestBody CreateTestClockJSONBody

CreateTestClockJSONRequestBody defines body for CreateTestClock for application/json ContentType.

type CreateTestClockParams added in v0.9.2

type CreateTestClockParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateTestClockParams defines parameters for CreateTestClock.

type CreateUsageEventBatchJSONBody added in v0.9.2

type CreateUsageEventBatchJSONBody = []struct {
	// Dimensions Scalar labels of the event, at most 16. A price takes an event whose labels include the price's `dimension_match`.
	Dimensions map[string]interface{} `json:"dimensions,omitempty"`

	// EventName The meter's `event_name` (e.g. "tokens").
	EventName string `json:"event_name"`

	// ExternalCustomerId The customer's external_id (your identifier), not the internal hc_cus_ id.
	ExternalCustomerId string `json:"external_customer_id"`

	// IdempotencyKey Your unique ID for this event. Pick it once, before the
	// first send, and send the same key on every retry of the
	// event. Keys are unique per account and mode (live or
	// test), forever. An event whose key was already used is
	// not stored again: the first event wins and the new body
	// is discarded. So never reuse a key for a different
	// event, such as a batch index or a timestamp that can
	// repeat, or that usage is lost. Empty or whitespace-only
	// keys fail validation, and so do keys longer than
	// 255 characters. This is the only dedup key: the usage
	// routes ignore the `Idempotency-Key` header.
	IdempotencyKey string `json:"idempotency_key"`

	// Quantity A JSON number (`5`) or a string holding one (`"5.5"`,
	// for exact decimals). At most 12 decimal places;
	// trailing zeros do not count. Its size must be under
	// 10^26, and it is at most 100 characters. A negative
	// value is a correction. A missing quantity, or any
	// other value, fails validation.
	Quantity CreateUsageEventBatchJSONBody_Quantity `json:"quantity"`

	// Timestamp When the usage happened, as an RFC 3339 string. Leave
	// it out to use the time Hardcount receives the batch.
	// The same rules as for `POST /v1/usage-events` apply.
	Timestamp time.Time `json:"timestamp,omitempty"`
}

CreateUsageEventBatchJSONBody defines parameters for CreateUsageEventBatch.

type CreateUsageEventBatchJSONBodyQuantity0 added in v0.9.2

type CreateUsageEventBatchJSONBodyQuantity0 = float32

CreateUsageEventBatchJSONBodyQuantity0 defines parameters for CreateUsageEventBatch.

type CreateUsageEventBatchJSONBodyQuantity1 added in v0.9.2

type CreateUsageEventBatchJSONBodyQuantity1 = string

CreateUsageEventBatchJSONBodyQuantity1 defines parameters for CreateUsageEventBatch.

type CreateUsageEventBatchJSONBody_Quantity added in v0.9.2

type CreateUsageEventBatchJSONBody_Quantity struct {
	// contains filtered or unexported fields
}

CreateUsageEventBatchJSONBody_Quantity defines parameters for CreateUsageEventBatch.

func (CreateUsageEventBatchJSONBody_Quantity) AsCreateUsageEventBatchJSONBodyQuantity0 added in v0.9.2

func (t CreateUsageEventBatchJSONBody_Quantity) AsCreateUsageEventBatchJSONBodyQuantity0() (CreateUsageEventBatchJSONBodyQuantity0, error)

AsCreateUsageEventBatchJSONBodyQuantity0 returns the union data inside the CreateUsageEventBatchJSONBody_Quantity as a CreateUsageEventBatchJSONBodyQuantity0

func (CreateUsageEventBatchJSONBody_Quantity) AsCreateUsageEventBatchJSONBodyQuantity1 added in v0.9.2

func (t CreateUsageEventBatchJSONBody_Quantity) AsCreateUsageEventBatchJSONBodyQuantity1() (CreateUsageEventBatchJSONBodyQuantity1, error)

AsCreateUsageEventBatchJSONBodyQuantity1 returns the union data inside the CreateUsageEventBatchJSONBody_Quantity as a CreateUsageEventBatchJSONBodyQuantity1

func (*CreateUsageEventBatchJSONBody_Quantity) FromCreateUsageEventBatchJSONBodyQuantity0 added in v0.9.2

func (t *CreateUsageEventBatchJSONBody_Quantity) FromCreateUsageEventBatchJSONBodyQuantity0(v CreateUsageEventBatchJSONBodyQuantity0) error

FromCreateUsageEventBatchJSONBodyQuantity0 overwrites any union data inside the CreateUsageEventBatchJSONBody_Quantity as the provided CreateUsageEventBatchJSONBodyQuantity0

func (*CreateUsageEventBatchJSONBody_Quantity) FromCreateUsageEventBatchJSONBodyQuantity1 added in v0.9.2

func (t *CreateUsageEventBatchJSONBody_Quantity) FromCreateUsageEventBatchJSONBodyQuantity1(v CreateUsageEventBatchJSONBodyQuantity1) error

FromCreateUsageEventBatchJSONBodyQuantity1 overwrites any union data inside the CreateUsageEventBatchJSONBody_Quantity as the provided CreateUsageEventBatchJSONBodyQuantity1

func (CreateUsageEventBatchJSONBody_Quantity) MarshalJSON added in v0.9.2

func (t CreateUsageEventBatchJSONBody_Quantity) MarshalJSON() ([]byte, error)

func (*CreateUsageEventBatchJSONBody_Quantity) MergeCreateUsageEventBatchJSONBodyQuantity0 added in v0.9.2

func (t *CreateUsageEventBatchJSONBody_Quantity) MergeCreateUsageEventBatchJSONBodyQuantity0(v CreateUsageEventBatchJSONBodyQuantity0) error

MergeCreateUsageEventBatchJSONBodyQuantity0 performs a merge with any union data inside the CreateUsageEventBatchJSONBody_Quantity, using the provided CreateUsageEventBatchJSONBodyQuantity0

func (*CreateUsageEventBatchJSONBody_Quantity) MergeCreateUsageEventBatchJSONBodyQuantity1 added in v0.9.2

func (t *CreateUsageEventBatchJSONBody_Quantity) MergeCreateUsageEventBatchJSONBodyQuantity1(v CreateUsageEventBatchJSONBodyQuantity1) error

MergeCreateUsageEventBatchJSONBodyQuantity1 performs a merge with any union data inside the CreateUsageEventBatchJSONBody_Quantity, using the provided CreateUsageEventBatchJSONBodyQuantity1

func (*CreateUsageEventBatchJSONBody_Quantity) UnmarshalJSON added in v0.9.2

func (t *CreateUsageEventBatchJSONBody_Quantity) UnmarshalJSON(b []byte) error

type CreateUsageEventBatchJSONRequestBody added in v0.9.2

type CreateUsageEventBatchJSONRequestBody = CreateUsageEventBatchJSONBody

CreateUsageEventBatchJSONRequestBody defines body for CreateUsageEventBatch for application/json ContentType.

type CreateUsageEventJSONBody added in v0.9.2

type CreateUsageEventJSONBody struct {
	// Dimensions Scalar labels of the event (e.g. {"model", "token_type"}). A price takes an event whose labels include the price's `dimension_match`.
	Dimensions map[string]interface{} `json:"dimensions,omitempty"`

	// EventName The meter's `event_name` (e.g. "tokens").
	EventName string `json:"event_name"`

	// ExternalCustomerId The customer's external_id (your identifier), not the internal hc_cus_ id.
	ExternalCustomerId string `json:"external_customer_id"`

	// IdempotencyKey Your unique ID for this event. Pick it once, before the
	// first send, and send the same key on every retry of the
	// event. Keys are unique per account and mode (live or
	// test), forever. An event whose key was already used is
	// not stored again: the first event wins and the new body
	// is discarded. So never reuse a key for a different
	// event, such as a batch index or a timestamp that can
	// repeat, or that usage is lost. Empty or whitespace-only
	// keys are refused with 422, and so are keys longer than
	// 255 characters. This is the only dedup key: the usage
	// routes ignore the `Idempotency-Key` header.
	IdempotencyKey string `json:"idempotency_key"`

	// Quantity A JSON number (`5`) or a string holding one (`"5.5"`,
	// for exact decimals). At most 12 decimal places; trailing
	// zeros do not count. Its size must be under 10^26, and it
	// is at most 100 characters. A negative value is a
	// correction. A missing quantity, or any other value, is
	// refused with 422 and `param: quantity`.
	Quantity CreateUsageEventJSONBody_Quantity `json:"quantity"`

	// Timestamp When the usage happened, as an RFC 3339 string. Leave it
	// out to use the time Hardcount receives the event (the
	// clock's time for a customer on a test clock). It may be
	// at most 5 minutes ahead of that time. Any past time is
	// accepted, but an event in a period that is already
	// invoiced is stored and not billed (`billing_status:
	// after_close`). A value that is not an RFC 3339 string is
	// refused with 422 and `param: timestamp`.
	Timestamp time.Time `json:"timestamp,omitempty"`
}

CreateUsageEventJSONBody defines parameters for CreateUsageEvent.

type CreateUsageEventJSONBodyQuantity0 added in v0.9.2

type CreateUsageEventJSONBodyQuantity0 = float32

CreateUsageEventJSONBodyQuantity0 defines parameters for CreateUsageEvent.

type CreateUsageEventJSONBodyQuantity1 added in v0.9.2

type CreateUsageEventJSONBodyQuantity1 = string

CreateUsageEventJSONBodyQuantity1 defines parameters for CreateUsageEvent.

type CreateUsageEventJSONBody_Quantity added in v0.9.2

type CreateUsageEventJSONBody_Quantity struct {
	// contains filtered or unexported fields
}

CreateUsageEventJSONBody_Quantity defines parameters for CreateUsageEvent.

func (CreateUsageEventJSONBody_Quantity) AsCreateUsageEventJSONBodyQuantity0 added in v0.9.2

func (t CreateUsageEventJSONBody_Quantity) AsCreateUsageEventJSONBodyQuantity0() (CreateUsageEventJSONBodyQuantity0, error)

AsCreateUsageEventJSONBodyQuantity0 returns the union data inside the CreateUsageEventJSONBody_Quantity as a CreateUsageEventJSONBodyQuantity0

func (CreateUsageEventJSONBody_Quantity) AsCreateUsageEventJSONBodyQuantity1 added in v0.9.2

func (t CreateUsageEventJSONBody_Quantity) AsCreateUsageEventJSONBodyQuantity1() (CreateUsageEventJSONBodyQuantity1, error)

AsCreateUsageEventJSONBodyQuantity1 returns the union data inside the CreateUsageEventJSONBody_Quantity as a CreateUsageEventJSONBodyQuantity1

func (*CreateUsageEventJSONBody_Quantity) FromCreateUsageEventJSONBodyQuantity0 added in v0.9.2

func (t *CreateUsageEventJSONBody_Quantity) FromCreateUsageEventJSONBodyQuantity0(v CreateUsageEventJSONBodyQuantity0) error

FromCreateUsageEventJSONBodyQuantity0 overwrites any union data inside the CreateUsageEventJSONBody_Quantity as the provided CreateUsageEventJSONBodyQuantity0

func (*CreateUsageEventJSONBody_Quantity) FromCreateUsageEventJSONBodyQuantity1 added in v0.9.2

func (t *CreateUsageEventJSONBody_Quantity) FromCreateUsageEventJSONBodyQuantity1(v CreateUsageEventJSONBodyQuantity1) error

FromCreateUsageEventJSONBodyQuantity1 overwrites any union data inside the CreateUsageEventJSONBody_Quantity as the provided CreateUsageEventJSONBodyQuantity1

func (CreateUsageEventJSONBody_Quantity) MarshalJSON added in v0.9.2

func (t CreateUsageEventJSONBody_Quantity) MarshalJSON() ([]byte, error)

func (*CreateUsageEventJSONBody_Quantity) MergeCreateUsageEventJSONBodyQuantity0 added in v0.9.2

func (t *CreateUsageEventJSONBody_Quantity) MergeCreateUsageEventJSONBodyQuantity0(v CreateUsageEventJSONBodyQuantity0) error

MergeCreateUsageEventJSONBodyQuantity0 performs a merge with any union data inside the CreateUsageEventJSONBody_Quantity, using the provided CreateUsageEventJSONBodyQuantity0

func (*CreateUsageEventJSONBody_Quantity) MergeCreateUsageEventJSONBodyQuantity1 added in v0.9.2

func (t *CreateUsageEventJSONBody_Quantity) MergeCreateUsageEventJSONBodyQuantity1(v CreateUsageEventJSONBodyQuantity1) error

MergeCreateUsageEventJSONBodyQuantity1 performs a merge with any union data inside the CreateUsageEventJSONBody_Quantity, using the provided CreateUsageEventJSONBodyQuantity1

func (*CreateUsageEventJSONBody_Quantity) UnmarshalJSON added in v0.9.2

func (t *CreateUsageEventJSONBody_Quantity) UnmarshalJSON(b []byte) error

type CreateUsageEventJSONRequestBody added in v0.9.2

type CreateUsageEventJSONRequestBody CreateUsageEventJSONBody

CreateUsageEventJSONRequestBody defines body for CreateUsageEvent for application/json ContentType.

type CreateWebhookEndpointJSONBody added in v0.9.2

type CreateWebhookEndpointJSONBody struct {
	// Description Your note about the endpoint, such as what it feeds.
	Description string `json:"description,omitempty"`

	// Events Event types to send. `*` means every event; `invoice.*` means every invoice event. Leave it out or send `[]` for every event.
	Events []string `json:"events,omitempty"`

	// Url Where to send events, an `https://` URL on a public
	// address (a loopback URL outside production may use
	// `http://`). Surrounding spaces are trimmed.
	Url string `json:"url"`
}

CreateWebhookEndpointJSONBody defines parameters for CreateWebhookEndpoint.

type CreateWebhookEndpointJSONRequestBody added in v0.9.2

type CreateWebhookEndpointJSONRequestBody CreateWebhookEndpointJSONBody

CreateWebhookEndpointJSONRequestBody defines body for CreateWebhookEndpoint for application/json ContentType.

type CreateWebhookEndpointParams added in v0.9.2

type CreateWebhookEndpointParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

CreateWebhookEndpointParams defines parameters for CreateWebhookEndpoint.

type CreditBalance

type CreditBalance struct {
	// BalanceCents The credit left: the sum of the customer's ledger entries in this currency, in its minor unit (cents for USD). A grant past its expiry still counts here until the expiry run writes it off.
	BalanceCents int64 `json:"balance_cents"`

	// Currency The currency of this balance, uppercase. Each credit ledger entry stores its own currency, and credit pays only invoices in that currency. A customer with credit in two currencies has two balances; they are never added together or converted.
	Currency string `json:"currency"`

	// CustomerId The customer (`hc_cus_…`).
	CustomerId string `json:"customer_id"`

	// TotalDeducted Credit an operator deducted (a negative adjustment), in the currency's minor unit.
	TotalDeducted int64 `json:"total_deducted"`

	// TotalExpired Credit written off by expiry, in the currency's minor unit.
	TotalExpired int64 `json:"total_expired"`

	// TotalGranted Every credit added, in the currency's minor unit: grants, positive adjustments, and credit a void or credit note gave back as new credit. Credit a void or credit note put back on the grant it was drawn from is not added again.
	TotalGranted int64 `json:"total_granted"`

	// TotalRetired Prepaid commit credit taken back because the invoice that funded it was voided or refunded by a credit note, in the currency's minor unit.
	TotalRetired int64 `json:"total_retired"`

	// TotalUsed Credit applied to invoices, less what a void or credit note put back on the grant it was drawn from, in the currency's minor unit.
	TotalUsed int64 `json:"total_used"`
}

CreditBalance A customer's credit balance in one currency and where that credit went. Every cent granted is either still in the balance or in one of the totals: total_granted = total_used + total_expired + total_retired + total_deducted + balance_cents. All amounts are in the currency's minor unit (cents for USD).

type CreditGrantBlock

type CreditGrantBlock struct {
	// AmountCents The credit the block started with, in the currency's minor unit.
	AmountCents int64 `json:"amount_cents"`

	// ConsumedCents Everything drawn from the block, in the currency's minor unit:
	// used by invoices, expired, retired and deducted.
	ConsumedCents int64 `json:"consumed_cents"`

	// CreatedAt When the block was added.
	CreatedAt time.Time `json:"created_at"`

	// Currency The block's currency, uppercase.
	Currency string `json:"currency"`

	// DeductedCents The part an operator removed with a negative adjustment, in the currency's minor unit.
	DeductedCents int64 `json:"deducted_cents"`

	// Description The description of the ledger entry that added the credit.
	Description string `json:"description"`

	// EntryType `grant` or `adjustment`.
	EntryType string `json:"entry_type"`

	// ExpiredCents The part that expired unused, in the currency's minor unit.
	ExpiredCents int64 `json:"expired_cents"`

	// ExpiresAt The credit can be drawn up to and including this instant; a
	// period invoice draws it when its period ends at or before it.
	// The dashboard sends the local midnight after the picked day.
	// Absent when the credit does not expire.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// GrantKind Absent for unclassified credit.
	GrantKind CreditGrantBlockGrantKind `json:"grant_kind,omitempty"`

	// Id The ledger entry that added the credit.
	Id string `json:"id"`

	// RemainingCents Credit left in the block, `amount_cents` minus `consumed_cents`, in the currency's minor unit.
	RemainingCents int64 `json:"remaining_cents"`

	// RetiredCents Commit credit taken back when the invoice that funded it was
	// voided, or refunded by a credit note, in the currency's minor
	// unit.
	RetiredCents int64 `json:"retired_cents"`

	// SourceInvoiceId For a `commit` block, the commit invoice whose finalizing made the grant. Absent for other blocks.
	SourceInvoiceId string `json:"source_invoice_id,omitempty"`
}

CreditGrantBlock One block of credit on a customer's balance (a grant or a positive adjustment) and how much of it is left. Amounts are in the currency's minor unit (cents for USD).

type CreditGrantBlockGrantKind

type CreditGrantBlockGrantKind string

CreditGrantBlockGrantKind Absent for unclassified credit.

const (
	CreditGrantBlockGrantKindCommit      CreditGrantBlockGrantKind = "commit"
	CreditGrantBlockGrantKindPromotional CreditGrantBlockGrantKind = "promotional"
)

Defines values for CreditGrantBlockGrantKind.

func (CreditGrantBlockGrantKind) Valid

func (e CreditGrantBlockGrantKind) Valid() bool

Valid indicates whether the value is a known member of the CreditGrantBlockGrantKind enum.

type CreditGrants

type CreditGrants struct {
	// Grants The customer's credit blocks, newest first. A block with nothing
	// left is listed only with `include_exhausted=true`.
	Grants []CreditGrantBlock `json:"grants"`

	// RemainingByCurrency One entry per currency with credit left, ordered by currency.
	RemainingByCurrency []struct {
		// CommitRemainingCents Remaining prepaid commit credit (`commit`), granted by finalized commit invoices, in the currency's minor unit.
		CommitRemainingCents int64 `json:"commit_remaining_cents"`

		// Currency The currency, uppercase.
		Currency string `json:"currency"`

		// OtherRemainingCents Remaining credit with no kind, such as adjustments and credit-note credit, in the currency's minor unit.
		OtherRemainingCents int64 `json:"other_remaining_cents"`

		// PromotionalRemainingCents Remaining free credit (`promotional`), in the currency's minor unit.
		PromotionalRemainingCents int64 `json:"promotional_remaining_cents"`
	} `json:"remaining_by_currency"`
}

CreditGrants A customer's credit blocks, newest first, with the remaining credit added up by currency and kind. Amounts are in the currency's minor unit (cents for USD).

type CreditLedgerEntry

type CreditLedgerEntry struct {
	// AmountCents Positive adds credit, negative removes it, in the currency's
	// minor unit (cents for USD).
	AmountCents int64 `json:"amount_cents"`

	// BalanceAfter The customer's credit balance in this entry's currency after it,
	// in the currency's minor unit (cents for USD).
	BalanceAfter int64 `json:"balance_after"`

	// ConsumedCents For entries that add credit, how much of it is gone, in the
	// currency's minor unit: drawn by invoices, expired, removed by a
	// negative adjustment, or, for commit credit, taken back when its
	// invoice was voided or refunded by a credit note. Absent when
	// nothing is.
	ConsumedCents int64 `json:"consumed_cents,omitempty"`

	// CreatedAt When the entry was written. For a customer on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// Currency The entry's currency, uppercase. Credit pays only invoices in its own currency.
	Currency string `json:"currency"`

	// CustomerId The customer whose credit the entry changes (`hc_cus_…`).
	CustomerId string `json:"customer_id"`

	// Description What the entry is for: the description you gave a grant or
	// adjustment, "Applied to invoice" and the invoice number on a
	// `usage` entry, or "Expired grant" and the grant's ID on an
	// `expiry` entry.
	Description string `json:"description"`

	// EntryType - `grant`: credit added, by you with `POST /v1/credits/grant` or
	//   by Hardcount (a prepaid-commit invoice when it is finalized, a
	//   credit note, or a void or credit note that gave drawn credit
	//   back).
	// - `usage`: credit an invoice drew.
	// - `expiry`: the unused rest of a grant, written off once its
	//   `expires_at` passed.
	// - `adjustment`: credit added or removed with
	//   `POST /v1/credits/adjust`, or commit credit taken back when its
	//   invoice was voided or refunded.
	EntryType CreditLedgerEntryEntryType `json:"entry_type"`

	// ExpiresAt On a grant, its expiry. The credit can be drawn up to and
	// including this instant; a period invoice draws it when its
	// period ends at or before it. The dashboard sends the local
	// midnight after the picked day. Absent when the credit does not
	// expire.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// GrantKind On a grant, what the credit cost the customer. `commit`:
	// prepaid credit granted when a commit invoice was finalized; that
	// invoice is `source_invoice_id`. `promotional`:
	// free credit you marked so; invoices draw it before any other
	// credit. Absent for other credit.
	GrantKind CreditLedgerEntryGrantKind `json:"grant_kind,omitempty"`

	// Id The entry's ID (`hc_ccl_…`).
	Id string `json:"id"`

	// InvoiceId The invoice the entry comes from: the invoice a `usage` entry
	// was drawn by, the voided or credited invoice that gave credit
	// back, or the commit invoice that funded a grant. Absent when no
	// invoice caused the entry, and on the `adjustment` that takes
	// commit credit back after its invoice was voided or refunded:
	// that invoice is in `metadata.funding_invoice_id`.
	InvoiceId string `json:"invoice_id,omitempty"`

	// Metadata Facts Hardcount records on the entry, such as which grants a
	// draw or a deduction took its credit from (`drained_blocks`).
	// Absent when empty, and on the answer of
	// `POST /v1/credits/adjust`, which does not return it; the ledger
	// list does.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// SourceChangeType The kind of subscription item change that produced a proration:
	// `plan` (the item moved to another plan), `quantity` (its quantity
	// changed), `add` (the item was added) or `remove` (the item was
	// removed). On a credit ledger entry (`source_change_type`) it is
	// never sent in this version.
	SourceChangeType ItemChangeType `json:"source_change_type,omitempty"`

	// SourceCreditNoteId Recorded on credit that a credit note gave back, but not sent by
	// any route in this version: the ledger list does not return it,
	// and the grant and adjust routes never write it. Such an entry
	// names the invoice in `invoice_id`.
	SourceCreditNoteId string `json:"source_credit_note_id,omitempty"`

	// SourceInvoiceId For a `commit` grant, the commit invoice whose finalizing made
	// the grant. Absent on other entries.
	SourceInvoiceId string `json:"source_invoice_id,omitempty"`

	// SourceInvoiceReversalId Recorded on credit that a voided invoice gave back, but not sent
	// by any route in this version: the ledger list does not return
	// it, and the grant and adjust routes never write it. Such an
	// entry names the invoice in `invoice_id`.
	SourceInvoiceReversalId string `json:"source_invoice_reversal_id,omitempty"`

	// SourcePlanChangedAt Not sent by any route in this version: no ledger entry is
	// written with it, so it is always absent.
	SourcePlanChangedAt time.Time `json:"source_plan_changed_at,omitempty"`

	// SourceSubscriptionId Not sent by any route in this version: no ledger entry is
	// written with it, so it is always absent.
	SourceSubscriptionId string `json:"source_subscription_id,omitempty"`

	// SourceSubscriptionItemId Not sent by any route in this version: no ledger entry is
	// written with it, so it is always absent.
	SourceSubscriptionItemId string `json:"source_subscription_item_id,omitempty"`

	// TenantId The account the entry belongs to.
	TenantId string `json:"tenant_id,omitempty"`
}

CreditLedgerEntry One entry in a customer's credit ledger: credit added (`grant`, or a positive `adjustment`), drawn by an invoice (`usage`), removed (a negative `adjustment`) or written off (`expiry`). Returned by `POST /v1/credits/grant` and `POST /v1/credits/adjust`, and listed by `GET /v1/credits/ledger/{customer_id}`.

type CreditLedgerEntryEntryType

type CreditLedgerEntryEntryType string

CreditLedgerEntryEntryType - `grant`: credit added, by you with `POST /v1/credits/grant` or

	by Hardcount (a prepaid-commit invoice when it is finalized, a
	credit note, or a void or credit note that gave drawn credit
	back).
  - `usage`: credit an invoice drew.
  - `expiry`: the unused rest of a grant, written off once its
    `expires_at` passed.
  - `adjustment`: credit added or removed with
    `POST /v1/credits/adjust`, or commit credit taken back when its
    invoice was voided or refunded.
const (
	CreditLedgerEntryEntryTypeAdjustment CreditLedgerEntryEntryType = "adjustment"
	CreditLedgerEntryEntryTypeExpiry     CreditLedgerEntryEntryType = "expiry"
	CreditLedgerEntryEntryTypeGrant      CreditLedgerEntryEntryType = "grant"
	CreditLedgerEntryEntryTypeUsage      CreditLedgerEntryEntryType = "usage"
)

Defines values for CreditLedgerEntryEntryType.

func (CreditLedgerEntryEntryType) Valid

func (e CreditLedgerEntryEntryType) Valid() bool

Valid indicates whether the value is a known member of the CreditLedgerEntryEntryType enum.

type CreditLedgerEntryGrantKind

type CreditLedgerEntryGrantKind string

CreditLedgerEntryGrantKind On a grant, what the credit cost the customer. `commit`: prepaid credit granted when a commit invoice was finalized; that invoice is `source_invoice_id`. `promotional`: free credit you marked so; invoices draw it before any other credit. Absent for other credit.

const (
	CreditLedgerEntryGrantKindCommit      CreditLedgerEntryGrantKind = "commit"
	CreditLedgerEntryGrantKindPromotional CreditLedgerEntryGrantKind = "promotional"
)

Defines values for CreditLedgerEntryGrantKind.

func (CreditLedgerEntryGrantKind) Valid

func (e CreditLedgerEntryGrantKind) Valid() bool

Valid indicates whether the value is a known member of the CreditLedgerEntryGrantKind enum.

type CreditLiveBalance

type CreditLiveBalance struct {
	// Balances Ordered by currency.
	Balances []CreditLiveCurrency `json:"balances"`

	// ComputedAt When the server computed these figures.
	ComputedAt time.Time `json:"computed_at"`

	// CustomerId The customer (`hc_cus_…`).
	CustomerId string `json:"customer_id"`
}

CreditLiveBalance A customer's credit position right now, one entry per currency: every currency the customer holds credit in, and every currency a live subscription will invoice usage in. Amounts in two currencies are never added together. Returned by `GET /v1/credits/balance/{customer_id}/live`; nothing is stored.

type CreditLiveCurrency

type CreditLiveCurrency struct {
	// BalanceCents Settled ledger balance in this currency, less what is left of any grant past its expiry date that the hourly expiry run has not written off yet (an invoice cannot draw on such a grant), in the currency's minor unit. Can be negative.
	BalanceCents int64 `json:"balance_cents"`

	// Currency The currency of this position, uppercase (for example `USD`).
	Currency string `json:"currency"`

	// EstimatedRemainingCents `balance_cents` minus `unbilled_usage_cents`, floored at zero, in the currency's minor unit. To see how far past zero a customer is, subtract the two parts yourself.
	EstimatedRemainingCents int64 `json:"estimated_remaining_cents"`

	// UnbilledUsageCents Metered usage that the next invoice of each subscription invoiced in this currency will bill, priced as the period close prices it, in the currency's minor unit. Usage that a mid-period threshold invoice already billed is not counted again. After a mid-period plan change each meter is counted for the time a plan carrying it was on the subscription. For a trialing subscription only usage from the trial end on counts, inside its first paid period; trial usage is free.
	UnbilledUsageCents int64 `json:"unbilled_usage_cents"`
}

CreditLiveCurrency The live position in one currency, in its minor unit (cents for USD). `balance_cents` is the credit the customer can spend in it: the settled ledger balance, which moves only when an invoice, grant, adjustment or expiry is written, less any grant that is past its expiry date and not yet written off. `unbilled_usage_cents` is the usage of the current period that no invoice has billed yet and that will be invoiced in this currency. `estimated_remaining_cents` is the first minus the second, never below zero.

type CreditNote

type CreditNote struct {
	// BillToSnapshot What an issued invoice or credit note prints about its buyer. It is
	// copied from the customer and the billing profile when the document
	// is issued, so a later edit to either does not change it. The printed
	// name is `legal_name` when set, otherwise `display_name`.
	BillToSnapshot DocumentBillTo `json:"bill_to_snapshot,omitempty"`

	// CommitRetiredCents Prepaid commit credits this note retired, in the currency's minor unit (cents for USD). Absent on other notes.
	CommitRetiredCents int64 `json:"commit_retired_cents,omitempty"`

	// CreatedAt When the note was created. For an invoice on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// CreditAmountCents Part of the total added to the customer's credit balance, in the
	// currency's minor unit (cents for USD). 0 on a note against an
	// unpaid invoice.
	CreditAmountCents int64 `json:"credit_amount_cents"`

	// CreditNoteNumber The number printed on the note: the account's credit note prefix
	// (default `CN`), a hyphen and a sequence padded to six digits, for
	// example `CN-000003`. Test mode and live mode count separately.
	// Set when the note is created, drafts included.
	CreditNoteNumber string `json:"credit_note_number"`

	// Currency The invoice's currency, uppercase.
	Currency string `json:"currency"`

	// CustomerId The invoice's customer.
	CustomerId string `json:"customer_id"`

	// Id Unique identifier of the credit note, starting `hc_cn_`.
	Id string `json:"id"`

	// InvoiceId The invoice the note credits.
	InvoiceId string `json:"invoice_id"`

	// IsSimulated True when the note's dates are test-clock time (its invoice's customer is on a test clock).
	IsSimulated bool `json:"is_simulated"`

	// IssuePending True on a draft that Hardcount will issue automatically, such as the credit for unused time after a plan downgrade.
	IssuePending bool `json:"issue_pending"`

	// IssuedAt When the note was issued. Absent until it is issued.
	IssuedAt time.Time `json:"issued_at,omitempty"`

	// Metadata Extra key-value data stored with the note. No API request sets it; it is absent when empty.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// OutOfBandAmountCents Part of the total paid back outside Hardcount (a bank transfer,
	// cash), recorded for the books, in the currency's minor unit
	// (cents for USD). 0 on a note against an unpaid invoice.
	OutOfBandAmountCents int64 `json:"out_of_band_amount_cents"`

	// Reason Why the note was made, as given when it was created. A refund
	// made with `POST /v1/invoices/{id}/refund` carries its refund
	// reason (`duplicate`, `fraudulent`, `requested_by_customer` or
	// `other`).
	Reason string `json:"reason"`

	// RecordedAt The real-world time the note was created. It differs from
	// `created_at` only when the invoice is on a test clock. Absent on
	// notes created before releases recorded it.
	RecordedAt time.Time `json:"recorded_at,omitempty"`

	// RecordedFromStripe True when the card refund is a refund made in Stripe outside
	// Hardcount: recorded from Stripe's refund webhook, linked with
	// `stripe_refund_id` at create, or attached with
	// `POST /v1/credit-notes/{id}/attach-stripe-refund`. Hardcount made
	// no refund call for it; `stripe_refund_id` names the refund.
	RecordedFromStripe bool `json:"recorded_from_stripe"`

	// RefundAmountCents Part of the total refunded to the card that paid the invoice, in
	// the currency's minor unit (cents for USD). 0 on a note against an
	// unpaid invoice.
	RefundAmountCents int64 `json:"refund_amount_cents"`

	// RefundStatus The refund part's state at Stripe. `none`: no refund was sent
	// (no refund part, or the note is not issued yet); an issued note
	// with a refund part stays `none` only when its refund's result
	// was not recorded. `pending`: Stripe has not finished it.
	// `succeeded` and `failed`: Stripe's answer. `unknown`: Stripe gave
	// no clear answer (a timeout, a network error, a Stripe 5xx, a 409
	// or a 429), so the customer may already be refunded. Don't refund it
	// again in the Stripe Dashboard. Retry it with
	// `POST /v1/credit-notes/{id}/retry-refund`, which looks for the
	// refund at Stripe first and then resends the same request with
	// the same idempotency key.
	RefundStatus CreditNoteRefundStatus `json:"refund_status"`

	// Status `draft`: created but not applied; it can be issued or voided.
	// `issued`: applied to the invoice and final. `voided`: cancelled
	// before it was issued.
	Status CreditNoteStatus `json:"status"`

	// StripeRefundId The Stripe refund (`re_…`) of the refund part. Absent until Stripe made one.
	StripeRefundId string `json:"stripe_refund_id,omitempty"`

	// SubtotalCents The credited amount without its tax, in the currency's minor unit (cents for USD).
	SubtotalCents int64 `json:"subtotal_cents"`

	// SupplierSnapshot What an issued invoice or credit note prints about its seller: your
	// company details from the account settings, copied when the document
	// was issued. A later change to the settings does not change it.
	// Every field is absent when the setting was empty.
	SupplierSnapshot DocumentSupplier `json:"supplier_snapshot,omitempty"`

	// TaxAmountCents The tax part of the credited amount, in the currency's minor
	// unit (cents for USD). It is the invoice's own tax share of the
	// note, so crediting half of an invoice reverses half of its tax.
	TaxAmountCents int64 `json:"tax_amount_cents"`

	// TaxReversalPending True when the tax reversal failed and will be retried.
	TaxReversalPending bool `json:"tax_reversal_pending"`

	// TaxTransactionId The tax provider's reversal transaction, set when the note is
	// issued against an invoice whose tax the provider recorded.
	// Absent otherwise.
	TaxTransactionId string `json:"tax_transaction_id,omitempty"`

	// TenantId The account the credit note belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`

	// TotalCents The credited amount with tax, in the currency's minor unit (cents
	// for USD): the sum of the note's lines.
	TotalCents int64 `json:"total_cents"`

	// UpdatedAt When the note last changed.
	UpdatedAt time.Time `json:"updated_at"`

	// VoidedAt When the note was voided. Absent unless it is voided.
	VoidedAt time.Time `json:"voided_at,omitempty"`
}

CreditNote A credit note reduces what a customer owes on an invoice, or gives money back after it was paid. On an unpaid invoice it lowers `amount_due_cents`. On a paid invoice its total is split three ways: refund to the card (`refund_amount_cents`), credit to the customer's balance (`credit_amount_cents`), and money returned outside Hardcount (`out_of_band_amount_cents`). Amounts are whole numbers in the currency's minor unit (cents for USD). The credit note routes and `POST /v1/invoices/{id}/refund` return it.

type CreditNoteRefundStatus

type CreditNoteRefundStatus string

CreditNoteRefundStatus The refund part's state at Stripe. `none`: no refund was sent (no refund part, or the note is not issued yet); an issued note with a refund part stays `none` only when its refund's result was not recorded. `pending`: Stripe has not finished it. `succeeded` and `failed`: Stripe's answer. `unknown`: Stripe gave no clear answer (a timeout, a network error, a Stripe 5xx, a 409 or a 429), so the customer may already be refunded. Don't refund it again in the Stripe Dashboard. Retry it with `POST /v1/credit-notes/{id}/retry-refund`, which looks for the refund at Stripe first and then resends the same request with the same idempotency key.

const (
	CreditNoteRefundStatusFailed    CreditNoteRefundStatus = "failed"
	CreditNoteRefundStatusNone      CreditNoteRefundStatus = "none"
	CreditNoteRefundStatusPending   CreditNoteRefundStatus = "pending"
	CreditNoteRefundStatusSucceeded CreditNoteRefundStatus = "succeeded"
	CreditNoteRefundStatusUnknown   CreditNoteRefundStatus = "unknown"
)

Defines values for CreditNoteRefundStatus.

func (CreditNoteRefundStatus) Valid

func (e CreditNoteRefundStatus) Valid() bool

Valid indicates whether the value is a known member of the CreditNoteRefundStatus enum.

type CreditNoteStats

type CreditNoteStats struct {
	// ByCurrency Money on issued notes, one entry per currency, the account's
	// default currency first. Empty when no note is issued. Amounts are
	// in the currency's minor unit (cents for USD) and never added
	// across currencies.
	ByCurrency []struct {
		// CreditedCents Added to customers' credit balances.
		CreditedCents int64 `json:"credited_cents"`

		// Currency The currency of this entry, uppercase.
		Currency string `json:"currency"`

		// OutOfBandCents Recorded as paid back outside Stripe.
		OutOfBandCents int64 `json:"out_of_band_cents"`

		// RefundFailedCents Refunds that failed. No money went back to the card.
		RefundFailedCents int64 `json:"refund_failed_cents"`

		// RefundPendingCents Refunds not confirmed yet. Neither succeeded nor failed, the refund is waiting on Stripe, Stripe's answer was unclear, or its result was never recorded.
		RefundPendingCents int64 `json:"refund_pending_cents"`

		// RefundedCents Refunds that succeeded. A refund still pending or one that failed is not counted here.
		RefundedCents int64 `json:"refunded_cents"`

		// TotalCents Total of the issued notes.
		TotalCents int64 `json:"total_cents"`
	} `json:"by_currency"`

	// DraftCount Credit notes in `draft`.
	DraftCount int `json:"draft_count"`

	// IssuedCount Credit notes in `issued`.
	IssuedCount int `json:"issued_count"`

	// VoidedCount Credit notes in `voided`.
	VoidedCount int `json:"voided_count"`
}

CreditNoteStats What `GET /v1/credit-notes/stats` returns: how many credit notes there are in each status, and the money on the issued ones, per currency. It covers every note in this mode.

type CreditNoteStatus

type CreditNoteStatus string

CreditNoteStatus `draft`: created but not applied; it can be issued or voided. `issued`: applied to the invoice and final. `voided`: cancelled before it was issued.

const (
	CreditNoteStatusDraft  CreditNoteStatus = "draft"
	CreditNoteStatusIssued CreditNoteStatus = "issued"
	CreditNoteStatusVoided CreditNoteStatus = "voided"
)

Defines values for CreditNoteStatus.

func (CreditNoteStatus) Valid

func (e CreditNoteStatus) Valid() bool

Valid indicates whether the value is a known member of the CreditNoteStatus enum.

type Customer

type Customer struct {
	// AdditionalEmails Addresses copied (CC) on billing documents and billing emails:
	// invoice, receipt, payment reminder, final notice, failed payment
	// and credit note. Never on the payment setup emails, whose link
	// lets the reader add a card. Lowercase bare addresses, no
	// duplicates, never the primary `email`. At most 10: a create or
	// update with more is refused with 422. Absent when the list is
	// empty.
	AdditionalEmails []string `json:"additional_emails,omitempty"`

	// CreatedAt When the customer was created.
	CreatedAt time.Time `json:"created_at"`

	// DisplayName The name shown on invoices, emails and the dashboard. Create
	// refuses one longer than 255 bytes (UTF-8); an update does not
	// check the length.
	DisplayName string `json:"display_name"`

	// DunningPolicyId The dunning policy (the plan for retrying failed payments) this
	// customer uses. Absent when the customer uses the account's
	// default policy.
	DunningPolicyId string `json:"dunning_policy_id,omitempty"`

	// Email Where billing emails go: invoices, receipts, payment reminders
	// and payment-method links. Absent when the customer has none.
	Email string `json:"email,omitempty"`

	// EmailBounceReason The reason the email provider gave with the last bounce or spam
	// report. Absent until one is recorded, when the report gave no
	// reason, and again after `email` changes.
	EmailBounceReason string `json:"email_bounce_reason,omitempty"`

	// EmailLastBouncedAt When the last bounce or spam report was recorded. Absent until
	// one is, and again after `email` changes.
	EmailLastBouncedAt time.Time `json:"email_last_bounced_at,omitempty"`

	// EmailStatus Whether `email` receives mail, learned from bounce and spam
	// reports. `unknown` until a report arrives. `bounced` or
	// `complained` after one, and Hardcount then stops emailing the
	// address. Changing `email` sets it back to `unknown`. Hardcount
	// does not set `ok` today.
	EmailStatus CustomerEmailStatus `json:"email_status,omitempty"`

	// ExternalId Your own ID for the customer, such as the account ID in your
	// app. Unique in the account and mode, and fixed after create.
	// Create refuses one longer than 255 bytes (UTF-8).
	ExternalId string `json:"external_id"`

	// Id The customer's ID, `hc_cus_` and 20 characters.
	Id string `json:"id"`

	// Livemode Whether the customer is in live mode. The customer routes and
	// webhook events leave it out: use the mode of your API key.
	Livemode bool `json:"livemode,omitempty"`

	// Status `archived` blocks new subscriptions for the customer. Its
	// unpaid invoices stay collectible.
	Status CustomerStatus `json:"status"`

	// StripeCustomerId The Stripe customer linked to this customer. Absent until
	// Hardcount first creates it: when you create a payment-method
	// link (setup session or setup email), or when the customer opens
	// Stripe Checkout from a payment-update link or the hosted invoice
	// page. Set once, never replaced.
	StripeCustomerId string `json:"stripe_customer_id,omitempty"`

	// TenantId The account the customer belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// TestClockId The test clock the customer was created on (test mode only).
	// Its subscriptions and invoices then run on the clock's
	// simulated time. Set at create and fixed after. Absent for a
	// customer with no test clock.
	TestClockId string `json:"test_clock_id,omitempty"`

	// UpdatedAt When the customer was last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

Customer A customer you bill: the person or company that subscriptions, invoices, credits and payment methods belong to. Create, list, get and update customers under `/v1/customers`. The `customer.email_bounced` and `customer.email_complained` webhook events carry this object too.

Not every route fills every optional field. Get and update return the whole record. The list and create answers leave out `email_status`, the bounce fields, `dunning_policy_id` and `stripe_customer_id`, and the list also leaves out `additional_emails`.

type CustomerBillingProfile

type CustomerBillingProfile struct {
	// AddressLine1 First line of the billing address.
	AddressLine1 string `json:"address_line1,omitempty"`

	// AddressLine2 Second line of the billing address.
	AddressLine2 string `json:"address_line2,omitempty"`

	// City City of the billing address.
	City string `json:"city,omitempty"`

	// Country Two letters, an ISO 3166 alpha-2 code such as `US` or `IN`. Only
	// the format is checked. Stored in upper case.
	Country string `json:"country,omitempty"`

	// CreatedAt When the profile was first saved.
	CreatedAt time.Time `json:"created_at"`

	// Currency ISO 4217 code, such as `USD`. When set, invoices for this
	// customer use it instead of the plan currency. Stored in upper
	// case. Zero-decimal currencies such as JPY are refused.
	Currency string `json:"currency,omitempty"`

	// CustomerId The customer this profile belongs to.
	CustomerId string `json:"customer_id"`

	// LegalName The customer's legal name, printed in the invoice's Bill to block.
	LegalName string `json:"legal_name,omitempty"`

	// Phone 7 to 20 characters of digits, spaces, `+`, `-`, `(`, `)`.
	Phone string `json:"phone,omitempty"`

	// PostalCode Postal code of the billing address, where the country has one.
	PostalCode string `json:"postal_code,omitempty"`

	// ProfileStatus Set by the server. `ready` when legal name, address line
	// 1, city and country are all set, so the invoice can print
	// a full Bill to block. Otherwise `incomplete`.
	ProfileStatus CustomerBillingProfileProfileStatus `json:"profile_status"`

	// State State, province or region of the billing address, where the country has one.
	State string `json:"state,omitempty"`

	// TaxExemptReason Why the customer pays no tax, such as a reseller certificate.
	// Required when `tax_status` is `exempt`.
	TaxExemptReason string `json:"tax_exempt_reason,omitempty"`

	// TaxId The buyer's tax ID, stored in upper case. Required when
	// `tax_status` is `reverse_charge`. For `eu_vat`, `in_gst` and
	// `au_abn` its format is checked.
	TaxId string `json:"tax_id"`

	// TaxIdType The kind of tax ID, as its Stripe code (for example `eu_vat`,
	// `in_gst`, `au_abn`), stored in lower case. `vat`, `gstin`,
	// `in_gstin` and `abn` are stored as those codes.
	TaxIdType string `json:"tax_id_type"`

	// TaxStatus `standard`: tax is worked out as usual. `exempt`: no tax, and
	// the invoice shows `tax_exempt_reason`. `reverse_charge`: no tax,
	// and the invoice tells the buyer to account for it. Defaults to
	// `standard`.
	TaxStatus CustomerBillingProfileTaxStatus `json:"tax_status"`

	// TenantId The account the customer belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the profile was last saved.
	UpdatedAt time.Time `json:"updated_at"`
}

CustomerBillingProfile defines model for CustomerBillingProfile.

type CustomerBillingProfileInput

type CustomerBillingProfileInput struct {
	// AddressLine1 First line of the billing address.
	AddressLine1 string `json:"address_line1,omitempty"`

	// AddressLine2 Second line of the billing address.
	AddressLine2 string `json:"address_line2,omitempty"`

	// City City of the billing address.
	City string `json:"city,omitempty"`

	// Country Two letters, an ISO 3166 alpha-2 code such as `US` or `IN`. Only
	// the format is checked. Stored in upper case.
	Country string `json:"country,omitempty"`

	// Currency ISO 4217 code, such as `USD`. When set, invoices for this
	// customer use it instead of the plan currency. Stored in upper
	// case. Zero-decimal currencies such as JPY are refused.
	Currency string `json:"currency,omitempty"`

	// LegalName The customer's legal name, printed in the invoice's Bill to block.
	LegalName string `json:"legal_name,omitempty"`

	// Phone 7 to 20 characters of digits, spaces, `+`, `-`, `(`, `)`.
	Phone string `json:"phone,omitempty"`

	// PostalCode Postal code of the billing address, where the country has one.
	PostalCode string `json:"postal_code,omitempty"`

	// State State, province or region of the billing address, where the country has one.
	State string `json:"state,omitempty"`

	// TaxExemptReason Why the customer pays no tax, such as a reseller certificate.
	// Required when `tax_status` is `exempt`.
	TaxExemptReason string `json:"tax_exempt_reason,omitempty"`

	// TaxId The buyer's tax ID, stored in upper case. Required when
	// `tax_status` is `reverse_charge`. For `eu_vat`, `in_gst` and
	// `au_abn` its format is checked.
	TaxId string `json:"tax_id,omitempty"`

	// TaxIdType The kind of tax ID, as its Stripe code (for example `eu_vat`,
	// `in_gst`, `au_abn`), stored in lower case. `vat`, `gstin`,
	// `in_gstin` and `abn` are stored as those codes.
	TaxIdType string `json:"tax_id_type,omitempty"`

	// TaxStatus `standard`: tax is worked out as usual. `exempt`: no tax, and
	// the invoice shows `tax_exempt_reason`. `reverse_charge`: no tax,
	// and the invoice tells the buyer to account for it. Defaults to
	// `standard`.
	TaxStatus CustomerBillingProfileInputTaxStatus `json:"tax_status,omitempty"`
}

CustomerBillingProfileInput The billing details printed on invoices and used for tax: the body of `PUT /v1/customers/{id}/billing-profile`. The whole profile is replaced on every write, so a field you leave out is stored empty.

type CustomerBillingProfileInputTaxStatus

type CustomerBillingProfileInputTaxStatus string

CustomerBillingProfileInputTaxStatus `standard`: tax is worked out as usual. `exempt`: no tax, and the invoice shows `tax_exempt_reason`. `reverse_charge`: no tax, and the invoice tells the buyer to account for it. Defaults to `standard`.

const (
	CustomerBillingProfileInputTaxStatusExempt        CustomerBillingProfileInputTaxStatus = "exempt"
	CustomerBillingProfileInputTaxStatusReverseCharge CustomerBillingProfileInputTaxStatus = "reverse_charge"
	CustomerBillingProfileInputTaxStatusStandard      CustomerBillingProfileInputTaxStatus = "standard"
)

Defines values for CustomerBillingProfileInputTaxStatus.

func (CustomerBillingProfileInputTaxStatus) Valid

Valid indicates whether the value is a known member of the CustomerBillingProfileInputTaxStatus enum.

type CustomerBillingProfileProfileStatus

type CustomerBillingProfileProfileStatus string

CustomerBillingProfileProfileStatus Set by the server. `ready` when legal name, address line 1, city and country are all set, so the invoice can print a full Bill to block. Otherwise `incomplete`.

const (
	CustomerBillingProfileProfileStatusIncomplete CustomerBillingProfileProfileStatus = "incomplete"
	CustomerBillingProfileProfileStatusReady      CustomerBillingProfileProfileStatus = "ready"
)

Defines values for CustomerBillingProfileProfileStatus.

func (CustomerBillingProfileProfileStatus) Valid

Valid indicates whether the value is a known member of the CustomerBillingProfileProfileStatus enum.

type CustomerBillingProfileTaxStatus

type CustomerBillingProfileTaxStatus string

CustomerBillingProfileTaxStatus `standard`: tax is worked out as usual. `exempt`: no tax, and the invoice shows `tax_exempt_reason`. `reverse_charge`: no tax, and the invoice tells the buyer to account for it. Defaults to `standard`.

const (
	CustomerBillingProfileTaxStatusExempt        CustomerBillingProfileTaxStatus = "exempt"
	CustomerBillingProfileTaxStatusReverseCharge CustomerBillingProfileTaxStatus = "reverse_charge"
	CustomerBillingProfileTaxStatusStandard      CustomerBillingProfileTaxStatus = "standard"
)

Defines values for CustomerBillingProfileTaxStatus.

func (CustomerBillingProfileTaxStatus) Valid

Valid indicates whether the value is a known member of the CustomerBillingProfileTaxStatus enum.

type CustomerEmailStatus

type CustomerEmailStatus string

CustomerEmailStatus Whether `email` receives mail, learned from bounce and spam reports. `unknown` until a report arrives. `bounced` or `complained` after one, and Hardcount then stops emailing the address. Changing `email` sets it back to `unknown`. Hardcount does not set `ok` today.

const (
	CustomerEmailStatusBounced    CustomerEmailStatus = "bounced"
	CustomerEmailStatusComplained CustomerEmailStatus = "complained"
	CustomerEmailStatusOk         CustomerEmailStatus = "ok"
	CustomerEmailStatusUnknown    CustomerEmailStatus = "unknown"
)

Defines values for CustomerEmailStatus.

func (CustomerEmailStatus) Valid

func (e CustomerEmailStatus) Valid() bool

Valid indicates whether the value is a known member of the CustomerEmailStatus enum.

type CustomerOverview

type CustomerOverview struct {
	// ActiveSubscriptions The customer's subscriptions with status `active`, up to 50,
	// with their items. Trialing subscriptions are not listed.
	ActiveSubscriptions []Subscription `json:"active_subscriptions"`

	// CustomerId The customer the overview is about.
	CustomerId string `json:"customer_id"`

	// OutstandingBalance Invoices that are not draft, voided or uncollectible and
	// whose payment is pending, failed or unknown.
	OutstandingBalance struct {
		// ByCurrency Amount due on the same invoices, one entry per currency,
		// largest first. Empty when nothing is owed.
		ByCurrency []struct {
			// AmountCents Amount due in this currency, in its minor unit (cents for USD).
			AmountCents int64 `json:"amount_cents"`

			// Currency The currency, such as `USD`.
			Currency string `json:"currency"`
		} `json:"by_currency"`

		// TotalCents Sum of `amount_due_cents`, in minor units (cents for USD).
		// Amounts in different currencies are added together, so use
		// `by_currency` to show an amount.
		TotalCents int64 `json:"total_cents"`

		// UnpaidCount How many invoices are counted.
		UnpaidCount int `json:"unpaid_count"`
	} `json:"outstanding_balance"`

	// RecentInvoices The 5 newest invoices.
	RecentInvoices []Invoice `json:"recent_invoices"`
}

CustomerOverview A one-call summary of a customer for a customer page: its active subscriptions, its 5 newest invoices and what it still owes. `GET /v1/customers/{customer_id}/overview` returns it.

type CustomerPriceOverride

type CustomerPriceOverride struct {
	// Active True until the override is ended: by `DELETE
	// /v1/price-overrides/{id}`, by a new override for the same
	// customer and price, or by the removal of the price.
	Active bool `json:"active"`

	// CreatedAt When the override starts, in the customer's time: wall time, or
	// its test clock's time. A subscription already on the plan gets
	// it from its next period; one that first joins the plan in a
	// period after this instant gets it from the join.
	CreatedAt time.Time `json:"created_at"`

	// CustomerId The customer who pays this rate.
	CustomerId string `json:"customer_id"`

	// DeactivatedAt When the override ended, in the customer's time. Absent while it is active.
	DeactivatedAt time.Time `json:"deactivated_at,omitempty"`

	// Id The override's ID, `hc_cpo_` and 20 characters.
	Id string `json:"id"`

	// Mode How the override bills a quantity; see PriceShape.
	Mode CustomerPriceOverrideMode `json:"mode"`

	// PackageAmountCents Price of one package, as a decimal string of cents. `"0"` unless
	// `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents"`

	// PackageSize The units in one package. 0 unless `mode` is `package`.
	PackageSize int64 `json:"package_size"`

	// PriceId The plan price this override replaces the rate of, for this customer.
	PriceId string `json:"price_id"`

	// Reason Your note on why the customer has this rate. Absent when none was given.
	Reason string `json:"reason,omitempty"`

	// TenantId The account the override belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// Tiers Empty (`[]`) unless `mode` is `graduated`.
	Tiers []PriceTier `json:"tiers"`

	// UnitAmountCents Price per unit, as a decimal string of cents. `"0"` unless `mode`
	// is `per_unit`.
	UnitAmountCents string `json:"unit_amount_cents"`

	// UpdatedAt When the override was last written.
	UpdatedAt time.Time `json:"updated_at"`
}

CustomerPriceOverride A customer's negotiated rate for one plan price. It keeps applying when the price's rate changes, and ends when the price is removed. It takes the plan's currency. The `/v1/price-overrides` routes create, list and end overrides. Every shape field is always sent: the ones the mode does not use are `"0"`, `0` or `[]`.

type CustomerPriceOverrideMode

type CustomerPriceOverrideMode string

CustomerPriceOverrideMode How the override bills a quantity; see PriceShape.

const (
	CustomerPriceOverrideModeGraduated CustomerPriceOverrideMode = "graduated"
	CustomerPriceOverrideModePackage   CustomerPriceOverrideMode = "package"
	CustomerPriceOverrideModePerUnit   CustomerPriceOverrideMode = "per_unit"
)

Defines values for CustomerPriceOverrideMode.

func (CustomerPriceOverrideMode) Valid

func (e CustomerPriceOverrideMode) Valid() bool

Valid indicates whether the value is a known member of the CustomerPriceOverrideMode enum.

type CustomerStatus

type CustomerStatus string

CustomerStatus `archived` blocks new subscriptions for the customer. Its unpaid invoices stay collectible.

const (
	CustomerStatusActive   CustomerStatus = "active"
	CustomerStatusArchived CustomerStatus = "archived"
)

Defines values for CustomerStatus.

func (CustomerStatus) Valid

func (e CustomerStatus) Valid() bool

Valid indicates whether the value is a known member of the CustomerStatus enum.

type CustomerUsage

type CustomerUsage struct {
	// Buckets One entry per UTC day in the period, including days with no
	// usage. Empty when the customer's plans price no meter, or when
	// the daily series failed to load (`warnings` then says so).
	Buckets []struct {
		// BucketStart The start of the UTC day.
		BucketStart time.Time `json:"bucket_start"`

		// PerMeter Quantity per meter ID for that day, as a decimal string:
		// the sum of the day's event quantities, including usage
		// no price takes. So the days need not add up to a meter's
		// `total_quantity`, which uses the meter's aggregation.
		// Empty on a day with no usage.
		PerMeter map[string]string `json:"per_meter"`
	} `json:"buckets"`

	// CustomerId The customer the usage belongs to.
	CustomerId string `json:"customer_id"`

	// Meters One entry per meter the customer's plans price, with or without usage.
	Meters []CustomerUsageMeter `json:"meters"`

	// Period The window the response covers. With no `from` and `to`
	// (`current_billing_cycle`), each subscription is rated over its
	// own current billing period, and the period runs from the
	// earliest start to the latest end of those periods. A meter's
	// totals and daily `buckets` cover its own subscription's whole
	// period, including usage a threshold invoice already billed.
	Period struct {
		// From Start of the window, inclusive.
		From time.Time `json:"from"`

		// Source `current_billing_cycle`: no `from` and `to` were sent, and
		// the amounts are what the period's invoices bill.
		// `explicit`: the window you sent. Its amounts are an
		// estimate, so a past window can differ from its invoices.
		// Only active and trialing subscriptions are counted: the
		// usage of a canceled subscription is left out. Each
		// subscription's usage in the window is priced at the
		// prices of its current billing period.
		Source CustomerUsagePeriodSource `json:"source"`

		// To End of the window, exclusive.
		To time.Time `json:"to"`
	} `json:"period"`

	// Subscriptions One entry per item of each active or trialing subscription. A
	// subscription with several plans appears once per plan, with the
	// same `id`.
	Subscriptions []struct {
		// Currency The plan's currency, such as `USD`.
		Currency string `json:"currency"`

		// CurrentPeriodEnd End of the subscription's current billing period, exclusive.
		CurrentPeriodEnd time.Time `json:"current_period_end"`

		// CurrentPeriodStart Start of the subscription's current billing period.
		CurrentPeriodStart time.Time `json:"current_period_start"`

		// Id The subscription's ID.
		Id string `json:"id"`

		// PlanId The plan of this item.
		PlanId string `json:"plan_id"`

		// PlanName The plan's name.
		PlanName string `json:"plan_name"`
	} `json:"subscriptions"`

	// Totals One entry per currency.
	Totals []struct {
		// AmountCents The usage cost of every meter in this currency, in the
		// currency's minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// Currency The currency, such as `USD`.
		Currency string `json:"currency"`
	} `json:"totals"`

	// Warnings Problems found working out this usage, in words, such as usage
	// that no price takes or a meter whose usage went below zero.
	Warnings []string `json:"warnings"`
}

CustomerUsage A customer's usage and its cost over a window, priced the way the invoice prices it: `GET /v1/customers/{id}/usage`. Only active and trialing subscriptions are counted. Quantities are decimal strings.

type CustomerUsageMeter

type CustomerUsageMeter struct {
	// Currency The currency of the plan whose rows `prices` shows. Empty (`""`)
	// when `prices` is empty.
	Currency string `json:"currency"`

	// EventName The `event_name` usage events send for this meter.
	EventName string `json:"event_name"`

	// MeterId The meter's ID.
	MeterId string `json:"meter_id"`

	// MeterName The meter's display name.
	MeterName string `json:"meter_name"`

	// Prices One row per (plan, price) that took usage, and a `no_price` row
	// per plan for the usage no price of that plan took. Two plans can
	// price one meter differently.
	Prices []struct {
		// AmountCents What this price bills for the usage, in the currency's minor
		// unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// DimensionMatch The labels the price takes. Absent for a price that takes every event.
		DimensionMatch map[string]string `json:"dimension_match,omitempty"`

		// NoPrice True for usage no price of the plan took. Hardcount bills
		// nothing for it, and it is left out of the meter's totals.
		// Absent on other rows.
		NoPrice bool `json:"no_price,omitempty"`

		// PlanId The plan the price belongs to.
		PlanId string `json:"plan_id"`

		// PriceId The plan price that took the usage. Absent on a `no_price` row.
		PriceId string `json:"price_id,omitempty"`

		// Quantity The usage this price took, as a decimal string.
		Quantity string `json:"quantity"`

		// UnitAmountDecimal Price per unit, as a decimal string of cents; the same
		// figure the invoice line shows. Absent on a `no_price`
		// row.
		UnitAmountDecimal string `json:"unit_amount_decimal,omitempty"`
	} `json:"prices"`

	// TotalAmountCents What the usage costs, in the currency's minor unit (cents for
	// USD). Usage no price took is left out.
	TotalAmountCents int64 `json:"total_amount_cents"`

	// TotalQuantity The usage the meter's prices took, as a decimal string, under
	// the meter's aggregation. Usage no price took is left out.
	TotalQuantity string `json:"total_quantity"`

	// Unit The meter's unit, such as `tokens`.
	Unit string `json:"unit"`
}

CustomerUsageMeter One meter in a customer's usage report: its usage over the window and what that usage costs, split by the price that took it.

type CustomerUsagePeriodSource

type CustomerUsagePeriodSource string

CustomerUsagePeriodSource `current_billing_cycle`: no `from` and `to` were sent, and the amounts are what the period's invoices bill. `explicit`: the window you sent. Its amounts are an estimate, so a past window can differ from its invoices. Only active and trialing subscriptions are counted: the usage of a canceled subscription is left out. Each subscription's usage in the window is priced at the prices of its current billing period.

const (
	CurrentBillingCycle CustomerUsagePeriodSource = "current_billing_cycle"
	Explicit            CustomerUsagePeriodSource = "explicit"
)

Defines values for CustomerUsagePeriodSource.

func (CustomerUsagePeriodSource) Valid

func (e CustomerUsagePeriodSource) Valid() bool

Valid indicates whether the value is a known member of the CustomerUsagePeriodSource enum.

type DeleteDunningPolicy200JSONResponseBodyStatus

type DeleteDunningPolicy200JSONResponseBodyStatus string

DeleteDunningPolicy200JSONResponseBodyStatus defines parameters for DeleteDunningPolicy.

const (
	DeleteDunningPolicy200JSONResponseBodyStatusDeleted DeleteDunningPolicy200JSONResponseBodyStatus = "deleted"
)

Defines values for DeleteDunningPolicy200JSONResponseBodyStatus.

func (DeleteDunningPolicy200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the DeleteDunningPolicy200JSONResponseBodyStatus enum.

type DeleteTestClock200JSONResponseBodyStatus added in v0.9.2

type DeleteTestClock200JSONResponseBodyStatus string

DeleteTestClock200JSONResponseBodyStatus defines parameters for DeleteTestClock.

const (
	DeleteTestClock200JSONResponseBodyStatusDeleted DeleteTestClock200JSONResponseBodyStatus = "deleted"
)

Defines values for DeleteTestClock200JSONResponseBodyStatus.

func (DeleteTestClock200JSONResponseBodyStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the DeleteTestClock200JSONResponseBodyStatus enum.

type DeleteWebhookEndpoint200JSONResponseBodyStatus added in v0.9.2

type DeleteWebhookEndpoint200JSONResponseBodyStatus string

DeleteWebhookEndpoint200JSONResponseBodyStatus defines parameters for DeleteWebhookEndpoint.

const (
	Deleted DeleteWebhookEndpoint200JSONResponseBodyStatus = "deleted"
)

Defines values for DeleteWebhookEndpoint200JSONResponseBodyStatus.

func (DeleteWebhookEndpoint200JSONResponseBodyStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the DeleteWebhookEndpoint200JSONResponseBodyStatus enum.

type DiscardHeldUsageJSONBody

type DiscardHeldUsageJSONBody struct {
	// EventName Discard only the rows with this `event_name`. Omit for all.
	EventName string `json:"event_name,omitempty"`

	// ExternalCustomerId The external ID the rows were held under.
	ExternalCustomerId string `json:"external_customer_id"`
}

DiscardHeldUsageJSONBody defines parameters for DiscardHeldUsage.

type DiscardHeldUsageJSONRequestBody

type DiscardHeldUsageJSONRequestBody DiscardHeldUsageJSONBody

DiscardHeldUsageJSONRequestBody defines body for DiscardHeldUsage for application/json ContentType.

type DisconnectStripeParamsMode

type DisconnectStripeParamsMode string

DisconnectStripeParamsMode defines parameters for DisconnectStripe.

const (
	DisconnectStripeParamsModeLive DisconnectStripeParamsMode = "live"
	DisconnectStripeParamsModeTest DisconnectStripeParamsMode = "test"
)

Defines values for DisconnectStripeParamsMode.

func (DisconnectStripeParamsMode) Valid

func (e DisconnectStripeParamsMode) Valid() bool

Valid indicates whether the value is a known member of the DisconnectStripeParamsMode enum.

type DismissInvoiceStripeRefundJSONBody added in v0.9.2

type DismissInvoiceStripeRefundJSONBody struct {
	// Note How the refund was handled. 1 to 1000 characters; leading and trailing spaces are removed.
	Note string `json:"note"`
}

DismissInvoiceStripeRefundJSONBody defines parameters for DismissInvoiceStripeRefund.

type DismissInvoiceStripeRefundJSONRequestBody added in v0.9.2

type DismissInvoiceStripeRefundJSONRequestBody DismissInvoiceStripeRefundJSONBody

DismissInvoiceStripeRefundJSONRequestBody defines body for DismissInvoiceStripeRefund for application/json ContentType.

type DismissInvoiceStripeRefundParams added in v0.9.2

type DismissInvoiceStripeRefundParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

DismissInvoiceStripeRefundParams defines parameters for DismissInvoiceStripeRefund.

type DisputeWebhookEventData

type DisputeWebhookEventData struct {
	// Dispute A card dispute (chargeback) Stripe reported against one of the
	// invoice's payments, recorded from Stripe's `charge.dispute.created`,
	// `.updated` and `.closed` webhook events. It holds the dispute as the
	// newest of those events showed it, whatever order they arrived in.
	// Hardcount records and reports a dispute, and nothing else: the invoice
	// stays paid and no money moves.
	Dispute InvoiceDispute `json:"dispute"`

	// Invoice A bill for one customer, in one currency. The billing engine creates
	// one at the end of each subscription period (and for a subscription's
	// start when a fee is billed in advance, a change, a cancel or a spend
	// threshold); you can also create one-off invoices with
	// `POST /v1/invoices`. The engine creates its invoices already
	// `finalized`, or as a `draft` while their tax is pending or collection
	// is paused on the subscription. An invoice you create starts as a
	// `draft` until you finalize it. A finalized invoice ends `paid`,
	// `voided` or `uncollectible`. Every amount is a whole number in the
	// currency's minor unit (cents for USD). The invoice routes and the
	// `invoice.*` and `payment.*` webhook events return it.
	Invoice Invoice `json:"invoice"`
}

DisputeWebhookEventData The `data` of the outbound webhook events `payment.dispute_opened` and `payment.dispute_closed` ([Webhook events](https://gethardcount.com/docs/api/webhook-events/)): the invoice the disputed payment paid and the dispute, each as the API returns it. The invoice leaves out `attention`, `recovery_warning`, `billing_period_display` and `test_clock_id`, which are worked out per read. Both events are saved in the same transaction that records the dispute, so a crash cannot drop them. `payment.dispute_opened` is sent once per dispute, when Hardcount first records it; if the first event Hardcount receives is already the close, both are sent, and both carry the closed status and `closed_at`. Their delivery order is not guaranteed. `payment.dispute_closed` is sent when the dispute reaches a closed status it did not have: `won`, `lost`, `warning_closed` or `prevented`. A lost dispute that Stripe later marks won sends it again.

type DocumentBillTo

type DocumentBillTo struct {
	// AddressLine1 First address line of the billing profile. Absent when none was set.
	AddressLine1 string `json:"address_line1,omitempty"`

	// AddressLine2 Second address line of the billing profile. Absent when none was set.
	AddressLine2 string `json:"address_line2,omitempty"`

	// City City of the billing profile. Absent when none was set.
	City string `json:"city,omitempty"`

	// Country Country of the billing profile, as a two-letter ISO 3166 code. Absent when none was set.
	Country string `json:"country,omitempty"`

	// DisplayName The customer's display name when the document was issued.
	DisplayName string `json:"display_name"`

	// Email The customer's email address. Absent when none was set.
	Email string `json:"email,omitempty"`

	// LegalName The billing profile's legal name. Absent when none was set.
	LegalName string `json:"legal_name,omitempty"`

	// PostalCode Postal code of the billing profile. Absent when none was set.
	PostalCode string `json:"postal_code,omitempty"`

	// State State or region of the billing profile. Absent when none was set.
	State string `json:"state,omitempty"`

	// TaxId On an invoice, the tax ID its tax was calculated with when set,
	// otherwise the billing profile's tax ID at issue. Absent when
	// there is none.
	TaxId string `json:"tax_id,omitempty"`

	// TaxIdType The kind of tax ID, as the billing profile stores it. Absent when none was set.
	TaxIdType string `json:"tax_id_type,omitempty"`
}

DocumentBillTo What an issued invoice or credit note prints about its buyer. It is copied from the customer and the billing profile when the document is issued, so a later edit to either does not change it. The printed name is `legal_name` when set, otherwise `display_name`.

type DocumentSupplier

type DocumentSupplier struct {
	// AddressLine1 First line of your company address.
	AddressLine1 string `json:"address_line1,omitempty"`

	// AddressLine2 Second line of your company address.
	AddressLine2 string `json:"address_line2,omitempty"`

	// City City of your company address.
	City string `json:"city,omitempty"`

	// Country Country of your company address.
	Country string `json:"country,omitempty"`

	// Email Your company's contact email.
	Email string `json:"email,omitempty"`

	// Name Your company name.
	Name string `json:"name,omitempty"`

	// Phone Your company's phone number.
	Phone string `json:"phone,omitempty"`

	// PostalCode Postal code of your company address.
	PostalCode string `json:"postal_code,omitempty"`

	// State State or region of your company address.
	State string `json:"state,omitempty"`

	// TaxId Your company's tax ID.
	TaxId string `json:"tax_id,omitempty"`
}

DocumentSupplier What an issued invoice or credit note prints about its seller: your company details from the account settings, copied when the document was issued. A later change to the settings does not change it. Every field is absent when the setting was empty.

type DunningPolicy

type DunningPolicy struct {
	// CreatedAt When the policy was created.
	CreatedAt time.Time `json:"created_at"`

	// Enabled Whether the policy starts dunning. A disabled policy starts no runs.
	Enabled bool `json:"enabled"`

	// FinalInvoiceAction What happens to the invoice when retries run out.
	FinalInvoiceAction DunningPolicyFinalInvoiceAction `json:"final_invoice_action"`

	// FinalSubscriptionAction What happens to the subscription when retries run out.
	FinalSubscriptionAction DunningPolicyFinalSubscriptionAction `json:"final_subscription_action"`

	// Id Unique identifier of the policy, starting `hc_dpol_`.
	Id string `json:"id"`

	// IsDefault Customers without an assigned policy use the default.
	IsDefault bool `json:"is_default"`

	// Name The policy's name. Can be empty.
	Name string `json:"name"`

	// RetryDays Days to wait before each retry; the number of retries is its length.
	RetryDays []int `json:"retry_days"`

	// Seeded True for the "Default retries" policy the account was created
	// with, until you edit it or make it the default. While it is
	// true, the next enabled policy you create becomes the default
	// instead. Set by the server: a request body that sends it is
	// refused with 422.
	Seeded bool `json:"seeded"`

	// TenantId The account the policy belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the policy last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

DunningPolicy A dunning policy: how failed or missing payments are retried, and what happens when the retries run out. Every account starts with one policy per mode, "Default retries" (retries on day 3, 7 and 14, then no final action), as the default. Customers without an assigned policy use the default.

type DunningPolicyFinalInvoiceAction

type DunningPolicyFinalInvoiceAction string

DunningPolicyFinalInvoiceAction What happens to the invoice when retries run out.

const (
	DunningPolicyFinalInvoiceActionMarkUncollectible DunningPolicyFinalInvoiceAction = "mark_uncollectible"
	DunningPolicyFinalInvoiceActionNone              DunningPolicyFinalInvoiceAction = "none"
)

Defines values for DunningPolicyFinalInvoiceAction.

func (DunningPolicyFinalInvoiceAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyFinalInvoiceAction enum.

type DunningPolicyFinalSubscriptionAction

type DunningPolicyFinalSubscriptionAction string

DunningPolicyFinalSubscriptionAction What happens to the subscription when retries run out.

const (
	DunningPolicyFinalSubscriptionActionCancel DunningPolicyFinalSubscriptionAction = "cancel"
	DunningPolicyFinalSubscriptionActionNone   DunningPolicyFinalSubscriptionAction = "none"
	DunningPolicyFinalSubscriptionActionPause  DunningPolicyFinalSubscriptionAction = "pause"
)

Defines values for DunningPolicyFinalSubscriptionAction.

func (DunningPolicyFinalSubscriptionAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyFinalSubscriptionAction enum.

type DunningPolicyInput

type DunningPolicyInput struct {
	// Enabled A disabled policy starts no dunning.
	Enabled bool `json:"enabled,omitempty"`

	// FinalInvoiceAction What happens to the invoice when retries run out.
	// `mark_uncollectible` writes it off as bad debt; `none` leaves it
	// open and due.
	FinalInvoiceAction DunningPolicyInputFinalInvoiceAction `json:"final_invoice_action,omitempty"`

	// FinalSubscriptionAction What happens to the subscription when retries run out. `pause`
	// pauses collection and sends `subscription.collection_paused`
	// with `triggered_by: dunning`. It does nothing if collection is
	// already paused, the subscription is canceled, or the invoice
	// was paid first. `cancel` cancels the subscription and sends
	// `subscription.canceled` with `canceled_by: dunning`. It does
	// nothing if the subscription is already canceled. If a scheduled
	// cancel was already due, that cancel happens instead, and its
	// event says `canceled_by: schedule`. `none` leaves it alone. An
	// invoice with no subscription is not affected.
	FinalSubscriptionAction DunningPolicyInputFinalSubscriptionAction `json:"final_subscription_action,omitempty"`

	// Name A name for the policy, up to 255 bytes (a character outside ASCII counts as more than one). Defaults to empty.
	Name string `json:"name,omitempty"`

	// RetryDays Days to wait before each retry. The first counts from the failed
	// payment or the collection that found no card. Each later one
	// counts from the retry before it: `[3, 4, 7]` retries on day 3, 7
	// and 14. The number of retries is the length of the list, 1 to
	// 15, and each wait is a whole number of days from 1 to 30. A day
	// is 24 hours. `retry_schedule`, `max_retry_attempts`,
	// `grace_period_days` and `final_action` are refused.
	RetryDays []int `json:"retry_days"`
}

DunningPolicyInput The body of `POST /v1/dunning/policies` and `PATCH /v1/dunning/policies/{id}`. A PATCH replaces every setting, so send the full policy. `id`, `tenant_id`, `is_default`, `seeded`, `created_at` and `updated_at` are set by the server; sending one is refused with 422.

type DunningPolicyInputFinalInvoiceAction

type DunningPolicyInputFinalInvoiceAction string

DunningPolicyInputFinalInvoiceAction What happens to the invoice when retries run out. `mark_uncollectible` writes it off as bad debt; `none` leaves it open and due.

const (
	DunningPolicyInputFinalInvoiceActionMarkUncollectible DunningPolicyInputFinalInvoiceAction = "mark_uncollectible"
	DunningPolicyInputFinalInvoiceActionNone              DunningPolicyInputFinalInvoiceAction = "none"
)

Defines values for DunningPolicyInputFinalInvoiceAction.

func (DunningPolicyInputFinalInvoiceAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyInputFinalInvoiceAction enum.

type DunningPolicyInputFinalSubscriptionAction

type DunningPolicyInputFinalSubscriptionAction string

DunningPolicyInputFinalSubscriptionAction What happens to the subscription when retries run out. `pause` pauses collection and sends `subscription.collection_paused` with `triggered_by: dunning`. It does nothing if collection is already paused, the subscription is canceled, or the invoice was paid first. `cancel` cancels the subscription and sends `subscription.canceled` with `canceled_by: dunning`. It does nothing if the subscription is already canceled. If a scheduled cancel was already due, that cancel happens instead, and its event says `canceled_by: schedule`. `none` leaves it alone. An invoice with no subscription is not affected.

const (
	DunningPolicyInputFinalSubscriptionActionCancel DunningPolicyInputFinalSubscriptionAction = "cancel"
	DunningPolicyInputFinalSubscriptionActionNone   DunningPolicyInputFinalSubscriptionAction = "none"
	DunningPolicyInputFinalSubscriptionActionPause  DunningPolicyInputFinalSubscriptionAction = "pause"
)

Defines values for DunningPolicyInputFinalSubscriptionAction.

func (DunningPolicyInputFinalSubscriptionAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyInputFinalSubscriptionAction enum.

type DunningPolicyListItem

type DunningPolicyListItem struct {
	// AssignedCustomers Customers explicitly assigned to this policy. Customers using it only as the default are not counted.
	AssignedCustomers int `json:"assigned_customers"`

	// CreatedAt When the policy was created.
	CreatedAt time.Time `json:"created_at"`

	// Enabled Whether the policy starts dunning. A disabled policy starts no runs.
	Enabled bool `json:"enabled"`

	// FinalInvoiceAction What happens to the invoice when retries run out.
	FinalInvoiceAction DunningPolicyListItemFinalInvoiceAction `json:"final_invoice_action"`

	// FinalSubscriptionAction What happens to the subscription when retries run out.
	FinalSubscriptionAction DunningPolicyListItemFinalSubscriptionAction `json:"final_subscription_action"`

	// Id Unique identifier of the policy, starting `hc_dpol_`.
	Id string `json:"id"`

	// IsDefault Customers without an assigned policy use the default.
	IsDefault bool `json:"is_default"`

	// Name The policy's name. Can be empty.
	Name string `json:"name"`

	// RetryDays Days to wait before each retry; the number of retries is its length.
	RetryDays []int `json:"retry_days"`

	// Seeded True for the "Default retries" policy the account was created
	// with, until you edit it or make it the default. While it is
	// true, the next enabled policy you create becomes the default
	// instead. Set by the server: a request body that sends it is
	// refused with 422.
	Seeded bool `json:"seeded"`

	// TenantId The account the policy belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the policy last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

DunningPolicyListItem defines model for DunningPolicyListItem.

type DunningPolicyListItemFinalInvoiceAction

type DunningPolicyListItemFinalInvoiceAction string

DunningPolicyListItemFinalInvoiceAction What happens to the invoice when retries run out.

const (
	DunningPolicyListItemFinalInvoiceActionMarkUncollectible DunningPolicyListItemFinalInvoiceAction = "mark_uncollectible"
	DunningPolicyListItemFinalInvoiceActionNone              DunningPolicyListItemFinalInvoiceAction = "none"
)

Defines values for DunningPolicyListItemFinalInvoiceAction.

func (DunningPolicyListItemFinalInvoiceAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyListItemFinalInvoiceAction enum.

type DunningPolicyListItemFinalSubscriptionAction

type DunningPolicyListItemFinalSubscriptionAction string

DunningPolicyListItemFinalSubscriptionAction What happens to the subscription when retries run out.

const (
	DunningPolicyListItemFinalSubscriptionActionCancel DunningPolicyListItemFinalSubscriptionAction = "cancel"
	DunningPolicyListItemFinalSubscriptionActionNone   DunningPolicyListItemFinalSubscriptionAction = "none"
	DunningPolicyListItemFinalSubscriptionActionPause  DunningPolicyListItemFinalSubscriptionAction = "pause"
)

Defines values for DunningPolicyListItemFinalSubscriptionAction.

func (DunningPolicyListItemFinalSubscriptionAction) Valid

Valid indicates whether the value is a known member of the DunningPolicyListItemFinalSubscriptionAction enum.

type DunningRun

type DunningRun struct {
	// AttemptCount How many retries have run so far.
	AttemptCount int `json:"attempt_count"`

	// CreatedAt When the run started: when the payment failed or the collection
	// found no card. For an invoice on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// CustomerId The invoice's customer. Absent when not recorded.
	CustomerId string `json:"customer_id,omitempty"`

	// EffectiveNow The test clock's current time, when the customer is on a test clock. Filled in on list responses.
	EffectiveNow time.Time `json:"effective_now,omitempty"`

	// Id Unique identifier of the run, starting `hc_drun_`.
	Id string `json:"id"`

	// InvoiceAmountDueCents What the invoice still owes, in the currency's minor unit (cents for USD). Filled in on list responses; absent when 0.
	InvoiceAmountDueCents int64 `json:"invoice_amount_due_cents,omitempty"`

	// InvoiceCurrency The invoice's currency. Filled in on list responses.
	InvoiceCurrency string `json:"invoice_currency,omitempty"`

	// InvoiceId The invoice the run collects.
	InvoiceId string `json:"invoice_id"`

	// InvoiceNumber The invoice's number. Filled in on list responses.
	InvoiceNumber string `json:"invoice_number,omitempty"`

	// LastAttemptAt When the last retry ran. Absent before the first retry.
	LastAttemptAt time.Time `json:"last_attempt_at,omitempty"`

	// MaxRetryAttempts How many retries the run's policy makes: the length of its
	// `retry_days`. Filled in on list responses.
	// When `attempt_count` has reached it, no charge is retried:
	// `next_action_at` is when the final action (pause, cancel or
	// mark uncollectible) runs.
	MaxRetryAttempts int `json:"max_retry_attempts,omitempty"`

	// NextActionAt When the run acts next: the next retry, or the final action once
	// the retries are used. Absent when the run has ended.
	NextActionAt time.Time `json:"next_action_at,omitempty"`

	// Paused True while the run is paused, so its retries are skipped. No API route pauses a run.
	Paused bool `json:"paused"`

	// PolicyId The dunning policy whose schedule and final action the run follows.
	PolicyId string `json:"policy_id"`

	// Reason Why the run started: `payment_failed` (a charge was declined or
	// refused) or `no_payment_method` (the customer had no card, so
	// nothing was charged). Absent when not recorded.
	Reason string `json:"reason,omitempty"`

	// Resolution How the run ended, set when it is resolved. Exception:
	// `action_failed` is set on a run that is still `active`. The
	// final action (pause, cancel or mark uncollectible) failed and
	// will be retried at `next_action_at`. `amount_below_minimum`: a
	// charge on the invoice was refused by Stripe because the amount is
	// below its minimum charge, so the run ended without its final
	// action. Absent while the run is active.
	Resolution DunningRunResolution `json:"resolution,omitempty"`

	// ResolvedAt When the run ended, resolved or escalated. Absent while it is active.
	ResolvedAt time.Time `json:"resolved_at,omitempty"`

	// State `active`: retries are running. `escalated`: retries ran out
	// (`resolution` is `retries_exhausted`). `resolved`: the run ended
	// another way; see `resolution`.
	State DunningRunState `json:"state"`

	// TenantId The account the run belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`

	// TestClockId The customer's test clock, when they are on one. Filled in on list responses.
	TestClockId string `json:"test_clock_id,omitempty"`

	// UpdatedAt When the run last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

DunningRun A dunning run: the payment retries for one unpaid invoice. Dunning is retrying a failed or missing payment on a schedule (the invoice's dunning policy), and running the policy's final action when the retries run out. Each invoice has at most one run.

type DunningRunDetail

type DunningRunDetail struct {
	// Degraded Sources that could not be read. `events`: the event history, so
	// `events` is empty. `invoice`: the run's invoice, so no event has
	// a `line`. The others leave the lines without what they would
	// add: `emails` the reminder and final-notice clauses,
	// `charge_attempts` the decline reason and amount, `audit` who
	// resolved the run.
	Degraded []DunningRunDetailDegraded `json:"degraded"`

	// Events The run's events, oldest first. Empty when the history could not be read (`degraded` names `events`).
	Events []DunningRunEvent `json:"events"`

	// Run A dunning run: the payment retries for one unpaid invoice. Dunning
	// is retrying a failed or missing payment on a schedule (the
	// invoice's dunning policy), and running the policy's final action
	// when the retries run out. Each invoice has at most one run.
	Run DunningRun `json:"run"`
}

DunningRunDetail What `GET /v1/dunning/runs/{id}` returns, the run and its event history.

type DunningRunDetailDegraded

type DunningRunDetailDegraded string

DunningRunDetailDegraded defines model for DunningRunDetail.Degraded.

const (
	DunningRunDetailDegradedAudit          DunningRunDetailDegraded = "audit"
	DunningRunDetailDegradedChargeAttempts DunningRunDetailDegraded = "charge_attempts"
	DunningRunDetailDegradedEmails         DunningRunDetailDegraded = "emails"
	DunningRunDetailDegradedEvents         DunningRunDetailDegraded = "events"
	DunningRunDetailDegradedInvoice        DunningRunDetailDegraded = "invoice"
)

Defines values for DunningRunDetailDegraded.

func (DunningRunDetailDegraded) Valid

func (e DunningRunDetailDegraded) Valid() bool

Valid indicates whether the value is a known member of the DunningRunDetailDegraded enum.

type DunningRunEvent

type DunningRunEvent struct {
	// AttemptCount The run's retry count at this event.
	AttemptCount int `json:"attempt_count"`

	// CreatedAt When the event happened. For an invoice on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// EventType `dunning_started`: the run began. `retry_attempted`: a retry ran
	// (or was skipped; see `reason`). `escalated`: the retries ran out
	// and the final action ran. `resolved`: the run ended.
	EventType DunningRunEventEventType `json:"event_type"`

	// Id Unique identifier of the event, starting `hc_devt_`.
	Id string `json:"id"`

	// InvoiceId The run's invoice.
	InvoiceId string `json:"invoice_id"`

	// Line The event in the words of the activity line: the line the
	// invoice's payment timeline shows for the same event, without
	// that timeline's folds. Absent when the run's invoice could not
	// be read (`degraded` names `invoice`).
	Line ActivityLine `json:"line,omitempty"`

	// Metadata Extra facts about the event, such as `payment_intent_id` on a retry that charged. Absent when empty.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// Reason Detail that depends on the event. On `dunning_started`, why the
	// run started (`payment_failed` or `no_payment_method`). On
	// `retry_attempted`, the outcome: `succeeded`, the decline text
	// (for example `payment failed: Your card has insufficient
	// funds.`), or a reason nothing was charged (`no_payment_method`,
	// `card_refused`, `needs_confirmation`, `amount_below_minimum`,
	// `payment_processing`). On `escalated`, what the final action did,
	// joined with `+` (`subscription_paused`, `subscription_canceled`,
	// `invoice_marked_uncollectible`), empty when it changed nothing. On
	// `resolved`, what ended the run, such as `payment_recovered` or
	// `invoice_voided`. Absent when empty.
	Reason string `json:"reason,omitempty"`

	// RecordedAt The real-world time the event was written. Absent on events written before releases recorded it.
	RecordedAt time.Time `json:"recorded_at,omitempty"`

	// RunId The run the event belongs to.
	RunId string `json:"run_id"`

	// State The run's state after this event.
	State DunningRunEventState `json:"state"`

	// TenantId The account the event belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`
}

DunningRunEvent One step in a dunning run's history, as `GET /v1/dunning/runs/{id}` returns it, oldest first.

type DunningRunEventEventType

type DunningRunEventEventType string

DunningRunEventEventType `dunning_started`: the run began. `retry_attempted`: a retry ran (or was skipped; see `reason`). `escalated`: the retries ran out and the final action ran. `resolved`: the run ended.

const (
	DunningRunEventEventTypeDunningStarted DunningRunEventEventType = "dunning_started"
	DunningRunEventEventTypeEscalated      DunningRunEventEventType = "escalated"
	DunningRunEventEventTypeResolved       DunningRunEventEventType = "resolved"
	DunningRunEventEventTypeRetryAttempted DunningRunEventEventType = "retry_attempted"
)

Defines values for DunningRunEventEventType.

func (DunningRunEventEventType) Valid

func (e DunningRunEventEventType) Valid() bool

Valid indicates whether the value is a known member of the DunningRunEventEventType enum.

type DunningRunEventState

type DunningRunEventState string

DunningRunEventState The run's state after this event.

const (
	DunningRunEventStateActive    DunningRunEventState = "active"
	DunningRunEventStateEscalated DunningRunEventState = "escalated"
	DunningRunEventStateResolved  DunningRunEventState = "resolved"
)

Defines values for DunningRunEventState.

func (DunningRunEventState) Valid

func (e DunningRunEventState) Valid() bool

Valid indicates whether the value is a known member of the DunningRunEventState enum.

type DunningRunResolution

type DunningRunResolution string

DunningRunResolution How the run ended, set when it is resolved. Exception: `action_failed` is set on a run that is still `active`. The final action (pause, cancel or mark uncollectible) failed and will be retried at `next_action_at`. `amount_below_minimum`: a charge on the invoice was refused by Stripe because the amount is below its minimum charge, so the run ended without its final action. Absent while the run is active.

const (
	DunningRunResolutionActionFailed          DunningRunResolution = "action_failed"
	DunningRunResolutionAmountBelowMinimum    DunningRunResolution = "amount_below_minimum"
	DunningRunResolutionInvoiceNotCollectible DunningRunResolution = "invoice_not_collectible"
	DunningRunResolutionInvoiceVoided         DunningRunResolution = "invoice_voided"
	DunningRunResolutionPaymentRecovered      DunningRunResolution = "payment_recovered"
	DunningRunResolutionRetriesExhausted      DunningRunResolution = "retries_exhausted"
)

Defines values for DunningRunResolution.

func (DunningRunResolution) Valid

func (e DunningRunResolution) Valid() bool

Valid indicates whether the value is a known member of the DunningRunResolution enum.

type DunningRunState

type DunningRunState string

DunningRunState `active`: retries are running. `escalated`: retries ran out (`resolution` is `retries_exhausted`). `resolved`: the run ended another way; see `resolution`.

const (
	DunningRunStateActive    DunningRunState = "active"
	DunningRunStateEscalated DunningRunState = "escalated"
	DunningRunStateResolved  DunningRunState = "resolved"
)

Defines values for DunningRunState.

func (DunningRunState) Valid

func (e DunningRunState) Valid() bool

Valid indicates whether the value is a known member of the DunningRunState enum.

type DunningStats

type DunningStats struct {
	// ActiveCount Runs in `active`, still retrying.
	ActiveCount int `json:"active_count"`

	// AtRiskByCurrency Amount due on active and escalated runs whose invoice is still
	// open, one entry per currency. `currency` comes first, then the
	// largest amount. Empty when no run is at risk.
	AtRiskByCurrency []struct {
		// AmountCents The amount at risk in this currency, in its minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// Currency The currency of this entry, uppercase.
		Currency string `json:"currency"`
	} `json:"at_risk_by_currency"`

	// AtRiskCents Amount due on active and escalated runs whose invoice is still open, in `currency` only, in its minor unit (cents for USD). A voided or written-off invoice is not at risk.
	AtRiskCents int64 `json:"at_risk_cents"`

	// Currency The account's default currency, the one `at_risk_cents` counts.
	Currency string `json:"currency"`

	// EscalatedCount Runs in `escalated`, whose retries ran out.
	EscalatedCount int `json:"escalated_count"`

	// RecoveredCount Resolved runs that a payment closed (`resolution` is `payment_recovered` and the invoice has `amount_paid_cents` above 0). A run closed by a credit note or customer credit that left nothing due is resolved, not recovered.
	RecoveredCount int `json:"recovered_count"`

	// ResolvedCount Resolved runs, whatever closed them (a payment, a void or a write-off).
	ResolvedCount int `json:"resolved_count"`
}

DunningStats What `GET /v1/dunning/stats` returns: dunning runs counted by state, and the amount still due on the open ones. It covers every run in this mode. Amounts are in the currency's minor unit (cents for USD).

type EndSubscriptionTrialParams

type EndSubscriptionTrialParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

EndSubscriptionTrialParams defines parameters for EndSubscriptionTrial.

type Error

type Error struct {
	// Error What went wrong.
	Error struct {
		// Code The exact reason, such as `validation_error`, `not_found`,
		// `already_exists`, `invalid_state` or a more specific code
		// the operation lists. Branch on this, not on `message`.
		Code string `json:"code"`

		// Message What went wrong, written for a person to read.
		Message string `json:"message"`

		// Param The request field or query parameter the error is about.
		// Sent only when the error names one.
		//
		// A request body may hold only the fields its operation
		// lists, spelled and cased as listed. Any other field, or one
		// the server sets (such as `id`), is refused with 422 and
		// `param` naming it. An operation with no request body lists
		// no fields: send no body, `{}` or `null`. The Stripe and
		// Postmark webhooks and the LiteLLM callback take their
		// sender's body as it comes.
		Param string `json:"param,omitempty"`

		// RequestId The id of the request that produced this answer
		// (`req_…`). It is normally the same value as the
		// `Hardcount-Request-Id` response header. On an answer
		// replayed for a repeated `Idempotency-Key`, the body is the
		// first request's, so this is the first request's id, while
		// the `Hardcount-Request-Id` header holds the new request's
		// id.
		RequestId string `json:"request_id"`

		// Type One of `invalid_request_error`, `authentication_error`,
		// `rate_limit_error` or `api_error`. Every error the API
		// answers has this shape, including an unknown path (404,
		// code `route_not_found`) and a method the path does not take
		// (405, code `method_not_allowed`, with an `Allow` header).
		// The few exceptions are listed in
		// [Errors](https://gethardcount.com/docs/api/errors/).
		Type string `json:"type"`
	} `json:"error,omitempty"`
}

Error The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type ExportAuditLogCsvParams

type ExportAuditLogCsvParams struct {
	// DateFrom Lower bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD`.
	DateFrom string `form:"date_from,omitempty" json:"date_from,omitempty"`

	// DateTo Upper bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD` (end of that day, UTC).
	DateTo string `form:"date_to,omitempty" json:"date_to,omitempty"`

	// ResourceType Only rows about this kind of resource, such as `invoice` or `api_key`.
	ResourceType string `form:"resource_type,omitempty" json:"resource_type,omitempty"`

	// ResourceId Only rows about this resource id.
	ResourceId string `form:"resource_id,omitempty" json:"resource_id,omitempty"`

	// Action Only rows with this action, such as `create` or `revoke`.
	Action string `form:"action,omitempty" json:"action,omitempty"`

	// ActorId Only rows by this actor (a user id or an API key id).
	ActorId string `form:"actor_id,omitempty" json:"actor_id,omitempty"`

	// TestClockId Only rows from this test clock's simulation.
	TestClockId string `form:"test_clock_id,omitempty" json:"test_clock_id,omitempty"`

	// SimFrom Lower bound on simulated time (sim_effective_at). RFC 3339 or `YYYY-MM-DD`.
	SimFrom string `form:"sim_from,omitempty" json:"sim_from,omitempty"`

	// SimTo Upper bound on simulated time (sim_effective_at). RFC 3339 or `YYYY-MM-DD`.
	SimTo string `form:"sim_to,omitempty" json:"sim_to,omitempty"`
}

ExportAuditLogCsvParams defines parameters for ExportAuditLogCsv.

type ExportCustomersCsvParams

type ExportCustomersCsvParams struct {
	// From Lower bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD`.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Upper bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD` (end of that day, UTC).
	To string `form:"to,omitempty" json:"to,omitempty"`
}

ExportCustomersCsvParams defines parameters for ExportCustomersCsv.

type ExportInvoicesCsvParams

type ExportInvoicesCsvParams struct {
	// From Lower bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD`.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Upper bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD` (end of that day, UTC).
	To string `form:"to,omitempty" json:"to,omitempty"`
}

ExportInvoicesCsvParams defines parameters for ExportInvoicesCsv.

type ExportSubscriptionsCsvParams

type ExportSubscriptionsCsvParams struct {
	// From Lower bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD`.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Upper bound on created_at, inclusive. RFC 3339 or `YYYY-MM-DD` (end of that day, UTC).
	To string `form:"to,omitempty" json:"to,omitempty"`
}

ExportSubscriptionsCsvParams defines parameters for ExportSubscriptionsCsv.

type ExportUsageEventsCsvParams

type ExportUsageEventsCsvParams struct {
	// From Lower bound on the event timestamp, inclusive. RFC 3339 or `YYYY-MM-DD`.
	From string `form:"from" json:"from"`

	// To Upper bound on the event timestamp, inclusive. RFC 3339 or `YYYY-MM-DD` (end of that day, UTC).
	To string `form:"to" json:"to"`

	// CustomerId Only this customer's events.
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// MeterId Only this meter's events.
	MeterId string `form:"meter_id,omitempty" json:"meter_id,omitempty"`

	// Dimensions Comma-separated key=value pairs, same syntax as `GET /v1/usage-events`.
	Dimensions string `form:"dimensions,omitempty" json:"dimensions,omitempty"`
}

ExportUsageEventsCsvParams defines parameters for ExportUsageEventsCsv.

type ExtendSubscriptionTrialJSONBody

type ExtendSubscriptionTrialJSONBody struct {
	// TrialEnd The new trial end. Must be in the future, after the current `trial_end_at`, and at most 730 days after `trial_start_at`.
	TrialEnd time.Time `json:"trial_end"`
}

ExtendSubscriptionTrialJSONBody defines parameters for ExtendSubscriptionTrial.

type ExtendSubscriptionTrialJSONRequestBody

type ExtendSubscriptionTrialJSONRequestBody ExtendSubscriptionTrialJSONBody

ExtendSubscriptionTrialJSONRequestBody defines body for ExtendSubscriptionTrial for application/json ContentType.

type ExtendSubscriptionTrialParams

type ExtendSubscriptionTrialParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ExtendSubscriptionTrialParams defines parameters for ExtendSubscriptionTrial.

type FinalizeInvoiceParams added in v0.9.2

type FinalizeInvoiceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

FinalizeInvoiceParams defines parameters for FinalizeInvoice.

type Forbidden added in v0.9.2

type Forbidden = Error

Forbidden The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type GetAnalyticsMrrMovementParams

type GetAnalyticsMrrMovementParams struct {
	// Period The window. Any other value is treated as `30d`. `12m` is 365 days.
	Period AnalyticsPeriod `form:"period,omitempty" json:"period,omitempty"`
}

GetAnalyticsMrrMovementParams defines parameters for GetAnalyticsMrrMovement.

type GetAnalyticsOverviewParams

type GetAnalyticsOverviewParams struct {
	// Period The window. Any other value is treated as `30d`. `12m` is 365 days.
	Period AnalyticsPeriod `form:"period,omitempty" json:"period,omitempty"`
}

GetAnalyticsOverviewParams defines parameters for GetAnalyticsOverview.

type GetAnalyticsRevenueChartParams

type GetAnalyticsRevenueChartParams struct {
	// Period The window. Any other value is treated as `30d`. `12m` is 365 days.
	Period AnalyticsPeriod `form:"period,omitempty" json:"period,omitempty"`
}

GetAnalyticsRevenueChartParams defines parameters for GetAnalyticsRevenueChart.

type GetAnalyticsUsageParams

type GetAnalyticsUsageParams struct {
	// Period The window. Any other value is treated as `30d`. `12m` is 365 days.
	Period AnalyticsPeriod `form:"period,omitempty" json:"period,omitempty"`
}

GetAnalyticsUsageParams defines parameters for GetAnalyticsUsage.

type GetCreditGrantsParams added in v0.9.2

type GetCreditGrantsParams struct {
	// IncludeExhausted `true` also lists the blocks with nothing left (used up,
	// expired, retired or deducted). Any other value leaves them out.
	IncludeExhausted bool `form:"include_exhausted,omitempty" json:"include_exhausted,omitempty"`
}

GetCreditGrantsParams defines parameters for GetCreditGrants.

type GetCustomerMarginParams added in v0.9.2

type GetCustomerMarginParams struct {
	// From Window start, inclusive. RFC 3339. Default is 30 days before the
	// customer's current time.
	From time.Time `form:"from,omitempty" json:"from,omitempty"`

	// To Window end, exclusive. RFC 3339. Default is the customer's current
	// time (test clock time for a customer on a test clock).
	To time.Time `form:"to,omitempty" json:"to,omitempty"`
}

GetCustomerMarginParams defines parameters for GetCustomerMargin.

type GetCustomerUsageParams

type GetCustomerUsageParams struct {
	// From Start of the window. An RFC 3339 instant, or `YYYY-MM-DD` for the
	// start of that day in UTC.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To End of the window, exclusive. An RFC 3339 instant, or `YYYY-MM-DD`
	// for 23:59:59.999999 UTC that day, so the day is included.
	To string `form:"to,omitempty" json:"to,omitempty"`
}

GetCustomerUsageParams defines parameters for GetCustomerUsage.

type GetEmailSettings200JSONResponseBodyLinksEnv

type GetEmailSettings200JSONResponseBodyLinksEnv string

GetEmailSettings200JSONResponseBodyLinksEnv defines parameters for GetEmailSettings.

const (
	DASHBOARDBASEURL     GetEmailSettings200JSONResponseBodyLinksEnv = "DASHBOARD_BASE_URL"
	HOSTEDINVOICEBASEURL GetEmailSettings200JSONResponseBodyLinksEnv = "HOSTED_INVOICE_BASE_URL"
	PAYMENTUPDATEURL     GetEmailSettings200JSONResponseBodyLinksEnv = "PAYMENT_UPDATE_URL"
)

Defines values for GetEmailSettings200JSONResponseBodyLinksEnv.

func (GetEmailSettings200JSONResponseBodyLinksEnv) Valid

Valid indicates whether the value is a known member of the GetEmailSettings200JSONResponseBodyLinksEnv enum.

type GetEmailSettings200JSONResponseBodyTlsMode

type GetEmailSettings200JSONResponseBodyTlsMode string

GetEmailSettings200JSONResponseBodyTlsMode defines parameters for GetEmailSettings.

Defines values for GetEmailSettings200JSONResponseBodyTlsMode.

func (GetEmailSettings200JSONResponseBodyTlsMode) Valid

Valid indicates whether the value is a known member of the GetEmailSettings200JSONResponseBodyTlsMode enum.

type GetHealth200JSONResponseBodyStatus

type GetHealth200JSONResponseBodyStatus string

GetHealth200JSONResponseBodyStatus defines parameters for GetHealth.

const (
	GetHealth200JSONResponseBodyStatusOk GetHealth200JSONResponseBodyStatus = "ok"
)

Defines values for GetHealth200JSONResponseBodyStatus.

func (GetHealth200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the GetHealth200JSONResponseBodyStatus enum.

type GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource added in v0.9.2

type GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource string

GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource defines parameters for GetPublicCostDashboard.

const (
	GetPublicCostDashboard200JSONResponseBodyBillingPeriodSourceNoSubscription GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource = "no_subscription"
	GetPublicCostDashboard200JSONResponseBodyBillingPeriodSourceSubscription   GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource = "subscription"
)

Defines values for GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource.

func (GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource) Valid added in v0.9.2

Valid indicates whether the value is a known member of the GetPublicCostDashboard200JSONResponseBodyBillingPeriodSource enum.

type GetWebhookEndpointStatsParams

type GetWebhookEndpointStatsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

GetWebhookEndpointStatsParams defines parameters for GetWebhookEndpointStats.

type GetWhoami200JSONResponseBodyKeyType added in v0.9.2

type GetWhoami200JSONResponseBodyKeyType string

GetWhoami200JSONResponseBodyKeyType defines parameters for GetWhoami.

const (
	Ingest GetWhoami200JSONResponseBodyKeyType = "ingest"
	Secret GetWhoami200JSONResponseBodyKeyType = "secret"
)

Defines values for GetWhoami200JSONResponseBodyKeyType.

func (GetWhoami200JSONResponseBodyKeyType) Valid added in v0.9.2

Valid indicates whether the value is a known member of the GetWhoami200JSONResponseBodyKeyType enum.

type GrantCreditsJSONBody added in v0.9.2

type GrantCreditsJSONBody struct {
	// AmountCents The credit to add, in the currency's minor unit (cents
	// for USD). From 1 to 100000000 (1,000,000.00).
	AmountCents int64 `json:"amount_cents"`

	// Currency ISO 4217 code of the credit. Required. Case-insensitive;
	// stored uppercase. Zero-decimal currencies (such as JPY)
	// are not supported yet.
	Currency string `json:"currency"`

	// CustomerId The customer to grant credit to (`hc_cus_…`).
	CustomerId string `json:"customer_id"`

	// Description What the credit is for, shown on the ledger entry.
	// Required: a grant without one, or with a blank one, is
	// refused with 422. At most 500 bytes after surrounding
	// spaces are trimmed (fewer characters when it has
	// non-ASCII letters).
	Description string `json:"description"`

	// ExpiresAt Optional expiry; must be in the future. Omitted = never
	// expires. The credit can be drawn up to and including this
	// instant; a period invoice draws it when its period ends
	// at or before it. The dashboard sends the local midnight
	// after the picked day.
	ExpiresAt time.Time `json:"expires_at,omitempty"`

	// GrantKind Optional cost-basis class. `promotional` marks free or
	// marketing credit, which invoices draw before any other
	// credit. Omitted means unclassified credit. `commit` is
	// refused here: commit credit comes only from finalizing a
	// commit invoice.
	GrantKind GrantCreditsJSONBodyGrantKind `json:"grant_kind,omitempty"`
}

GrantCreditsJSONBody defines parameters for GrantCredits.

type GrantCreditsJSONBodyGrantKind added in v0.9.2

type GrantCreditsJSONBodyGrantKind string

GrantCreditsJSONBodyGrantKind defines parameters for GrantCredits.

const (
	Promotional GrantCreditsJSONBodyGrantKind = "promotional"
)

Defines values for GrantCreditsJSONBodyGrantKind.

func (GrantCreditsJSONBodyGrantKind) Valid added in v0.9.2

Valid indicates whether the value is a known member of the GrantCreditsJSONBodyGrantKind enum.

type GrantCreditsJSONRequestBody added in v0.9.2

type GrantCreditsJSONRequestBody GrantCreditsJSONBody

GrantCreditsJSONRequestBody defines body for GrantCredits for application/json ContentType.

type GrantCreditsParams added in v0.9.2

type GrantCreditsParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

GrantCreditsParams defines parameters for GrantCredits.

type HeldUsageGroup

type HeldUsageGroup struct {
	// CustomerId The customer whose external ID now matches, or empty when none does yet.
	CustomerId string `json:"customer_id"`

	// EventName The `event_name` the rows carried.
	EventName string `json:"event_name"`

	// ExternalCustomerId The LiteLLM `user` value the rows carried.
	ExternalCustomerId string `json:"external_customer_id"`

	// FirstEventAt The earliest usage time among the rows.
	FirstEventAt time.Time `json:"first_event_at"`

	// LastEventAt The latest usage time among the rows.
	LastEventAt time.Time `json:"last_event_at"`

	// LastReceivedAt When Hardcount last received a row for this group.
	LastReceivedAt time.Time `json:"last_received_at"`

	// MeterExists Whether a meter with this `event_name` exists now.
	MeterExists bool `json:"meter_exists"`

	// Reason What was missing when the rows arrived.
	Reason HeldUsageGroupReason `json:"reason"`

	// Rows Number of rows held in the group.
	Rows int `json:"rows"`

	// TotalQuantity Sum of the held quantities, as a decimal string.
	TotalQuantity string `json:"total_quantity"`
}

HeldUsageGroup The usage rows still held for one external customer ID, event name and reason.

type HeldUsageGroupReason

type HeldUsageGroupReason string

HeldUsageGroupReason What was missing when the rows arrived.

const (
	CustomerNotFound HeldUsageGroupReason = "customer_not_found"
	MeterNotFound    HeldUsageGroupReason = "meter_not_found"
)

Defines values for HeldUsageGroupReason.

func (HeldUsageGroupReason) Valid

func (e HeldUsageGroupReason) Valid() bool

Valid indicates whether the value is a known member of the HeldUsageGroupReason enum.

type HeldUsageReleaseResult

type HeldUsageReleaseResult struct {
	// CustomerId The customer the rows were ingested for.
	CustomerId string `json:"customer_id"`

	// Deduplicated Rows that were already usage events under the same idempotency
	// key (LiteLLM resent the call after the customer existed), and
	// LiteLLM cache-write rows whose call is already billed with the
	// writes inside its input row. Marked released, not written again.
	Deduplicated int `json:"deduplicated"`

	// InOpenPeriod Released rows in a billing period not invoiced yet that a price
	// of its plan takes. Rows Hardcount does not check count here too:
	// rows after the current period's end, while the subscription
	// continues, and rows after a trial's end while the subscription
	// still trials. Rows of a sum or count meter stamped before the end
	// of this period's spend-threshold invoice are not counted here:
	// see `pending_threshold_invoice` and `outside_open_period`.
	InOpenPeriod int `json:"in_open_period"`

	// MoreToRelease Rows for this external ID still held only because one release
	// takes at most 5,000 rows. Release again to take them.
	MoreToRelease int `json:"more_to_release"`

	// NoPrice Released rows in a billing period not invoiced yet whose plan
	// prices the meter, but no price of that plan takes them (their
	// dimensions do not include any price's `dimension_match`).
	NoPrice int `json:"no_price"`

	// NotOnPlan Released rows in a billing period not invoiced yet whose plan
	// does not price the meter.
	NotOnPlan int `json:"not_on_plan"`

	// OutsideOpenPeriod Released rows outside every subscription's time (before it
	// started, in a free trial, after it ended or after its scheduled
	// cancel, or in another, ended subscription's time), and rows in a
	// period already invoiced. Also rows of a sum or count meter
	// stamped before the end of this period's paid spend-threshold
	// invoice. Bill them with a one-off invoice if they should be
	// charged.
	OutsideOpenPeriod int `json:"outside_open_period"`

	// PendingThresholdInvoice Released rows of a sum or count meter stamped before the end of
	// this period's spend-threshold invoice, while that invoice is not
	// paid. The period's invoice counts them only if that invoice is
	// voided before the period closes. A written-off invoice can still
	// be voided.
	PendingThresholdInvoice int `json:"pending_threshold_invoice"`

	// Released Rows newly written as usage events.
	Released int `json:"released"`

	// StillHeld Rows for this external ID still held that a release cannot take
	// yet: their meter does not exist yet, or their time is after the
	// customer's current time (a customer on a test clock).
	StillHeld int `json:"still_held"`
}

HeldUsageReleaseResult What `POST /v1/usage-events/held/release` did. The counts are what Hardcount found when the release wrote the rows, as for `billing_status` (see `UsageBillingStatus`). The invoice is the final answer.

type HostedInvoice

type HostedInvoice struct {
	// BillTo The buyer as the PDF prints it. Each field is absent when empty.
	BillTo struct {
		// AddressLine1 First address line.
		AddressLine1 string `json:"address_line1,omitempty"`

		// AddressLine2 Second address line.
		AddressLine2 string `json:"address_line2,omitempty"`

		// City City.
		City string `json:"city,omitempty"`

		// Country Country, as a two-letter code.
		Country string `json:"country,omitempty"`

		// Email The customer's email address.
		Email string `json:"email,omitempty"`

		// Name The billing profile's legal name, or the customer's display name when it has none.
		Name string `json:"name,omitempty"`

		// PostalCode Postal code.
		PostalCode string `json:"postal_code,omitempty"`

		// State State or region.
		State string `json:"state,omitempty"`
	} `json:"bill_to"`

	// Branding The seller's company details and branding. Each field is absent when empty.
	Branding struct {
		// BrandColor The seller's brand color, as the account settings store it (for example `#4F46E5`).
		BrandColor string `json:"brand_color,omitempty"`

		// CompanyAddressLine1 First line of the seller's address.
		CompanyAddressLine1 string `json:"company_address_line1,omitempty"`

		// CompanyAddressLine2 Second line of the seller's address.
		CompanyAddressLine2 string `json:"company_address_line2,omitempty"`

		// CompanyCity City of the seller's address.
		CompanyCity string `json:"company_city,omitempty"`

		// CompanyCountry Country of the seller's address.
		CompanyCountry string `json:"company_country,omitempty"`

		// CompanyEmail The seller's contact email.
		CompanyEmail string `json:"company_email,omitempty"`

		// CompanyName The seller's company name.
		CompanyName string `json:"company_name,omitempty"`

		// CompanyPhone The seller's phone number.
		CompanyPhone string `json:"company_phone,omitempty"`

		// CompanyPostalCode Postal code of the seller's address.
		CompanyPostalCode string `json:"company_postal_code,omitempty"`

		// CompanyState State or region of the seller's address.
		CompanyState string `json:"company_state,omitempty"`

		// LogoUrl The seller's logo, from the current account settings.
		LogoUrl string `json:"logo_url,omitempty"`

		// SupportUrl Where the customer can get help, from the current account settings.
		SupportUrl string `json:"support_url,omitempty"`
	} `json:"branding"`

	// CreditNotes The invoice's issued credit notes, as its PDF prints them, so
	// the total minus credit notes minus what was paid is the amount
	// due. One issued before payment lowered what is owed
	// (`before_payment`). One issued after payment is listed once a
	// part of it has settled, with what came back: a card refund once
	// Stripe confirmed it, credit added to the customer's balance, or
	// an amount settled another way. Empty when there are none.
	CreditNotes []struct {
		// AmountCents The credit note's total, in the currency's minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// BeforePayment True when the note was issued before payment and lowered what is owed.
		BeforePayment bool `json:"before_payment"`

		// CreditedCents For a note after payment, the credit added to the customer's balance. Absent when 0.
		CreditedCents int64 `json:"credited_cents,omitempty"`

		// Number The credit note's number, for example `CN-000003`.
		Number string `json:"number"`

		// RefundedCents For a note after payment, the card refund once Stripe confirmed it. Absent when 0.
		RefundedCents int64 `json:"refunded_cents,omitempty"`

		// SettledOutsideCents For a note after payment, the amount paid back another way. Absent when 0.
		SettledOutsideCents int64 `json:"settled_outside_cents,omitempty"`
	} `json:"credit_notes"`

	// Invoice The invoice's number, status, totals and dates.
	Invoice struct {
		// AmountDueCents What is still owed, in the currency's minor unit (cents for USD). 0 once paid.
		AmountDueCents int64 `json:"amount_due_cents"`

		// AmountPaidCents What was paid, in the currency's minor unit (cents for USD).
		AmountPaidCents int64 `json:"amount_paid_cents"`

		// BillingTimezone The time zone to show the dates in, so they match the PDF.
		BillingTimezone string `json:"billing_timezone,omitempty"`

		// CreditsAppliedCents Customer credit used to pay the invoice, in the currency's minor unit (cents for USD).
		CreditsAppliedCents int64 `json:"credits_applied_cents"`

		// Currency The invoice's currency, as an uppercase ISO 4217 code.
		Currency string `json:"currency"`

		// DiscountCents Discount taken off the subtotal, in the currency's minor unit (cents for USD).
		DiscountCents int64 `json:"discount_cents"`

		// DueAt When payment is due.
		DueAt time.Time `json:"due_at,omitempty"`

		// Footer The footer this invoice was issued with. Absent when there is none.
		Footer string `json:"footer,omitempty"`

		// InvoiceNumber The number printed on the invoice, for example `HC-000042`.
		InvoiceNumber string `json:"invoice_number"`

		// IssuedAt When the invoice was issued.
		IssuedAt time.Time `json:"issued_at,omitempty"`

		// Memo The invoice's note. Absent when empty.
		Memo string `json:"memo,omitempty"`

		// PaidAt When the invoice was paid. Absent until it is paid.
		PaidAt time.Time `json:"paid_at,omitempty"`

		// PaymentStatus The state of the invoice's payment.
		// - `pending`: nothing has been charged yet, or a charge is about to
		//   be sent. Also the status after Stripe refused the amount as below
		//   its minimum charge (see `amount_below_minimum`).
		// - `processing`: Stripe is still working on a charge.
		// - `succeeded`: the invoice is paid.
		// - `failed`: the last charge was declined or refused. Dunning, when
		//   a policy is on, retries it.
		// - `unknown`: a Stripe charge got an unclear answer (a 5xx, a timeout
		//   or a dropped connection), so Hardcount cannot tell whether Stripe
		//   took the money. With a payment intent recorded, Hardcount asks
		//   Stripe for it after a short wait. With none (a parked invoice),
		//   Hardcount lists the customer's payments at Stripe on every billing
		//   tick: it records a payment for the invoice that appears, and if
		//   none has appeared 24 hours after the attempt the invoice goes back
		//   to `pending` (`failed` after a dunning retry) and is charged again
		//   as usual.
		PaymentStatus InvoicePaymentStatus `json:"payment_status"`

		// Status Where the invoice is in its life.
		// - `draft`: not issued yet. Lines can still be added, and nothing is
		//   charged.
		// - `finalized`: issued and owed. Hardcount collects it.
		// - `paid`: settled, by card, credit, an offline payment or a credit
		//   note that left nothing due.
		// - `voided`: cancelled. Nothing is owed. Voiding is final.
		// - `uncollectible`: written off as bad debt, by you
		//   (`POST /v1/invoices/{id}/mark-uncollectible`) or by a dunning
		//   policy's final action. Hardcount stops collecting it, but it stays
		//   on the books and can still be paid.
		Status InvoiceStatus `json:"status"`

		// SubtotalCents The sum of the line amounts before discount and tax, in the currency's minor unit (cents for USD).
		SubtotalCents int64 `json:"subtotal_cents"`

		// TaxAmountCents Tax on the invoice, in the currency's minor unit (cents for USD).
		TaxAmountCents int64 `json:"tax_amount_cents"`

		// TaxExemptReason Why the customer is exempt from tax. Absent when they are not.
		TaxExemptReason string `json:"tax_exempt_reason,omitempty"`

		// TaxName The tax's label, such as `VAT`. Absent when there is none.
		TaxName string `json:"tax_name,omitempty"`

		// TaxRate Tax rate in percent, for example `18` for 18%.
		TaxRate float32 `json:"tax_rate"`

		// TaxReverseCharge True when reverse charge applies and the customer accounts for the tax. Absent when false.
		TaxReverseCharge bool `json:"tax_reverse_charge,omitempty"`

		// TotalAmountCents The invoice total with tax, in the currency's minor unit (cents for USD).
		TotalAmountCents int64 `json:"total_amount_cents"`

		// VoidedAt When the invoice was voided. Absent unless it is voided.
		VoidedAt time.Time `json:"voided_at,omitempty"`
	} `json:"invoice"`

	// LineItems The invoice's lines.
	LineItems []struct {
		// AmountCents The line's amount before tax, in the currency's minor unit (cents for USD).
		AmountCents int64 `json:"amount_cents"`

		// Currency The line's currency.
		Currency string `json:"currency"`

		// Description The line's text.
		Description string `json:"description"`

		// MeterUnit On a usage line, the meter's unit, such as `tokens`. Absent on other lines.
		MeterUnit string `json:"meter_unit,omitempty"`

		// Quantity The exact quantity as a decimal string, for example `3` or `1.5`.
		Quantity string `json:"quantity"`

		// TaxAmountCents Tax on the line, in the currency's minor unit (cents for USD). Absent when 0.
		TaxAmountCents int64 `json:"tax_amount_cents,omitempty"`

		// TotalAmountCents The line's amount plus its tax, in the currency's minor unit (cents for USD).
		TotalAmountCents int64 `json:"total_amount_cents"`

		// UnitAmountDecimal The unit price, a decimal string of cents at full precision, for example `0.3` for $0.003.
		UnitAmountDecimal string `json:"unit_amount_decimal"`
	} `json:"line_items"`

	// Livemode False for a test-mode invoice. The page shows a test-mode banner.
	Livemode bool `json:"livemode"`

	// PayEnabled True when the customer can pay online now: the invoice is
	// finalized, something is owed, no payment is in progress, the
	// seller has Stripe connected for the invoice's mode, and Stripe's
	// latest answer for the amount was not that it is below its
	// minimum charge.
	PayEnabled bool `json:"pay_enabled"`

	// PayUnavailableReason Sent only when money is owed but can't be paid online:
	// `online_payment_unavailable` when the seller has no payment
	// provider connected for this mode, `amount_below_minimum` when
	// Stripe's latest answer refused the amount as below its minimum
	// charge.
	PayUnavailableReason HostedInvoicePayUnavailableReason `json:"pay_unavailable_reason,omitempty"`
}

HostedInvoice What the hosted invoice page shows, from `GET /v1/public/invoices/{token}`. It leaves out internal ids and Stripe details. `bill_to` and the company details in `branding` come from the same place as the invoice PDF's: an issued invoice shows the details it was issued with. Amounts are whole numbers in the currency's minor unit (cents for USD).

type HostedInvoicePayUnavailableReason

type HostedInvoicePayUnavailableReason string

HostedInvoicePayUnavailableReason Sent only when money is owed but can't be paid online: `online_payment_unavailable` when the seller has no payment provider connected for this mode, `amount_below_minimum` when Stripe's latest answer refused the amount as below its minimum charge.

const (
	AmountBelowMinimum       HostedInvoicePayUnavailableReason = "amount_below_minimum"
	OnlinePaymentUnavailable HostedInvoicePayUnavailableReason = "online_payment_unavailable"
)

Defines values for HostedInvoicePayUnavailableReason.

func (HostedInvoicePayUnavailableReason) Valid

Valid indicates whether the value is a known member of the HostedInvoicePayUnavailableReason enum.

type IdempotencyKey

type IdempotencyKey = string

IdempotencyKey defines model for IdempotencyKey.

type IngestLitellmSpendJSONBody

type IngestLitellmSpendJSONBody struct {
	// contains filtered or unexported fields
}

IngestLitellmSpendJSONBody defines parameters for IngestLitellmSpend.

func (IngestLitellmSpendJSONBody) AsIngestLitellmSpendJSONBody1

func (t IngestLitellmSpendJSONBody) AsIngestLitellmSpendJSONBody1() (IngestLitellmSpendJSONBody1, error)

AsIngestLitellmSpendJSONBody1 returns the union data inside the IngestLitellmSpendJSONBody as a IngestLitellmSpendJSONBody1

func (IngestLitellmSpendJSONBody) AsIngestLitellmSpendJSONBody2

func (t IngestLitellmSpendJSONBody) AsIngestLitellmSpendJSONBody2() (IngestLitellmSpendJSONBody2, error)

AsIngestLitellmSpendJSONBody2 returns the union data inside the IngestLitellmSpendJSONBody as a IngestLitellmSpendJSONBody2

func (IngestLitellmSpendJSONBody) AsLitellmSpendLog

func (t IngestLitellmSpendJSONBody) AsLitellmSpendLog() (LitellmSpendLog, error)

AsLitellmSpendLog returns the union data inside the IngestLitellmSpendJSONBody as a LitellmSpendLog

func (*IngestLitellmSpendJSONBody) FromIngestLitellmSpendJSONBody1

func (t *IngestLitellmSpendJSONBody) FromIngestLitellmSpendJSONBody1(v IngestLitellmSpendJSONBody1) error

FromIngestLitellmSpendJSONBody1 overwrites any union data inside the IngestLitellmSpendJSONBody as the provided IngestLitellmSpendJSONBody1

func (*IngestLitellmSpendJSONBody) FromIngestLitellmSpendJSONBody2

func (t *IngestLitellmSpendJSONBody) FromIngestLitellmSpendJSONBody2(v IngestLitellmSpendJSONBody2) error

FromIngestLitellmSpendJSONBody2 overwrites any union data inside the IngestLitellmSpendJSONBody as the provided IngestLitellmSpendJSONBody2

func (*IngestLitellmSpendJSONBody) FromLitellmSpendLog

func (t *IngestLitellmSpendJSONBody) FromLitellmSpendLog(v LitellmSpendLog) error

FromLitellmSpendLog overwrites any union data inside the IngestLitellmSpendJSONBody as the provided LitellmSpendLog

func (IngestLitellmSpendJSONBody) MarshalJSON

func (t IngestLitellmSpendJSONBody) MarshalJSON() ([]byte, error)

func (*IngestLitellmSpendJSONBody) MergeIngestLitellmSpendJSONBody1

func (t *IngestLitellmSpendJSONBody) MergeIngestLitellmSpendJSONBody1(v IngestLitellmSpendJSONBody1) error

MergeIngestLitellmSpendJSONBody1 performs a merge with any union data inside the IngestLitellmSpendJSONBody, using the provided IngestLitellmSpendJSONBody1

func (*IngestLitellmSpendJSONBody) MergeIngestLitellmSpendJSONBody2

func (t *IngestLitellmSpendJSONBody) MergeIngestLitellmSpendJSONBody2(v IngestLitellmSpendJSONBody2) error

MergeIngestLitellmSpendJSONBody2 performs a merge with any union data inside the IngestLitellmSpendJSONBody, using the provided IngestLitellmSpendJSONBody2

func (*IngestLitellmSpendJSONBody) MergeLitellmSpendLog

func (t *IngestLitellmSpendJSONBody) MergeLitellmSpendLog(v LitellmSpendLog) error

MergeLitellmSpendLog performs a merge with any union data inside the IngestLitellmSpendJSONBody, using the provided LitellmSpendLog

func (*IngestLitellmSpendJSONBody) UnmarshalJSON

func (t *IngestLitellmSpendJSONBody) UnmarshalJSON(b []byte) error

type IngestLitellmSpendJSONBody1

type IngestLitellmSpendJSONBody1 = []LitellmSpendLog

IngestLitellmSpendJSONBody1 defines parameters for IngestLitellmSpend.

type IngestLitellmSpendJSONBody2

type IngestLitellmSpendJSONBody2 struct {
	Events []LitellmSpendLog `json:"events"`
}

IngestLitellmSpendJSONBody2 defines parameters for IngestLitellmSpend.

type IngestLitellmSpendJSONRequestBody

type IngestLitellmSpendJSONRequestBody IngestLitellmSpendJSONBody

IngestLitellmSpendJSONRequestBody defines body for IngestLitellmSpend for application/json ContentType.

type InstantiateRecipeJSONBody

type InstantiateRecipeJSONBody struct {
	// Overrides Values for the recipe's `overridable` keys, such as
	// `{"currency": "EUR"}`. A key the recipe does not list, or
	// a value that breaks the key's rules, is refused with 422.
	// Keys you leave out take their defaults.
	Overrides map[string]interface{} `json:"overrides,omitempty"`
}

InstantiateRecipeJSONBody defines parameters for InstantiateRecipe.

type InstantiateRecipeJSONRequestBody

type InstantiateRecipeJSONRequestBody InstantiateRecipeJSONBody

InstantiateRecipeJSONRequestBody defines body for InstantiateRecipe for application/json ContentType.

type InstantiateRecipeParams

type InstantiateRecipeParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

InstantiateRecipeParams defines parameters for InstantiateRecipe.

type InvalidBody added in v0.9.2

type InvalidBody = Error

InvalidBody The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type InvalidPage

type InvalidPage = Error

InvalidPage The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type InviteMemberJSONBody

type InviteMemberJSONBody struct {
	// Email The teammate's email, one plain address. It is stored in lower case.
	Email openapi_types.Email `json:"email"`
}

InviteMemberJSONBody defines parameters for InviteMember.

type InviteMemberJSONRequestBody

type InviteMemberJSONRequestBody InviteMemberJSONBody

InviteMemberJSONRequestBody defines body for InviteMember for application/json ContentType.

type InviteMemberParams

type InviteMemberParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

InviteMemberParams defines parameters for InviteMember.

type Invoice

type Invoice struct {
	// AmountDueCents What the customer still owes, in the currency's minor unit (cents
	// for USD): the total, less customer credit applied
	// (`credits_applied_cents`), credit notes issued before payment,
	// and payments. It becomes 0 when the invoice is paid. A voided or
	// written-off invoice keeps the amount that was due.
	AmountDueCents int64 `json:"amount_due_cents"`

	// AmountPaidCents What was paid by card or recorded as an offline payment, in the
	// currency's minor unit (cents for USD). Set when the invoice is
	// paid, to the amount that was due then; 0 before. Credit applied
	// is counted in `credits_applied_cents`, not here.
	AmountPaidCents int64 `json:"amount_paid_cents"`

	// Attention Why an invoice needs your attention now, and what to do about it.
	// Hardcount works it out each time the invoice is read, from the
	// invoice's tax and payment state and related facts (the customer's
	// card, the dunning run, disputes, refunds made in Stripe); it is never
	// stored. The invoice
	// leaves it out when nothing needs attention. `GET /v1/invoices`,
	// `GET /v1/invoices/{id}` and the finalize, retry-tax and
	// rotate-public-token responses carry it; the other invoice responses
	// and the webhook events do not.
	Attention Attention `json:"attention,omitempty"`

	// AutoChargePending True while the invoice is queued for the automatic charge, which
	// applies credit and charges the saved card. Absent when false.
	AutoChargePending bool `json:"auto_charge_pending,omitempty"`

	// BillToSnapshot The buyer details this invoice was issued with, copied when it
	// was finalized (or created already finalized). The PDF, the
	// hosted page and the dashboard show an issued invoice from this
	// copy, so a later edit to the customer or billing profile does not
	// change it. Absent on drafts and on invoices issued before this
	// field existed; those show the current customer details.
	BillToSnapshot DocumentBillTo `json:"bill_to_snapshot,omitempty"`

	// BillingPeriodDisplay The period as people read it, with its last day included, in `billing_timezone`: for example "Oct 1, 2026 – Oct 31, 2026". `billing_period_start` and `billing_period_end` stay the exact boundaries. Worked out when the invoice is read, so it comes with the same responses as `attention`. Absent when the period starts and ends at the same instant.
	BillingPeriodDisplay string `json:"billing_period_display,omitempty"`

	// BillingPeriodEnd End of the period the invoice bills (not included): the next
	// period's start. On a one-off invoice created without a period,
	// the time it was created.
	BillingPeriodEnd time.Time `json:"billing_period_end"`

	// BillingPeriodStart Start of the period the invoice bills (included). On a one-off
	// invoice created without a period, the time it was created.
	BillingPeriodStart time.Time `json:"billing_period_start"`

	// BillingReason Why the invoice was made, like Stripe's `invoice.billing_reason`.
	// Set when the invoice is created and never changed.
	// - `subscription_cycle`: the invoice for a subscription period that
	//   ended (a renewal).
	// - `subscription_create`: the first invoice when a subscription
	//   starts or its trial ends, for the fees its plans bill in advance.
	//   A subscription billed only in arrears has none.
	// - `subscription_cancel`: the final invoice when a subscription is
	//   canceled at once in the middle of a period.
	// - `subscription_update`: the invoice for a change in the middle of a
	//   period, such as a plan upgrade, a quantity increase or an added
	//   item.
	// - `manual`: an invoice you created with `POST /v1/invoices`.
	// - `threshold`: an early invoice because a spend threshold was
	//   crossed.
	BillingReason InvoiceBillingReason `json:"billing_reason,omitempty"`

	// BillingTimezone The IANA time zone the period boundaries are in: the account's billing time zone, copied onto the invoice when it was created. `billing_period_display`, the PDF and the hosted page show dates in it, so an issued invoice's dates stay the same if the account later changes its time zone. Absent only on invoices created before releases recorded it.
	BillingTimezone string `json:"billing_timezone,omitempty"`

	// CreatedAt When the invoice was created. For a customer on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// CreditsAppliedCents How much of the customer's credit balance paid this invoice, in
	// the currency's minor unit (cents for USD). Credit is applied when
	// the invoice is collected (after finalize, or by
	// `POST /v1/invoices/{id}/collect`). A void gives it back to the
	// customer's balance, and a credit note issued before payment can
	// give part of it back, lowering this figure.
	CreditsAppliedCents int64 `json:"credits_applied_cents"`

	// Currency The invoice's currency, as an uppercase ISO 4217 code. Every
	// amount on the invoice and its lines is in this currency's minor
	// unit.
	Currency string `json:"currency"`

	// CustomerId The customer the invoice bills.
	CustomerId string `json:"customer_id"`

	// DiscountCents Discount taken off the subtotal, in the currency's minor unit (cents for USD). 0 when there is none.
	DiscountCents int64 `json:"discount_cents"`

	// DueAt When payment is due: `issued_at` plus `net_payment_term_days`
	// calendar days, counted in `billing_timezone`. Set with
	// `issued_at`. Hardcount does not charge on this date: it collects
	// right after finalize and retries on the dunning schedule. The
	// `overdue` filter of `GET /v1/invoices` uses it.
	DueAt time.Time `json:"due_at,omitempty"`

	// Footer The account's invoice footer as it was when this invoice was
	// issued. Printed on the PDF and the hosted invoice page. Absent on
	// a draft and when no footer was set.
	Footer string `json:"footer,omitempty"`

	// Id Unique identifier of the invoice, starting `hc_inv_`.
	Id string `json:"id"`

	// InvoiceEmailedAt When Hardcount itself emailed the customer this invoice, because
	// Stripe is not connected for the invoice's mode. The email is sent
	// once. An invoice you email with `POST /v1/invoices/{id}/send`
	// does not set it. Absent until then.
	InvoiceEmailedAt time.Time `json:"invoice_emailed_at,omitempty"`

	// InvoiceNumber The number printed on the invoice: the account's invoice prefix
	// (default `HC`), a hyphen and a sequence padded to six digits, for
	// example `HC-000042`. Test mode and live mode count separately.
	// Set when the invoice is created, drafts included.
	InvoiceNumber string `json:"invoice_number"`

	// IsSimulated True when the invoice's dates (created, issued, due, paid) are
	// on a test clock's time instead of the real time. Recorded when
	// the invoice is written: for a cycle invoice, its subscription is
	// on a test clock; for one you create, its customer is. Always
	// false in live mode.
	IsSimulated bool `json:"is_simulated"`

	// IssuedAt When the invoice was issued. Every invoice gets one when it is
	// created, drafts included. An invoice you create with
	// `POST /v1/invoices` gets a new one when it is finalized.
	IssuedAt time.Time `json:"issued_at,omitempty"`

	// LastPaymentError The error text recorded with the invoice's last charge attempt
	// that did not succeed. Usually Stripe's message, which is written
	// for the cardholder, with card numbers and email addresses masked.
	// It can also be Hardcount's own text, such as `customer has no
	// payment method on file`. Absent when there is none.
	LastPaymentError string `json:"last_payment_error,omitempty"`

	// Memo A note you set when creating the invoice, printed on the PDF and the hosted page. Absent when empty.
	Memo string `json:"memo,omitempty"`

	// Metadata Extra key-value data stored with the invoice. No API request sets it; it is absent when empty.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// NetPaymentTermDays Days from `issued_at` to `due_at`. 0 means due on receipt.
	NetPaymentTermDays int `json:"net_payment_term_days"`

	// NoPmNotifiedAt When Hardcount automatically queued an email to the customer with
	// a link to add a payment method for this invoice. It is queued
	// once, when Stripe is connected, the customer has an email address
	// and the server's `PAYMENT_UPDATE_URL` is set; it reaches the
	// customer only when the server can send email.
	// `POST /v1/invoices/{id}/resend-setup-link` sends it again and does
	// not change this time. Absent until the automatic email is queued.
	NoPmNotifiedAt time.Time `json:"no_pm_notified_at,omitempty"`

	// PaidAt When the invoice was paid. Absent until it is paid.
	PaidAt time.Time `json:"paid_at,omitempty"`

	// PaidOutOfBand True when the payment was recorded as made outside Hardcount, such as
	// a bank transfer or cheque (`POST /v1/invoices/{id}/record-payment`,
	// or a dunning run resolved as `payment_recovered`). Such
	// an invoice has no `stripe_payment_intent_id`, so there is no card
	// to refund.
	PaidOutOfBand bool `json:"paid_out_of_band"`

	// PaymentAnomalyCapturedCents The amount Stripe took in that unexpected payment, in the currency's minor unit (cents for USD). Absent when there is none.
	PaymentAnomalyCapturedCents int64 `json:"payment_anomaly_captured_cents,omitempty"`

	// PaymentAnomalyKind Set when a payment arrived that the invoice did not expect. The
	// webhook event name of the cause: `payment.duplicate_charge`,
	// `payment.amount_mismatch`, `payment.currency_mismatch` or
	// `payment.received_on_voided_invoice`.
	// Only the latest one is kept. Absent when there is none.
	PaymentAnomalyKind string `json:"payment_anomaly_kind,omitempty"`

	// PaymentAnomalyPaymentIntentId The Stripe PaymentIntent of that unexpected payment. Absent when there is none.
	PaymentAnomalyPaymentIntentId string `json:"payment_anomaly_payment_intent_id,omitempty"`

	// PaymentCardBrand Brand of the saved card that paid the invoice, as Stripe names it (for example `visa`). Absent when the card is unknown.
	PaymentCardBrand string `json:"payment_card_brand,omitempty"`

	// PaymentCardLast4 Last four digits of the saved card that paid the invoice. Absent when the card is unknown.
	PaymentCardLast4 string `json:"payment_card_last4,omitempty"`

	// PaymentStatus The state of the invoice's payment.
	// - `pending`: nothing has been charged yet, or a charge is about to
	//   be sent. Also the status after Stripe refused the amount as below
	//   its minimum charge (see `amount_below_minimum`).
	// - `processing`: Stripe is still working on a charge.
	// - `succeeded`: the invoice is paid.
	// - `failed`: the last charge was declined or refused. Dunning, when
	//   a policy is on, retries it.
	// - `unknown`: a Stripe charge got an unclear answer (a 5xx, a timeout
	//   or a dropped connection), so Hardcount cannot tell whether Stripe
	//   took the money. With a payment intent recorded, Hardcount asks
	//   Stripe for it after a short wait. With none (a parked invoice),
	//   Hardcount lists the customer's payments at Stripe on every billing
	//   tick: it records a payment for the invoice that appears, and if
	//   none has appeared 24 hours after the attempt the invoice goes back
	//   to `pending` (`failed` after a dunning retry) and is charged again
	//   as usual.
	PaymentStatus InvoicePaymentStatus `json:"payment_status"`

	// ProviderPaymentStatus Stripe's PaymentIntent status the last time Hardcount checked it,
	// word for word. For information only: `payment_status` is the
	// invoice's payment state. Absent until Hardcount has checked. An
	// invoice checked by the Stripe Search sweep of earlier releases
	// may still show `search_not_found`, `search_terminal_only` or
	// `search_error`.
	ProviderPaymentStatus string `json:"provider_payment_status,omitempty"`

	// ProviderSyncedAt When Hardcount last asked Stripe about this invoice's payment, whether
	// or not Stripe answered: a read of `provider_payment_status`, or a
	// check of a charge whose result was lost. Absent until then.
	ProviderSyncedAt time.Time `json:"provider_synced_at,omitempty"`

	// PublicToken The token in the hosted invoice page's link, like Stripe's
	// `hosted_invoice_url`; `GET /v1/public/invoices/{token}` serves
	// the page's data. Anyone with it can view and pay the invoice, so
	// share it only with the customer. Created when the invoice is
	// finalized, or created already finalized; absent on drafts.
	// Replace it with
	// `POST /v1/invoices/{id}/rotate-public-token`.
	PublicToken string `json:"public_token,omitempty"`

	// RecoveryWarning What you should know before you record an offline payment on a
	// written-off invoice: a consequence that will not reconcile on
	// its own, never a refusal. Sent only on `uncollectible` invoices,
	// by the same responses that carry `attention`. Absent when there
	// is nothing to say.
	RecoveryWarning RecoveryWarning `json:"recovery_warning,omitempty"`

	// SourceChangeType The kind of subscription item change that produced a proration:
	// `plan` (the item moved to another plan), `quantity` (its quantity
	// changed), `add` (the item was added) or `remove` (the item was
	// removed). On a credit ledger entry (`source_change_type`) it is
	// never sent in this version.
	SourceChangeType ItemChangeType `json:"source_change_type,omitempty"`

	// SourcePlanChangedAt On an invoice for a change in the middle of a period
	// (`billing_reason` `subscription_update`), when the change took
	// effect. Absent on other invoices.
	SourcePlanChangedAt time.Time `json:"source_plan_changed_at,omitempty"`

	// SourceSubscriptionItemId On an invoice for a change in the middle of a period, the subscription item that changed. Absent on other invoices.
	SourceSubscriptionItemId string `json:"source_subscription_item_id,omitempty"`

	// Status Where the invoice is in its life.
	// - `draft`: not issued yet. Lines can still be added, and nothing is
	//   charged.
	// - `finalized`: issued and owed. Hardcount collects it.
	// - `paid`: settled, by card, credit, an offline payment or a credit
	//   note that left nothing due.
	// - `voided`: cancelled. Nothing is owed. Voiding is final.
	// - `uncollectible`: written off as bad debt, by you
	//   (`POST /v1/invoices/{id}/mark-uncollectible`) or by a dunning
	//   policy's final action. Hardcount stops collecting it, but it stays
	//   on the books and can still be paid.
	Status InvoiceStatus `json:"status"`

	// StripePaymentIntentId The Stripe PaymentIntent of the card charge that paid the
	// invoice, or of its last charge that is in progress or failed. It
	// can be absent after a charge was sent: for example when the
	// invoice was then paid without a card (by credits, with nothing
	// due, or outside Hardcount: `paid_out_of_band`), or when Stripe
	// refused the last charge as below its minimum.
	StripePaymentIntentId string `json:"stripe_payment_intent_id,omitempty"`

	// SubscriptionId The subscription the invoice bills. An empty string when the
	// invoice bills no subscription. An invoice you create with
	// `POST /v1/invoices` carries the `subscription_id` you sent.
	SubscriptionId string `json:"subscription_id"`

	// SubtotalCents The sum of the line amounts, before discount and tax, in the
	// currency's minor unit (cents for USD). With tax-inclusive
	// prices, it is the net amount after the tax is taken out.
	SubtotalCents int64 `json:"subtotal_cents"`

	// SupplierSnapshot Your company details this invoice was issued with, copied when it
	// was finalized (or created already finalized). Absent on drafts
	// and on invoices issued before this field existed. Branding (logo,
	// brand color) is not part of it.
	SupplierSnapshot DocumentSupplier `json:"supplier_snapshot,omitempty"`

	// TaxAmountCents Tax on the invoice, in the currency's minor unit (cents for USD).
	// On an invoice you create with `POST /v1/invoices`, it is 0 until
	// finalize calculates the tax.
	TaxAmountCents int64 `json:"tax_amount_cents"`

	// TaxCalculationId The tax provider's calculation reference (Stripe Tax only). A
	// Stripe Tax calculation expires after 24 hours; Hardcount keeps
	// the reference so a finalized invoice can still be traced.
	// Absent for the manual and none providers.
	TaxCalculationId string `json:"tax_calculation_id,omitempty"`

	// TaxCountry The country the tax was calculated for. Absent when none was recorded.
	TaxCountry string `json:"tax_country,omitempty"`

	// TaxDeferredAt When the tax calculation failed and the invoice was held as a
	// draft. A later successful calculation clears it. Absent unless
	// tax is deferred.
	TaxDeferredAt time.Time `json:"tax_deferred_at,omitempty"`

	// TaxErrorCode Why tax could not be calculated, as a code. Set while
	// `tax_status` is `pending`; `tax_pending_reason` has the
	// detail.
	TaxErrorCode InvoiceTaxErrorCode `json:"tax_error_code,omitempty"`

	// TaxExemptReason Why the customer is exempt from tax, as recorded on the customer. Absent when they are not exempt.
	TaxExemptReason string `json:"tax_exempt_reason,omitempty"`

	// TaxId The customer's tax ID the tax was calculated with. Absent when there was none.
	TaxId string `json:"tax_id,omitempty"`

	// TaxName The tax's label, such as `VAT` or `Sales Tax`. Absent when there is none.
	TaxName string `json:"tax_name,omitempty"`

	// TaxNextRetryAt The earliest time the background retry may calculate tax again,
	// after a failed attempt. Absent when a retry may run now, and when
	// none is scheduled: an error code Hardcount does not retry, or the
	// automatic retries are used up.
	TaxNextRetryAt time.Time `json:"tax_next_retry_at,omitempty"`

	// TaxPendingReason Why tax could not be calculated, while `tax_status` is `pending`:
	// the provider's error, or Hardcount's own text when the provider
	// was never called (`tax_error_code` `provider_not_configured`).
	// Cut to 500 bytes. Absent otherwise.
	TaxPendingReason string `json:"tax_pending_reason,omitempty"`

	// TaxProvider The tax engine that calculated the tax: `stripe_tax`, `manual` (a
	// flat rate from the account settings) or `none`. A draft's tax can
	// be calculated again (retry-tax, or finalize of a one-off draft);
	// once the invoice is finalized it no longer changes. Absent until
	// tax is calculated.
	TaxProvider string `json:"tax_provider,omitempty"`

	// TaxRate Tax rate as a percent, up to four decimal places (18.5 means 18.5%).
	TaxRate float64 `json:"tax_rate"`

	// TaxRetryCount How many times tax was calculated again while it was pending:
	// each `POST /v1/invoices/{id}/retry-tax` on pending tax, each
	// automatic retry, and each finalize of a one-off draft whose
	// earlier calculation failed. Absent when 0.
	TaxRetryCount int `json:"tax_retry_count,omitempty"`

	// TaxReverseCharge True when reverse charge applies: no tax is charged and the
	// customer accounts for it. Absent when false.
	TaxReverseCharge bool `json:"tax_reverse_charge,omitempty"`

	// TaxReversedAt When the provider's tax transaction was reversed after a void,
	// or found to need no reversal. Absent while the reversal is not
	// confirmed.
	TaxReversedAt time.Time `json:"tax_reversed_at,omitempty"`

	// TaxStatus Whether tax has been calculated. `ok`: it has (a zero tax counts).
	// `pending`: the calculation failed, and `tax_error_code` says why and
	// whether Hardcount retries it. A pending invoice stays a draft and
	// cannot be finalized, so a wrong tax amount is never sent.
	TaxStatus InvoiceTaxStatus `json:"tax_status,omitempty"`

	// TaxTransactionId The tax provider's committed transaction (Stripe Tax only). On an
	// invoice the billing engine creates, it is recorded when the
	// invoice is built; on one you create, at finalize. When that first
	// commit fails, a background retry records it later. Hardcount
	// reverses it when the invoice is voided or a credit note is
	// issued. Absent until committed, and for providers that keep no
	// record.
	TaxTransactionId string `json:"tax_transaction_id,omitempty"`

	// TenantId The account the invoice belongs to. Your API key already decides
	// the account, so you rarely need it.
	TenantId string `json:"tenant_id,omitempty"`

	// TestClockId The test clock this invoice's dates follow: the clock its customer
	// is pinned to, for cycle and one-off invoices alike. Read from the
	// customer on `GET /v1/invoices` and `GET /v1/invoices/{id}`; other
	// responses may leave it out. Left out for a customer on wall-clock
	// time, and always in live mode.
	TestClockId string `json:"test_clock_id,omitempty"`

	// TotalAmountCents The invoice total: `subtotal_cents` minus `discount_cents` plus
	// `tax_amount_cents`, in the currency's minor unit (cents for USD).
	// It is what the invoice charges before credit and payments, and it
	// does not change when the invoice is paid.
	TotalAmountCents int64 `json:"total_amount_cents"`

	// UncollectibleAt When the invoice was written off as uncollectible. Absent unless it was.
	UncollectibleAt time.Time `json:"uncollectible_at,omitempty"`

	// UpdatedAt When the invoice last changed.
	UpdatedAt time.Time `json:"updated_at"`

	// VoidedAt When the invoice was voided. Absent unless it is voided.
	VoidedAt time.Time `json:"voided_at,omitempty"`
}

Invoice A bill for one customer, in one currency. The billing engine creates one at the end of each subscription period (and for a subscription's start when a fee is billed in advance, a change, a cancel or a spend threshold); you can also create one-off invoices with `POST /v1/invoices`. The engine creates its invoices already `finalized`, or as a `draft` while their tax is pending or collection is paused on the subscription. An invoice you create starts as a `draft` until you finalize it. A finalized invoice ends `paid`, `voided` or `uncollectible`. Every amount is a whole number in the currency's minor unit (cents for USD). The invoice routes and the `invoice.*` and `payment.*` webhook events return it.

type InvoiceBillingReason

type InvoiceBillingReason string

InvoiceBillingReason Why the invoice was made, like Stripe's `invoice.billing_reason`. Set when the invoice is created and never changed.

  • `subscription_cycle`: the invoice for a subscription period that ended (a renewal).
  • `subscription_create`: the first invoice when a subscription starts or its trial ends, for the fees its plans bill in advance. A subscription billed only in arrears has none.
  • `subscription_cancel`: the final invoice when a subscription is canceled at once in the middle of a period.
  • `subscription_update`: the invoice for a change in the middle of a period, such as a plan upgrade, a quantity increase or an added item.
  • `manual`: an invoice you created with `POST /v1/invoices`.
  • `threshold`: an early invoice because a spend threshold was crossed.
const (
	InvoiceBillingReasonManual             InvoiceBillingReason = "manual"
	InvoiceBillingReasonSubscriptionCancel InvoiceBillingReason = "subscription_cancel"
	InvoiceBillingReasonSubscriptionCreate InvoiceBillingReason = "subscription_create"
	InvoiceBillingReasonSubscriptionCycle  InvoiceBillingReason = "subscription_cycle"
	InvoiceBillingReasonSubscriptionUpdate InvoiceBillingReason = "subscription_update"
	InvoiceBillingReasonThreshold          InvoiceBillingReason = "threshold"
)

Defines values for InvoiceBillingReason.

func (InvoiceBillingReason) Valid

func (e InvoiceBillingReason) Valid() bool

Valid indicates whether the value is a known member of the InvoiceBillingReason enum.

type InvoiceCreateRequest

type InvoiceCreateRequest struct {
	// BillingPeriodEnd End of the period the invoice covers. Defaults to now.
	BillingPeriodEnd time.Time `json:"billing_period_end,omitempty"`

	// BillingPeriodStart Start of the period the invoice covers. Defaults to now.
	BillingPeriodStart time.Time `json:"billing_period_start,omitempty"`

	// Currency Uppercase or lowercase ISO 4217 code; it is stored uppercase. It
	// must be the customer's currency (see the 409). Defaults to the
	// billing profile's currency, then the plan currency of the
	// customer's live subscriptions, then the account's default
	// currency. Currencies with no minor unit (such as JPY) are
	// refused.
	Currency string `json:"currency,omitempty"`

	// CustomerId The customer to bill. Must exist in this account and mode.
	CustomerId string `json:"customer_id"`

	// LineItems Lines created in the same transaction as the invoice. Leave out to create an invoice with no lines and add them later.
	LineItems []InvoiceLineItemInput `json:"line_items,omitempty"`

	// Memo A note printed on the invoice. Leading and trailing spaces are removed.
	Memo string `json:"memo,omitempty"`

	// NetPaymentTermDays Days until the invoice is due. 0 means due on receipt. Defaults to the account's net payment terms. A negative value is stored as 0.
	NetPaymentTermDays int `json:"net_payment_term_days,omitempty"`

	// SubscriptionId Optional. Must belong to `customer_id`. Leave out for a one-off invoice. The subscription's own cycle invoices are still billed, also for the same period.
	SubscriptionId string `json:"subscription_id,omitempty"`
}

InvoiceCreateRequest The body of `POST /v1/invoices`, which creates a one-off draft invoice.

type InvoiceDispute

type InvoiceDispute struct {
	// AmountCents The disputed amount, in the currency's minor unit (cents for USD). It can differ from the payment.
	AmountCents int64 `json:"amount_cents"`

	// ClosedAt When Stripe closed it. Absent while it is open.
	ClosedAt time.Time `json:"closed_at,omitempty"`

	// CreatedAt When Hardcount first recorded the dispute.
	CreatedAt time.Time `json:"created_at"`

	// Currency The dispute's currency, uppercase.
	Currency string `json:"currency"`

	// EvidenceDueBy The deadline to respond in Stripe. Absent when Stripe gave none.
	EvidenceDueBy time.Time `json:"evidence_due_by,omitempty"`

	// Id Unique identifier of the dispute record, `hc_dsp_` and 24 hex characters.
	Id string `json:"id"`

	// InvoiceId The invoice whose payment is disputed.
	InvoiceId string `json:"invoice_id"`

	// Livemode True for a live-mode payment, false for test mode.
	Livemode bool `json:"livemode"`

	// OpenedAt When Stripe opened the dispute.
	OpenedAt time.Time `json:"opened_at"`

	// Reason The reason the cardholder gave, for example `fraudulent`. Absent when Stripe gave none.
	Reason string `json:"reason,omitempty"`

	// Status Stripe's dispute status, as Stripe sends it. The `warning_`
	// statuses are an inquiry, which comes before a chargeback or
	// instead of one. `won`, `lost`, `warning_closed` and `prevented`
	// are closed.
	Status InvoiceDisputeStatus `json:"status"`

	// StripeChargeId The disputed Stripe charge (`ch_…`). Absent when Stripe did not send it.
	StripeChargeId string `json:"stripe_charge_id,omitempty"`

	// StripeDisputeId Stripe's dispute id (`du_…`).
	StripeDisputeId string `json:"stripe_dispute_id"`

	// StripePaymentIntentId The disputed payment.
	StripePaymentIntentId string `json:"stripe_payment_intent_id"`

	// UpdatedAt When Hardcount last updated the record from a Stripe event.
	UpdatedAt time.Time `json:"updated_at"`
}

InvoiceDispute A card dispute (chargeback) Stripe reported against one of the invoice's payments, recorded from Stripe's `charge.dispute.created`, `.updated` and `.closed` webhook events. It holds the dispute as the newest of those events showed it, whatever order they arrived in. Hardcount records and reports a dispute, and nothing else: the invoice stays paid and no money moves.

type InvoiceDisputeList

type InvoiceDisputeList struct {
	// Data The disputes on this page. An empty list when the invoice has none.
	Data []InvoiceDispute `json:"data"`

	// Total How many rows match the request's filters, on every page, not only
	// this one. The audit log and the customer list's search and name or
	// email sort say where they stop counting.
	Total ListTotal `json:"total"`
}

InvoiceDisputeList What `GET /v1/invoices/{id}/disputes` returns, one page of the invoice's disputes, oldest first.

type InvoiceDisputeStatus

type InvoiceDisputeStatus string

InvoiceDisputeStatus Stripe's dispute status, as Stripe sends it. The `warning_` statuses are an inquiry, which comes before a chargeback or instead of one. `won`, `lost`, `warning_closed` and `prevented` are closed.

const (
	Lost                 InvoiceDisputeStatus = "lost"
	NeedsResponse        InvoiceDisputeStatus = "needs_response"
	Prevented            InvoiceDisputeStatus = "prevented"
	UnderReview          InvoiceDisputeStatus = "under_review"
	WarningClosed        InvoiceDisputeStatus = "warning_closed"
	WarningNeedsResponse InvoiceDisputeStatus = "warning_needs_response"
	WarningUnderReview   InvoiceDisputeStatus = "warning_under_review"
	Won                  InvoiceDisputeStatus = "won"
)

Defines values for InvoiceDisputeStatus.

func (InvoiceDisputeStatus) Valid

func (e InvoiceDisputeStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoiceDisputeStatus enum.

type InvoiceLineItem

type InvoiceLineItem struct {
	// AmountCents The line's amount before tax, in the currency's minor unit (cents
	// for USD). With tax-inclusive prices, it is the net amount after
	// the tax is taken out.
	AmountCents int64 `json:"amount_cents"`

	// BillingPeriodEnd End of the time the line bills for (not included). Absent on lines with no period of their own.
	BillingPeriodEnd time.Time `json:"billing_period_end,omitempty"`

	// BillingPeriodStart Start of the time the line bills for (included). Absent on lines with no period of their own, such as lines you add to a draft.
	BillingPeriodStart time.Time `json:"billing_period_start,omitempty"`

	// CommitExpiresAt When the granted credit expires. The credit can be drawn up to
	// and including this instant; a period invoice draws it when its
	// period ends at or before it. The dashboard sends the local
	// midnight after the picked day. Absent when the credit never
	// expires (the default).
	CommitExpiresAt time.Time `json:"commit_expires_at,omitempty"`

	// CommitGrantedCents Marks the line as a prepaid commit purchase: when the invoice is
	// finalized, the customer is granted a block of credit of this
	// many cents (in the invoice's currency). It may differ from the
	// line's price: a discounted commit sells $10,000 of credit for
	// $9,000. Only on `add_on` lines of invoices you create, at most
	// one per invoice. Absent on other lines.
	CommitGrantedCents int64 `json:"commit_granted_cents,omitempty"`

	// CreatedAt When the line was written.
	CreatedAt time.Time `json:"created_at"`

	// Currency The line's currency, the same as the invoice's.
	Currency string `json:"currency"`

	// Description The line's text as printed on the invoice. A base fee reads like
	// "Pro - base fee (qty 1)"; a usage line names the meter and its
	// unit, or the labels its price takes, like "Tokens (tokens)".
	Description string `json:"description"`

	// DimensionMatch On a usage line, the labels its price takes. Absent for a price that takes every event, and on other lines.
	DimensionMatch map[string]string `json:"dimension_match,omitempty"`

	// Id Unique identifier of the line, starting `hc_ili_`.
	Id string `json:"id"`

	// InvoiceId The invoice the line is on.
	InvoiceId string `json:"invoice_id"`

	// LineType What an invoice line charges for. `base_fee`: a plan's flat fee for
	// the period. `usage`: metered usage, priced by a plan price.
	// `add_on`: any other charge, such as a line you add to a draft (the
	// default for those).
	LineType InvoiceLineType `json:"line_type"`

	// Metadata Extra key-value data stored with the line. No API request sets it; it is absent when empty.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// MeterId On a usage line, the meter that measured the usage. Absent on other lines.
	MeterId string `json:"meter_id,omitempty"`

	// MeterUnit On a usage line, the meter's unit ("tokens", "seconds", …), as it was when the line was written, so prices can be shown per unit the way the pricing pages show them (token rates read "$3.00 / 1M tokens"). Absent on other lines, and on usage lines written before releases recorded it.
	MeterUnit string `json:"meter_unit,omitempty"`

	// PriceId On a usage line, the plan price that billed it. Absent on other lines.
	PriceId string `json:"price_id,omitempty"`

	// PricingMode On a usage line, the shape of its price: `per_unit`, `graduated` or `package`. Absent on other lines.
	PricingMode string `json:"pricing_mode,omitempty"`

	// Quantity The line's exact quantity as a decimal string, for example "3" or "1.5". Line amounts stay whole cents.
	Quantity string `json:"quantity"`

	// TaxAmountCents Tax on the line, in the currency's minor unit (cents for USD).
	TaxAmountCents int64 `json:"tax_amount_cents"`

	// TaxCode The product tax code the line was taxed under (for Stripe Tax, a `txcd_…` code). Absent when none was used.
	TaxCode string `json:"tax_code,omitempty"`

	// TaxJurisdiction The tax jurisdiction the provider named for the line. Absent when none was given.
	TaxJurisdiction string `json:"tax_jurisdiction,omitempty"`

	// TaxRate Tax rate on the line as a percent, up to four decimal places (18.5 means 18.5%).
	TaxRate float64 `json:"tax_rate"`

	// TaxReason Why the line was taxed as it was, in Stripe Tax's words
	// (`standard_rated`, `reverse_charge`, `not_collecting`,
	// `customer_exempt`, `product_exempt`, `zero_rated` and others).
	// `prepaid_credit_purchase` is Hardcount's own value, on a prepaid
	// commit purchase line under the manual or Stripe Tax provider:
	// the line is not taxed, and the usage the credit pays for is
	// taxed when invoiced. Otherwise absent for providers other than
	// Stripe Tax.
	TaxReason string `json:"tax_reason,omitempty"`

	// TenantId The account the line belongs to. Absent when empty.
	TenantId string `json:"tenant_id,omitempty"`

	// TotalAmountCents The line's amount plus its tax, in the currency's minor unit (cents for USD).
	TotalAmountCents int64 `json:"total_amount_cents"`

	// UnitAmountDecimal The unit price, a decimal string of cents at full precision, for example "0.3" for $0.003. On a usage line priced `per_unit` it is that rate; on any other line it is `amount_cents` ÷ `quantity`. Line amounts and totals stay whole cents.
	UnitAmountDecimal string `json:"unit_amount_decimal"`
}

InvoiceLineItem One line on an invoice: a base fee, a usage charge or another charge. Amounts are whole numbers in the currency's minor unit (cents for USD). `GET /v1/invoices/{id}` returns the lines, and `POST /v1/invoices/{id}/line-items` returns the line it added.

type InvoiceLineItemInput

type InvoiceLineItemInput struct {
	// CommitExpiresAt When the granted credit expires. The credit can be drawn up to
	// and including this instant; a period invoice draws it when its
	// period ends at or before it. The dashboard sends the local
	// midnight after the picked day. Must be in the future. Needs
	// `commit_granted_cents`. Absent means it never expires.
	CommitExpiresAt time.Time `json:"commit_expires_at,omitempty"`

	// CommitGrantedCents Makes this line a prepaid commit purchase: when the invoice is
	// finalized, the customer gets this many cents of credit. Only on
	// `add_on` lines of invoices you create, at most one per invoice.
	// At most 100,000,000 ($1,000,000).
	CommitGrantedCents int64 `json:"commit_granted_cents,omitempty"`

	// Description The text printed on the line. Must not be blank.
	Description string `json:"description"`

	// LineType What the line charges for. Defaults to `add_on`.
	LineType InvoiceLineItemInputLineType `json:"line_type,omitempty"`

	// Quantity How many units, a whole number of 1 or more.
	Quantity int64 `json:"quantity"`

	// UnitAmountCents Price of one unit in the currency's minor unit (cents for USD),
	// a whole number of 1 or more. The line's amount is `quantity` ×
	// `unit_amount_cents`; a product too large for 64-bit cents is
	// refused.
	UnitAmountCents int64 `json:"unit_amount_cents"`
}

InvoiceLineItemInput A line to add to a draft invoice, with `POST /v1/invoices` or `POST /v1/invoices/{id}/line-items`. Its amount is `quantity` × `unit_amount_cents`.

type InvoiceLineItemInputLineType

type InvoiceLineItemInputLineType string

InvoiceLineItemInputLineType What the line charges for. Defaults to `add_on`.

const (
	InvoiceLineItemInputLineTypeAddOn   InvoiceLineItemInputLineType = "add_on"
	InvoiceLineItemInputLineTypeBaseFee InvoiceLineItemInputLineType = "base_fee"
	InvoiceLineItemInputLineTypeUsage   InvoiceLineItemInputLineType = "usage"
)

Defines values for InvoiceLineItemInputLineType.

func (InvoiceLineItemInputLineType) Valid

Valid indicates whether the value is a known member of the InvoiceLineItemInputLineType enum.

type InvoiceLineType

type InvoiceLineType string

InvoiceLineType What an invoice line charges for. `base_fee`: a plan's flat fee for the period. `usage`: metered usage, priced by a plan price. `add_on`: any other charge, such as a line you add to a draft (the default for those).

const (
	InvoiceLineTypeAddOn   InvoiceLineType = "add_on"
	InvoiceLineTypeBaseFee InvoiceLineType = "base_fee"
	InvoiceLineTypeUsage   InvoiceLineType = "usage"
)

Defines values for InvoiceLineType.

func (InvoiceLineType) Valid

func (e InvoiceLineType) Valid() bool

Valid indicates whether the value is a known member of the InvoiceLineType enum.

type InvoicePaymentStatus

type InvoicePaymentStatus string

InvoicePaymentStatus The state of the invoice's payment.

  • `pending`: nothing has been charged yet, or a charge is about to be sent. Also the status after Stripe refused the amount as below its minimum charge (see `amount_below_minimum`).
  • `processing`: Stripe is still working on a charge.
  • `succeeded`: the invoice is paid.
  • `failed`: the last charge was declined or refused. Dunning, when a policy is on, retries it.
  • `unknown`: a Stripe charge got an unclear answer (a 5xx, a timeout or a dropped connection), so Hardcount cannot tell whether Stripe took the money. With a payment intent recorded, Hardcount asks Stripe for it after a short wait. With none (a parked invoice), Hardcount lists the customer's payments at Stripe on every billing tick: it records a payment for the invoice that appears, and if none has appeared 24 hours after the attempt the invoice goes back to `pending` (`failed` after a dunning retry) and is charged again as usual.
const (
	InvoicePaymentStatusFailed     InvoicePaymentStatus = "failed"
	InvoicePaymentStatusPending    InvoicePaymentStatus = "pending"
	InvoicePaymentStatusProcessing InvoicePaymentStatus = "processing"
	InvoicePaymentStatusSucceeded  InvoicePaymentStatus = "succeeded"
	InvoicePaymentStatusUnknown    InvoicePaymentStatus = "unknown"
)

Defines values for InvoicePaymentStatus.

func (InvoicePaymentStatus) Valid

func (e InvoicePaymentStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoicePaymentStatus enum.

type InvoicePaymentTimeline

type InvoicePaymentTimeline struct {
	// Degraded Sources that could not be read, so their rows are missing.
	Degraded []InvoicePaymentTimelineDegraded `json:"degraded"`

	// Events The rows, oldest first. An empty list for a draft.
	Events []InvoiceTimelineEvent `json:"events"`

	// Truncated True when the credit-note source hit its limit of 100 rows.
	Truncated bool `json:"truncated"`
}

InvoicePaymentTimeline What `GET /v1/invoices/{id}/payment-timeline` returns: the invoice's activity, oldest first, and which sources could not be read.

type InvoicePaymentTimelineDegraded

type InvoicePaymentTimelineDegraded string

InvoicePaymentTimelineDegraded defines model for InvoicePaymentTimeline.Degraded.

const (
	InvoicePaymentTimelineDegradedAudit          InvoicePaymentTimelineDegraded = "audit"
	InvoicePaymentTimelineDegradedChargeAttempts InvoicePaymentTimelineDegraded = "charge_attempts"
	InvoicePaymentTimelineDegradedCreditNotes    InvoicePaymentTimelineDegraded = "credit_notes"
	InvoicePaymentTimelineDegradedDisputes       InvoicePaymentTimelineDegraded = "disputes"
	InvoicePaymentTimelineDegradedDunning        InvoicePaymentTimelineDegraded = "dunning"
	InvoicePaymentTimelineDegradedEmails         InvoicePaymentTimelineDegraded = "emails"
	InvoicePaymentTimelineDegradedStripeRefunds  InvoicePaymentTimelineDegraded = "stripe_refunds"
)

Defines values for InvoicePaymentTimelineDegraded.

func (InvoicePaymentTimelineDegraded) Valid

Valid indicates whether the value is a known member of the InvoicePaymentTimelineDegraded enum.

type InvoicePreview

type InvoicePreview struct {
	// BillingPeriodEnd End of the period the invoice would bill (not included). Shifts
	// with `billing_period_start` when a fee is billed in advance.
	BillingPeriodEnd time.Time `json:"billing_period_end"`

	// BillingPeriodStart Start of the period the invoice would bill (included): the
	// previewed window, or, when a plan on the subscription bills its
	// fee in advance, the period after it, as on the real invoice.
	BillingPeriodStart time.Time `json:"billing_period_start"`

	// CustomerId The customer the preview is for.
	CustomerId string `json:"customer_id"`

	// GeneratedAt When the preview was built.
	GeneratedAt time.Time `json:"generated_at"`

	// Lines The lines the invoice would have. An empty list when nothing would be billed.
	Lines []InvoicePreviewLine `json:"lines"`

	// PlanName The names of the subscription's plans, comma-separated.
	PlanName string `json:"plan_name"`

	// SubscriptionId The subscription the preview bills.
	SubscriptionId string `json:"subscription_id"`

	// Totals One total per currency on the lines.
	Totals []InvoicePreviewTotal `json:"totals"`

	// Warnings Ways the real invoice can differ from this preview, in plain words. An empty list when there are none.
	Warnings []string `json:"warnings"`
}

InvoicePreview A dry-run invoice built from the usage recorded so far, from `POST /v1/invoices/create_preview`. Nothing is saved. Amounts are whole numbers in the currency's minor unit (cents for USD), and tax is not included.

type InvoicePreviewLine

type InvoicePreviewLine struct {
	// AmountCents The line's amount, in the currency's minor unit (cents for USD).
	AmountCents int64 `json:"amount_cents"`

	// Currency The line's currency, the plan's.
	Currency string `json:"currency"`

	// Description The text the invoice line would carry.
	Description string `json:"description"`

	// DimensionMatch On a usage line, the labels its price takes. Absent for a price that takes every event.
	DimensionMatch map[string]string `json:"dimension_match,omitempty"`

	// LineType `base_fee`: a plan's flat fee. `usage`: metered usage priced by a plan price.
	LineType InvoicePreviewLineLineType `json:"line_type"`

	// MeterId On a usage line, the meter that measured the usage. Absent on base fee lines.
	MeterId string `json:"meter_id,omitempty"`

	// MeterUnit On a usage line, the meter's unit, such as `tokens`. Absent on base fee lines.
	MeterUnit string `json:"meter_unit,omitempty"`

	// PriceId On a usage line, the plan price that priced it.
	PriceId string `json:"price_id,omitempty"`

	// PricingMode On a usage line, the shape of its price. Absent on base fee lines.
	PricingMode InvoicePreviewLinePricingMode `json:"pricing_mode,omitempty"`

	// Quantity Exact quantity as a decimal string.
	Quantity string `json:"quantity"`

	// UnitAmountCents Unit price in whole cents of the currency's minor unit. On a base
	// fee line it is the plan's base fee per unit; on a usage line it is
	// `amount_cents` ÷ `quantity` rounded to a whole cent, so a sub-cent
	// rate shows 0.
	UnitAmountCents int64 `json:"unit_amount_cents"`
}

InvoicePreviewLine One line of an invoice preview.

type InvoicePreviewLineLineType

type InvoicePreviewLineLineType string

InvoicePreviewLineLineType `base_fee`: a plan's flat fee. `usage`: metered usage priced by a plan price.

const (
	InvoicePreviewLineLineTypeBaseFee InvoicePreviewLineLineType = "base_fee"
	InvoicePreviewLineLineTypeUsage   InvoicePreviewLineLineType = "usage"
)

Defines values for InvoicePreviewLineLineType.

func (InvoicePreviewLineLineType) Valid

func (e InvoicePreviewLineLineType) Valid() bool

Valid indicates whether the value is a known member of the InvoicePreviewLineLineType enum.

type InvoicePreviewLinePricingMode

type InvoicePreviewLinePricingMode string

InvoicePreviewLinePricingMode On a usage line, the shape of its price. Absent on base fee lines.

const (
	InvoicePreviewLinePricingModeGraduated InvoicePreviewLinePricingMode = "graduated"
	InvoicePreviewLinePricingModePackage   InvoicePreviewLinePricingMode = "package"
	InvoicePreviewLinePricingModePerUnit   InvoicePreviewLinePricingMode = "per_unit"
)

Defines values for InvoicePreviewLinePricingMode.

func (InvoicePreviewLinePricingMode) Valid

Valid indicates whether the value is a known member of the InvoicePreviewLinePricingMode enum.

type InvoicePreviewTotal

type InvoicePreviewTotal struct {
	// AmountCents The sum of the lines in this currency, in its minor unit (cents for USD), before tax.
	AmountCents int64 `json:"amount_cents"`

	// Currency The currency, uppercase.
	Currency string `json:"currency"`
}

InvoicePreviewTotal The total of an invoice preview's lines in one currency.

type InvoiceStatus

type InvoiceStatus string

InvoiceStatus Where the invoice is in its life.

  • `draft`: not issued yet. Lines can still be added, and nothing is charged.
  • `finalized`: issued and owed. Hardcount collects it.
  • `paid`: settled, by card, credit, an offline payment or a credit note that left nothing due.
  • `voided`: cancelled. Nothing is owed. Voiding is final.
  • `uncollectible`: written off as bad debt, by you (`POST /v1/invoices/{id}/mark-uncollectible`) or by a dunning policy's final action. Hardcount stops collecting it, but it stays on the books and can still be paid.
const (
	InvoiceStatusDraft         InvoiceStatus = "draft"
	InvoiceStatusFinalized     InvoiceStatus = "finalized"
	InvoiceStatusPaid          InvoiceStatus = "paid"
	InvoiceStatusUncollectible InvoiceStatus = "uncollectible"
	InvoiceStatusVoided        InvoiceStatus = "voided"
)

Defines values for InvoiceStatus.

func (InvoiceStatus) Valid

func (e InvoiceStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoiceStatus enum.

type InvoiceStripeRefund added in v0.9.2

type InvoiceStripeRefund struct {
	// AmountCents The refunded amount, in the currency's minor unit (cents for USD).
	AmountCents int64 `json:"amount_cents"`

	// CreatedAt When Hardcount first recorded the refund.
	CreatedAt time.Time `json:"created_at"`

	// CreditNoteId The credit note that records the refund, when `outcome` is `credit_note`.
	CreditNoteId string `json:"credit_note_id,omitempty"`

	// Currency The refund's currency, uppercase.
	Currency string `json:"currency"`

	// DismissedAt When the refund was dismissed. Absent unless `outcome` is `dismissed`.
	DismissedAt time.Time `json:"dismissed_at,omitempty"`

	// DismissedNote The note given when the refund was dismissed. Absent unless `outcome` is `dismissed`.
	DismissedNote string `json:"dismissed_note,omitempty"`

	// FailureReason Why Stripe could not make the refund, once it failed.
	FailureReason string `json:"failure_reason,omitempty"`

	// Id Unique identifier of the refund record, `hc_srf_` and 24 hex characters.
	Id string `json:"id"`

	// InvoiceId The invoice whose payment was refunded.
	InvoiceId string `json:"invoice_id"`

	// Livemode True for a live-mode payment, false for test mode.
	Livemode bool `json:"livemode"`

	// Outcome `awaiting`: first seen pending or requiring action. Nothing is
	// recorded or sent until a later event shows how it ended: once it
	// succeeded it is decided as below (the 24-hour rule counts from
	// Hardcount's first sighting); failed or canceled, it becomes
	// `not_refunded`. `credit_note`: recorded as an issued credit note whose card
	// refund is this refund (`credit_note_id`); Hardcount called
	// nothing at Stripe for it. `other_payment`: a refund of a payment
	// that did not pay the invoice (a second charge, or money on a
	// voided invoice), so no credit note. `needs_review`: a refund of
	// the invoice's own payment that Hardcount did not record
	// (`review_reason` says why); the invoice shows the
	// `refunded_in_stripe` notice until the operator records it with a
	// credit note or dismisses it. `not_refunded`: first seen already
	// failed or canceled, so no money moved. `dismissed`: the operator
	// handled it outside Hardcount.
	Outcome InvoiceStripeRefundOutcome `json:"outcome"`

	// Reason Stripe's refund reason (`duplicate`, `fraudulent` or `requested_by_customer`). Absent when none was given.
	Reason string `json:"reason,omitempty"`

	// RefundCreatedAt When Stripe made the refund.
	RefundCreatedAt time.Time `json:"refund_created_at"`

	// ReviewReason Why a refund of the invoice's own payment was flagged instead of
	// recorded. Set for `needs_review` and `dismissed`, and kept when
	// the operator records one with a credit note.
	ReviewReason InvoiceStripeRefundReviewReason `json:"review_reason,omitempty"`

	// Status Stripe's refund status, as Stripe sends it.
	Status InvoiceStripeRefundStatus `json:"status"`

	// StripeChargeId The refunded Stripe charge (`ch_…`). Absent when Stripe did not send it.
	StripeChargeId string `json:"stripe_charge_id,omitempty"`

	// StripePaymentIntentId The refunded payment.
	StripePaymentIntentId string `json:"stripe_payment_intent_id"`

	// StripeRefundId Stripe's refund id (`re_…`).
	StripeRefundId string `json:"stripe_refund_id"`

	// UpdatedAt When Hardcount last updated the record.
	UpdatedAt time.Time `json:"updated_at"`
}

InvoiceStripeRefund A refund made in Stripe outside Hardcount (the Stripe dashboard, or Stripe's API called directly) on one of the invoice's payments, recorded from Stripe's `refund.created`, `refund.updated`, `refund.failed` and `charge.refund.updated` webhook events. It holds the refund as the newest of those events showed it. Hardcount's own refunds are never listed here. `outcome` is what Hardcount did with the refund: decided when Hardcount first sees it, or, for a refund first seen in flight (`awaiting`), when a later event shows how it ended. After that only you change it, by recording a flagged refund with a credit note or dismissing it.

type InvoiceStripeRefundList added in v0.9.2

type InvoiceStripeRefundList struct {
	// Data The refunds on this page. An empty list when the invoice has none.
	Data []InvoiceStripeRefund `json:"data"`

	// Total How many rows match the request's filters, on every page, not only
	// this one. The audit log and the customer list's search and name or
	// email sort say where they stop counting.
	Total ListTotal `json:"total"`
}

InvoiceStripeRefundList What `GET /v1/invoices/{id}/stripe-refunds` returns, one page of the refunds made in Stripe on the invoice's payments, oldest first.

type InvoiceStripeRefundOutcome added in v0.9.2

type InvoiceStripeRefundOutcome string

InvoiceStripeRefundOutcome `awaiting`: first seen pending or requiring action. Nothing is recorded or sent until a later event shows how it ended: once it succeeded it is decided as below (the 24-hour rule counts from Hardcount's first sighting); failed or canceled, it becomes `not_refunded`. `credit_note`: recorded as an issued credit note whose card refund is this refund (`credit_note_id`); Hardcount called nothing at Stripe for it. `other_payment`: a refund of a payment that did not pay the invoice (a second charge, or money on a voided invoice), so no credit note. `needs_review`: a refund of the invoice's own payment that Hardcount did not record (`review_reason` says why); the invoice shows the `refunded_in_stripe` notice until the operator records it with a credit note or dismisses it. `not_refunded`: first seen already failed or canceled, so no money moved. `dismissed`: the operator handled it outside Hardcount.

const (
	InvoiceStripeRefundOutcomeAwaiting     InvoiceStripeRefundOutcome = "awaiting"
	InvoiceStripeRefundOutcomeCreditNote   InvoiceStripeRefundOutcome = "credit_note"
	InvoiceStripeRefundOutcomeDismissed    InvoiceStripeRefundOutcome = "dismissed"
	InvoiceStripeRefundOutcomeNeedsReview  InvoiceStripeRefundOutcome = "needs_review"
	InvoiceStripeRefundOutcomeNotRefunded  InvoiceStripeRefundOutcome = "not_refunded"
	InvoiceStripeRefundOutcomeOtherPayment InvoiceStripeRefundOutcome = "other_payment"
)

Defines values for InvoiceStripeRefundOutcome.

func (InvoiceStripeRefundOutcome) Valid added in v0.9.2

func (e InvoiceStripeRefundOutcome) Valid() bool

Valid indicates whether the value is a known member of the InvoiceStripeRefundOutcome enum.

type InvoiceStripeRefundReviewReason added in v0.9.2

type InvoiceStripeRefundReviewReason string

InvoiceStripeRefundReviewReason Why a refund of the invoice's own payment was flagged instead of recorded. Set for `needs_review` and `dismissed`, and kept when the operator records one with a credit note.

const (
	CreditNoteRefundFailed InvoiceStripeRefundReviewReason = "credit_note_refund_failed"
	CurrencyMismatch       InvoiceStripeRefundReviewReason = "currency_mismatch"
	ExceedsCardRefundable  InvoiceStripeRefundReviewReason = "exceeds_card_refundable"
	ExceedsCreditable      InvoiceStripeRefundReviewReason = "exceeds_creditable"
	InvoiceNotPaid         InvoiceStripeRefundReviewReason = "invoice_not_paid"
	PrepaidCommit          InvoiceStripeRefundReviewReason = "prepaid_commit"
	SeenLate               InvoiceStripeRefundReviewReason = "seen_late"
)

Defines values for InvoiceStripeRefundReviewReason.

func (InvoiceStripeRefundReviewReason) Valid added in v0.9.2

Valid indicates whether the value is a known member of the InvoiceStripeRefundReviewReason enum.

type InvoiceStripeRefundStatus added in v0.9.2

type InvoiceStripeRefundStatus string

InvoiceStripeRefundStatus Stripe's refund status, as Stripe sends it.

const (
	InvoiceStripeRefundStatusCanceled       InvoiceStripeRefundStatus = "canceled"
	InvoiceStripeRefundStatusFailed         InvoiceStripeRefundStatus = "failed"
	InvoiceStripeRefundStatusPending        InvoiceStripeRefundStatus = "pending"
	InvoiceStripeRefundStatusRequiresAction InvoiceStripeRefundStatus = "requires_action"
	InvoiceStripeRefundStatusSucceeded      InvoiceStripeRefundStatus = "succeeded"
)

Defines values for InvoiceStripeRefundStatus.

func (InvoiceStripeRefundStatus) Valid added in v0.9.2

func (e InvoiceStripeRefundStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoiceStripeRefundStatus enum.

type InvoiceTaxErrorCode

type InvoiceTaxErrorCode string

InvoiceTaxErrorCode Why tax could not be calculated, as a code. Set while `tax_status` is `pending`; `tax_pending_reason` has the detail.

const (
	InvoiceTaxErrorCodeCustomerDataInvalid     InvoiceTaxErrorCode = "customer_data_invalid"
	InvoiceTaxErrorCodeJurisdictionUnsupported InvoiceTaxErrorCode = "jurisdiction_unsupported"
	InvoiceTaxErrorCodeProviderAuth            InvoiceTaxErrorCode = "provider_auth"
	InvoiceTaxErrorCodeProviderNotConfigured   InvoiceTaxErrorCode = "provider_not_configured"
	InvoiceTaxErrorCodeProviderOutage          InvoiceTaxErrorCode = "provider_outage"
	InvoiceTaxErrorCodeUnknown                 InvoiceTaxErrorCode = "unknown"
)

Defines values for InvoiceTaxErrorCode.

func (InvoiceTaxErrorCode) Valid

func (e InvoiceTaxErrorCode) Valid() bool

Valid indicates whether the value is a known member of the InvoiceTaxErrorCode enum.

type InvoiceTaxStatus

type InvoiceTaxStatus string

InvoiceTaxStatus Whether tax has been calculated. `ok`: it has (a zero tax counts). `pending`: the calculation failed, and `tax_error_code` says why and whether Hardcount retries it. A pending invoice stays a draft and cannot be finalized, so a wrong tax amount is never sent.

const (
	InvoiceTaxStatusOk      InvoiceTaxStatus = "ok"
	InvoiceTaxStatusPending InvoiceTaxStatus = "pending"
)

Defines values for InvoiceTaxStatus.

func (InvoiceTaxStatus) Valid

func (e InvoiceTaxStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoiceTaxStatus enum.

type InvoiceTimelineEvent

type InvoiceTimelineEvent struct {
	// AmountCents The line's amount, in the currency's minor unit (cents for USD). Absent when the row has no amount.
	AmountCents int64 `json:"amount_cents,omitempty"`

	// AttemptCount On dunning rows, the run's retry count at the event; on the paid row, the retries that ran before payment. Absent when 0.
	AttemptCount int `json:"attempt_count,omitempty"`

	// Currency The currency of `amount_cents`. Absent when the row has no amount.
	Currency string `json:"currency,omitempty"`

	// Description The line's title.
	Description string `json:"description"`

	// Detail The line's meta line as text, its actor last, for example "Visa •••• 4242 · After 2 retries". Absent when empty.
	Detail string `json:"detail,omitempty"`

	// Error The line's problem. Absent when there is none.
	Error string `json:"error,omitempty"`

	// EventType Machine name of the event, for example `invoice.finalized`,
	// `charge_attempt.failed`, `retry_attempted`, `credit_note.issued`
	// or `payment.dispute_opened`.
	EventType string `json:"event_type"`

	// Id Stable key for the row.
	Id string `json:"id"`

	// IsSimulated True when `timestamp` is test-clock time. Absent when false.
	IsSimulated bool `json:"is_simulated,omitempty"`

	// Line One activity row, with every word written by the server: a title
	// with no values, the amount when the event moves money, asks for it
	// or cancels money owed, a problem line on failure and warning rows,
	// the meta line's parts and the actor, a tone, and the event's time on
	// the entity's calendar. `recorded_at` is the real-world time, set
	// only for an entity on a test clock. The invoice payment timeline and
	// dunning run events carry it.
	Line ActivityLine `json:"line"`

	// PaymentIntentId The Stripe PaymentIntent the row is about, on payment, dunning, dispute and refund rows that name one. Absent otherwise.
	PaymentIntentId string `json:"payment_intent_id,omitempty"`

	// RecordedAt Real-world time of a row whose `timestamp` is test-clock time. Absent otherwise.
	RecordedAt time.Time `json:"recorded_at,omitempty"`

	// Source Where the row comes from: `lifecycle` (created, finalized, paid,
	// voided, written off), `payment` (a charge attempt), `dunning` (a
	// payment retry run), `email` (an email to the customer),
	// `credit_note`, `dispute` or `stripe_refund` (a refund made in
	// Stripe outside Hardcount).
	Source InvoiceTimelineEventSource `json:"source"`

	// Status The line's tone in older words, read by the dashboard's dot.
	Status InvoiceTimelineEventStatus `json:"status"`

	// Timestamp When the event happened, to the second: on the invoice's
	// calendar (the test clock's time for an invoice on a test clock),
	// and at Stripe's own time for disputes and refunds made in Stripe.
	Timestamp time.Time `json:"timestamp"`
}

InvoiceTimelineEvent One row of an invoice's activity timeline (`GET /v1/invoices/{id}/payment-timeline`). `line` is the row in the activity line's words; `description`, `detail`, `error`, `status`, `amount_cents` and `currency` repeat it for clients that read the older fields.

type InvoiceTimelineEventSource

type InvoiceTimelineEventSource string

InvoiceTimelineEventSource Where the row comes from: `lifecycle` (created, finalized, paid, voided, written off), `payment` (a charge attempt), `dunning` (a payment retry run), `email` (an email to the customer), `credit_note`, `dispute` or `stripe_refund` (a refund made in Stripe outside Hardcount).

const (
	InvoiceTimelineEventSourceCreditNote   InvoiceTimelineEventSource = "credit_note"
	InvoiceTimelineEventSourceDispute      InvoiceTimelineEventSource = "dispute"
	InvoiceTimelineEventSourceDunning      InvoiceTimelineEventSource = "dunning"
	InvoiceTimelineEventSourceEmail        InvoiceTimelineEventSource = "email"
	InvoiceTimelineEventSourceLifecycle    InvoiceTimelineEventSource = "lifecycle"
	InvoiceTimelineEventSourcePayment      InvoiceTimelineEventSource = "payment"
	InvoiceTimelineEventSourceStripeRefund InvoiceTimelineEventSource = "stripe_refund"
)

Defines values for InvoiceTimelineEventSource.

func (InvoiceTimelineEventSource) Valid

func (e InvoiceTimelineEventSource) Valid() bool

Valid indicates whether the value is a known member of the InvoiceTimelineEventSource enum.

type InvoiceTimelineEventStatus

type InvoiceTimelineEventStatus string

InvoiceTimelineEventStatus The line's tone in older words, read by the dashboard's dot.

const (
	InvoiceTimelineEventStatusFailed    InvoiceTimelineEventStatus = "failed"
	InvoiceTimelineEventStatusNeutral   InvoiceTimelineEventStatus = "neutral"
	InvoiceTimelineEventStatusSucceeded InvoiceTimelineEventStatus = "succeeded"
	InvoiceTimelineEventStatusWarning   InvoiceTimelineEventStatus = "warning"
)

Defines values for InvoiceTimelineEventStatus.

func (InvoiceTimelineEventStatus) Valid

func (e InvoiceTimelineEventStatus) Valid() bool

Valid indicates whether the value is a known member of the InvoiceTimelineEventStatus enum.

type InvoiceWithLineItems

type InvoiceWithLineItems struct {
	// Invoice A bill for one customer, in one currency. The billing engine creates
	// one at the end of each subscription period (and for a subscription's
	// start when a fee is billed in advance, a change, a cancel or a spend
	// threshold); you can also create one-off invoices with
	// `POST /v1/invoices`. The engine creates its invoices already
	// `finalized`, or as a `draft` while their tax is pending or collection
	// is paused on the subscription. An invoice you create starts as a
	// `draft` until you finalize it. A finalized invoice ends `paid`,
	// `voided` or `uncollectible`. Every amount is a whole number in the
	// currency's minor unit (cents for USD). The invoice routes and the
	// `invoice.*` and `payment.*` webhook events return it.
	Invoice Invoice `json:"invoice"`

	// LineItems The invoice's lines. An empty list when it has none.
	LineItems []InvoiceLineItem `json:"line_items"`
}

InvoiceWithLineItems What `GET /v1/invoices/{id}` returns: the invoice and its lines, as two keys side by side.

type IssueCreditNoteParams

type IssueCreditNoteParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

IssueCreditNoteParams defines parameters for IssueCreditNote.

type ItemChangeType

type ItemChangeType string

ItemChangeType The kind of subscription item change that produced a proration: `plan` (the item moved to another plan), `quantity` (its quantity changed), `add` (the item was added) or `remove` (the item was removed). On a credit ledger entry (`source_change_type`) it is never sent in this version.

const (
	ItemChangeTypeAdd      ItemChangeType = "add"
	ItemChangeTypePlan     ItemChangeType = "plan"
	ItemChangeTypeQuantity ItemChangeType = "quantity"
	ItemChangeTypeRemove   ItemChangeType = "remove"
)

Defines values for ItemChangeType.

func (ItemChangeType) Valid

func (e ItemChangeType) Valid() bool

Valid indicates whether the value is a known member of the ItemChangeType enum.

type Limit

type Limit = int

Limit defines model for Limit.

type ListApiKeysParams

type ListApiKeysParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListApiKeysParams defines parameters for ListApiKeys.

type ListAuditLogParams

type ListAuditLogParams struct {
	// ResourceType For example `invoice`, `api_key`, `setting`. See `/v1/audit-log/filters`.
	ResourceType string `form:"resource_type,omitempty" json:"resource_type,omitempty"`

	// ResourceId Only entries about this resource id.
	ResourceId string `form:"resource_id,omitempty" json:"resource_id,omitempty"`

	// Action For example `create`, `update`, `revoke`. See `/v1/audit-log/filters`.
	Action string `form:"action,omitempty" json:"action,omitempty"`

	// ActorId Only entries by this actor, an `actor_id` value such as a user id or an API key id.
	ActorId string `form:"actor_id,omitempty" json:"actor_id,omitempty"`

	// DateFrom Lower bound on `created_at`, inclusive. RFC3339 or YYYY-MM-DD (start of day, UTC).
	DateFrom string `form:"date_from,omitempty" json:"date_from,omitempty"`

	// DateTo Upper bound on `created_at`, inclusive. RFC3339 or YYYY-MM-DD (23:59:59.999999 UTC, the end of that day).
	DateTo string `form:"date_to,omitempty" json:"date_to,omitempty"`

	// TestClockId Only entries made inside this test clock's simulation. Works for deleted clocks too.
	TestClockId string `form:"test_clock_id,omitempty" json:"test_clock_id,omitempty"`

	// SimFrom Lower bound on `sim_effective_at` (simulated time), inclusive.
	// RFC3339 or YYYY-MM-DD, like `date_from`. Excludes entries with
	// no simulated time.
	SimFrom string `form:"sim_from,omitempty" json:"sim_from,omitempty"`

	// SimTo Upper bound on `sim_effective_at`, inclusive. RFC3339 or
	// YYYY-MM-DD, like `date_to`. Excludes entries with no simulated
	// time.
	SimTo string `form:"sim_to,omitempty" json:"sim_to,omitempty"`

	// Order The only supported order. Any other value is a 400.
	Order ListAuditLogParamsOrder `form:"order,omitempty" json:"order,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListAuditLogParams defines parameters for ListAuditLog.

type ListAuditLogParamsOrder

type ListAuditLogParamsOrder string

ListAuditLogParamsOrder defines parameters for ListAuditLog.

const (
	ListAuditLogParamsOrderCreatedAt ListAuditLogParamsOrder = "created_at"
)

Defines values for ListAuditLogParamsOrder.

func (ListAuditLogParamsOrder) Valid

func (e ListAuditLogParamsOrder) Valid() bool

Valid indicates whether the value is a known member of the ListAuditLogParamsOrder enum.

type ListCreditBalancesParams

type ListCreditBalancesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCreditBalancesParams defines parameters for ListCreditBalances.

type ListCreditLedgerEntriesParams

type ListCreditLedgerEntriesParams struct {
	// EntryType Only entries of this type.
	EntryType ListCreditLedgerEntriesParamsEntryType `form:"entry_type,omitempty" json:"entry_type,omitempty"`

	// Sort The order of the list. `created_at` (the default), `amount_cents`
	// (or `amount`), `entry_type` or `expires_at`. Any other value is a
	// 422 with `param: sort`. Ties are broken by `id` in the same
	// direction.
	Sort ListCreditLedgerEntriesParamsSort `form:"sort,omitempty" json:"sort,omitempty"`

	// Dir Sort direction: `desc` (the default) or `asc`, in lower case. Any
	// other value is a 422 with `param: dir`.
	Dir ListCreditLedgerEntriesParamsDir `form:"dir,omitempty" json:"dir,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCreditLedgerEntriesParams defines parameters for ListCreditLedgerEntries.

type ListCreditLedgerEntriesParamsDir

type ListCreditLedgerEntriesParamsDir string

ListCreditLedgerEntriesParamsDir defines parameters for ListCreditLedgerEntries.

const (
	ListCreditLedgerEntriesParamsDirAsc  ListCreditLedgerEntriesParamsDir = "asc"
	ListCreditLedgerEntriesParamsDirDesc ListCreditLedgerEntriesParamsDir = "desc"
)

Defines values for ListCreditLedgerEntriesParamsDir.

func (ListCreditLedgerEntriesParamsDir) Valid

Valid indicates whether the value is a known member of the ListCreditLedgerEntriesParamsDir enum.

type ListCreditLedgerEntriesParamsEntryType

type ListCreditLedgerEntriesParamsEntryType string

ListCreditLedgerEntriesParamsEntryType defines parameters for ListCreditLedgerEntries.

Defines values for ListCreditLedgerEntriesParamsEntryType.

func (ListCreditLedgerEntriesParamsEntryType) Valid

Valid indicates whether the value is a known member of the ListCreditLedgerEntriesParamsEntryType enum.

type ListCreditLedgerEntriesParamsSort added in v0.9.2

type ListCreditLedgerEntriesParamsSort string

ListCreditLedgerEntriesParamsSort defines parameters for ListCreditLedgerEntries.

const (
	ListCreditLedgerEntriesParamsSortAmount      ListCreditLedgerEntriesParamsSort = "amount"
	ListCreditLedgerEntriesParamsSortAmountCents ListCreditLedgerEntriesParamsSort = "amount_cents"
	ListCreditLedgerEntriesParamsSortCreatedAt   ListCreditLedgerEntriesParamsSort = "created_at"
	ListCreditLedgerEntriesParamsSortEntryType   ListCreditLedgerEntriesParamsSort = "entry_type"
	ListCreditLedgerEntriesParamsSortExpiresAt   ListCreditLedgerEntriesParamsSort = "expires_at"
)

Defines values for ListCreditLedgerEntriesParamsSort.

func (ListCreditLedgerEntriesParamsSort) Valid added in v0.9.2

Valid indicates whether the value is a known member of the ListCreditLedgerEntriesParamsSort enum.

type ListCreditNotesParams

type ListCreditNotesParams struct {
	// InvoiceId Only notes against this invoice.
	InvoiceId string `form:"invoice_id,omitempty" json:"invoice_id,omitempty"`

	// CustomerId Only this customer's notes.
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// Status Only notes in this status.
	Status ListCreditNotesParamsStatus `form:"status,omitempty" json:"status,omitempty"`

	// RefundStatus Only notes whose refund is in this state. `needs_attention`
	// returns issued, non-test-clock notes whose
	// refund failed or has an unknown result, has been pending more
	// than 72 hours, or has a refund amount still at `none` after 1
	// hour.
	RefundStatus ListCreditNotesParamsRefundStatus `form:"refund_status,omitempty" json:"refund_status,omitempty"`

	// Sort The order of the list. `created_at` (the default),
	// `credit_note_number`, `total_cents` (or `amount`), `status` or
	// `issued_at`. Any other value is a 422 with `param: sort`. Ties are
	// broken by `id` in the same direction.
	Sort ListCreditNotesParamsSort `form:"sort,omitempty" json:"sort,omitempty"`

	// Dir Sort direction: `desc` (the default) or `asc`, in lower case. Any
	// other value is a 422 with `param: dir`.
	Dir ListCreditNotesParamsDir `form:"dir,omitempty" json:"dir,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCreditNotesParams defines parameters for ListCreditNotes.

type ListCreditNotesParamsDir

type ListCreditNotesParamsDir string

ListCreditNotesParamsDir defines parameters for ListCreditNotes.

const (
	ListCreditNotesParamsDirAsc  ListCreditNotesParamsDir = "asc"
	ListCreditNotesParamsDirDesc ListCreditNotesParamsDir = "desc"
)

Defines values for ListCreditNotesParamsDir.

func (ListCreditNotesParamsDir) Valid

func (e ListCreditNotesParamsDir) Valid() bool

Valid indicates whether the value is a known member of the ListCreditNotesParamsDir enum.

type ListCreditNotesParamsRefundStatus

type ListCreditNotesParamsRefundStatus string

ListCreditNotesParamsRefundStatus defines parameters for ListCreditNotes.

const (
	ListCreditNotesParamsRefundStatusFailed         ListCreditNotesParamsRefundStatus = "failed"
	ListCreditNotesParamsRefundStatusNeedsAttention ListCreditNotesParamsRefundStatus = "needs_attention"
	ListCreditNotesParamsRefundStatusNone           ListCreditNotesParamsRefundStatus = "none"
	ListCreditNotesParamsRefundStatusPending        ListCreditNotesParamsRefundStatus = "pending"
	ListCreditNotesParamsRefundStatusSucceeded      ListCreditNotesParamsRefundStatus = "succeeded"
	ListCreditNotesParamsRefundStatusUnknown        ListCreditNotesParamsRefundStatus = "unknown"
)

Defines values for ListCreditNotesParamsRefundStatus.

func (ListCreditNotesParamsRefundStatus) Valid

Valid indicates whether the value is a known member of the ListCreditNotesParamsRefundStatus enum.

type ListCreditNotesParamsSort added in v0.9.2

type ListCreditNotesParamsSort string

ListCreditNotesParamsSort defines parameters for ListCreditNotes.

const (
	ListCreditNotesParamsSortAmount           ListCreditNotesParamsSort = "amount"
	ListCreditNotesParamsSortCreatedAt        ListCreditNotesParamsSort = "created_at"
	ListCreditNotesParamsSortCreditNoteNumber ListCreditNotesParamsSort = "credit_note_number"
	ListCreditNotesParamsSortIssuedAt         ListCreditNotesParamsSort = "issued_at"
	ListCreditNotesParamsSortStatus           ListCreditNotesParamsSort = "status"
	ListCreditNotesParamsSortTotalCents       ListCreditNotesParamsSort = "total_cents"
)

Defines values for ListCreditNotesParamsSort.

func (ListCreditNotesParamsSort) Valid added in v0.9.2

func (e ListCreditNotesParamsSort) Valid() bool

Valid indicates whether the value is a known member of the ListCreditNotesParamsSort enum.

type ListCreditNotesParamsStatus

type ListCreditNotesParamsStatus string

ListCreditNotesParamsStatus defines parameters for ListCreditNotes.

const (
	ListCreditNotesParamsStatusDraft  ListCreditNotesParamsStatus = "draft"
	ListCreditNotesParamsStatusIssued ListCreditNotesParamsStatus = "issued"
	ListCreditNotesParamsStatusVoided ListCreditNotesParamsStatus = "voided"
)

Defines values for ListCreditNotesParamsStatus.

func (ListCreditNotesParamsStatus) Valid

Valid indicates whether the value is a known member of the ListCreditNotesParamsStatus enum.

type ListCustomerPaymentMethodsParams

type ListCustomerPaymentMethodsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCustomerPaymentMethodsParams defines parameters for ListCustomerPaymentMethods.

type ListCustomerSentEmailsParams

type ListCustomerSentEmailsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCustomerSentEmailsParams defines parameters for ListCustomerSentEmails.

type ListCustomersParams added in v0.9.2

type ListCustomersParams struct {
	// Status Only customers with this status, `active` or `archived`. Any other
	// value matches no customer.
	Status string `form:"status,omitempty" json:"status,omitempty"`

	// ExternalId Only the customer with this `external_id` (exact match).
	ExternalId string `form:"external_id,omitempty" json:"external_id,omitempty"`

	// Ids Comma-separated customer IDs. Only those customers are returned;
	// IDs not found are skipped.
	Ids string `form:"ids,omitempty" json:"ids,omitempty"`

	// Search Case-insensitive substring match on display name, email, external
	// ID or ID. It looks at the first 5,000 customers, in the list's
	// sort order, that match the other filters; the rows and `total`
	// stop there.
	Search string `form:"search,omitempty" json:"search,omitempty"`

	// Sort The order of the list. `created_at` (the default), `display_name`
	// (or `name`), `email`, `external_id` or `status`. Any other value is
	// a 422 with `param: sort`. On a server that encrypts customer data,
	// a sort by `display_name`, `name` or `email` looks at the 5,000
	// newest customers at most; the rows and `total` stop there.
	Sort ListCustomersParamsSort `form:"sort,omitempty" json:"sort,omitempty"`

	// Dir Sort direction: `desc` (the default) or `asc`, in lower case. Any
	// other value is a 422 with `param: dir`.
	Dir ListCustomersParamsDir `form:"dir,omitempty" json:"dir,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListCustomersParams defines parameters for ListCustomers.

type ListCustomersParamsDir added in v0.9.2

type ListCustomersParamsDir string

ListCustomersParamsDir defines parameters for ListCustomers.

const (
	ListCustomersParamsDirAsc  ListCustomersParamsDir = "asc"
	ListCustomersParamsDirDesc ListCustomersParamsDir = "desc"
)

Defines values for ListCustomersParamsDir.

func (ListCustomersParamsDir) Valid added in v0.9.2

func (e ListCustomersParamsDir) Valid() bool

Valid indicates whether the value is a known member of the ListCustomersParamsDir enum.

type ListCustomersParamsSort added in v0.9.2

type ListCustomersParamsSort string

ListCustomersParamsSort defines parameters for ListCustomers.

const (
	ListCustomersParamsSortCreatedAt   ListCustomersParamsSort = "created_at"
	ListCustomersParamsSortDisplayName ListCustomersParamsSort = "display_name"
	ListCustomersParamsSortEmail       ListCustomersParamsSort = "email"
	ListCustomersParamsSortExternalId  ListCustomersParamsSort = "external_id"
	ListCustomersParamsSortName        ListCustomersParamsSort = "name"
	ListCustomersParamsSortStatus      ListCustomersParamsSort = "status"
)

Defines values for ListCustomersParamsSort.

func (ListCustomersParamsSort) Valid added in v0.9.2

func (e ListCustomersParamsSort) Valid() bool

Valid indicates whether the value is a known member of the ListCustomersParamsSort enum.

type ListDunningPoliciesParams

type ListDunningPoliciesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListDunningPoliciesParams defines parameters for ListDunningPolicies.

type ListDunningRunsParams

type ListDunningRunsParams struct {
	// InvoiceId Only the run for this invoice.
	InvoiceId string `form:"invoice_id,omitempty" json:"invoice_id,omitempty"`

	// State Only runs in this state. Any other value is a 422 with `param: state`.
	State ListDunningRunsParamsState `form:"state,omitempty" json:"state,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListDunningRunsParams defines parameters for ListDunningRuns.

type ListDunningRunsParamsState

type ListDunningRunsParamsState string

ListDunningRunsParamsState defines parameters for ListDunningRuns.

const (
	ListDunningRunsParamsStateActive    ListDunningRunsParamsState = "active"
	ListDunningRunsParamsStateEscalated ListDunningRunsParamsState = "escalated"
	ListDunningRunsParamsStateResolved  ListDunningRunsParamsState = "resolved"
)

Defines values for ListDunningRunsParamsState.

func (ListDunningRunsParamsState) Valid

func (e ListDunningRunsParamsState) Valid() bool

Valid indicates whether the value is a known member of the ListDunningRunsParamsState enum.

type ListInvoiceDisputesParams

type ListInvoiceDisputesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListInvoiceDisputesParams defines parameters for ListInvoiceDisputes.

type ListInvoiceStripeRefundsParams added in v0.9.2

type ListInvoiceStripeRefundsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListInvoiceStripeRefundsParams defines parameters for ListInvoiceStripeRefunds.

type ListInvoicesParams added in v0.9.2

type ListInvoicesParams struct {
	// CustomerId Only this customer's invoices.
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// SubscriptionId Only invoices that bill this subscription.
	SubscriptionId string `form:"subscription_id,omitempty" json:"subscription_id,omitempty"`

	// Status Only invoices in this status: `draft`, `finalized`, `paid`,
	// `voided` or `uncollectible`. Another value matches nothing.
	Status string `form:"status,omitempty" json:"status,omitempty"`

	// PaymentStatus Only invoices with this payment status: `pending`, `processing`,
	// `succeeded`, `failed` or `unknown`. Another value matches
	// nothing.
	PaymentStatus string `form:"payment_status,omitempty" json:"payment_status,omitempty"`

	// Search Case-insensitive substring match on the invoice number, or on
	// the customer's name or email, also when customer data is
	// encrypted (`HARDCOUNT_ENCRYPTION_KEY`). Names and emails are
	// matched among the 5,000 customers created last in this mode; an
	// invoice of an older customer is still found by its number.
	Search string `form:"search,omitempty" json:"search,omitempty"`

	// From Lower bound on created_at, inclusive. RFC3339 instant or
	// bare YYYY-MM-DD (anchored at 00:00:00Z).
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Upper bound on created_at, inclusive. RFC3339 instant or
	// bare YYYY-MM-DD (anchored at 23:59:59.999999Z, the end of that day).
	To string `form:"to,omitempty" json:"to,omitempty"`

	// Overdue `true` keeps only open invoices past their due date: `finalized`,
	// `due_at` before the current real time, and `payment_status` not
	// `succeeded`, `processing` or `unknown`. Any other value applies
	// no filter. The dashboard's Past due view uses it.
	Overdue bool `form:"overdue,omitempty" json:"overdue,omitempty"`

	// Ids Comma-separated invoice IDs to fetch exactly.
	Ids string `form:"ids,omitempty" json:"ids,omitempty"`

	// Sort The order of the list. `created_at` (the default), `invoice_number`,
	// `amount_due_cents` (or `amount_due`), `billing_period_start` (or
	// `period`), `due_at`, `issued_at`, `status` or `payment_status`.
	// `amount_due_cents` sorts a paid invoice by what paid it
	// (`amount_paid_cents` plus `credits_applied_cents`, since paying zeroes
	// `amount_due_cents`) and every other invoice by `amount_due_cents`,
	// which a voided or written-off invoice keeps. Any other value is a
	// 422 with `param: sort`. Ties are broken by `id` in the same
	// direction.
	Sort ListInvoicesParamsSort `form:"sort,omitempty" json:"sort,omitempty"`

	// Dir Sort direction: `desc` (the default) or `asc`, in lower case. Any
	// other value is a 422 with `param: dir`.
	Dir ListInvoicesParamsDir `form:"dir,omitempty" json:"dir,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListInvoicesParams defines parameters for ListInvoices.

type ListInvoicesParamsDir added in v0.9.2

type ListInvoicesParamsDir string

ListInvoicesParamsDir defines parameters for ListInvoices.

const (
	ListInvoicesParamsDirAsc  ListInvoicesParamsDir = "asc"
	ListInvoicesParamsDirDesc ListInvoicesParamsDir = "desc"
)

Defines values for ListInvoicesParamsDir.

func (ListInvoicesParamsDir) Valid added in v0.9.2

func (e ListInvoicesParamsDir) Valid() bool

Valid indicates whether the value is a known member of the ListInvoicesParamsDir enum.

type ListInvoicesParamsSort added in v0.9.2

type ListInvoicesParamsSort string

ListInvoicesParamsSort defines parameters for ListInvoices.

const (
	ListInvoicesParamsSortAmountDue          ListInvoicesParamsSort = "amount_due"
	ListInvoicesParamsSortAmountDueCents     ListInvoicesParamsSort = "amount_due_cents"
	ListInvoicesParamsSortBillingPeriodStart ListInvoicesParamsSort = "billing_period_start"
	ListInvoicesParamsSortCreatedAt          ListInvoicesParamsSort = "created_at"
	ListInvoicesParamsSortDueAt              ListInvoicesParamsSort = "due_at"
	ListInvoicesParamsSortInvoiceNumber      ListInvoicesParamsSort = "invoice_number"
	ListInvoicesParamsSortIssuedAt           ListInvoicesParamsSort = "issued_at"
	ListInvoicesParamsSortPaymentStatus      ListInvoicesParamsSort = "payment_status"
	ListInvoicesParamsSortPeriod             ListInvoicesParamsSort = "period"
	ListInvoicesParamsSortStatus             ListInvoicesParamsSort = "status"
)

Defines values for ListInvoicesParamsSort.

func (ListInvoicesParamsSort) Valid added in v0.9.2

func (e ListInvoicesParamsSort) Valid() bool

Valid indicates whether the value is a known member of the ListInvoicesParamsSort enum.

type ListMetersParams added in v0.9.2

type ListMetersParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListMetersParams defines parameters for ListMeters.

type ListPlanPricesParams

type ListPlanPricesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListPlanPricesParams defines parameters for ListPlanPrices.

type ListPlansParams added in v0.9.2

type ListPlansParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListPlansParams defines parameters for ListPlans.

type ListPriceOverridesParams

type ListPriceOverridesParams struct {
	// CustomerId Only this customer's overrides.
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// PriceId Only this price's overrides.
	PriceId string `form:"price_id,omitempty" json:"price_id,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListPriceOverridesParams defines parameters for ListPriceOverrides.

type ListProviderCostsParams added in v0.9.2

type ListProviderCostsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListProviderCostsParams defines parameters for ListProviderCosts.

type ListRecipeInstancesParams

type ListRecipeInstancesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListRecipeInstancesParams defines parameters for ListRecipeInstances.

type ListRecipesParams

type ListRecipesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListRecipesParams defines parameters for ListRecipes.

type ListSubscriptionsParams added in v0.9.2

type ListSubscriptionsParams struct {
	// CustomerId Only this customer's subscriptions (`hc_cus_…`).
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// PlanId Filter to subscriptions with a live item on this plan.
	PlanId string `form:"plan_id,omitempty" json:"plan_id,omitempty"`

	// Status Exact status. Any other value is a 422 with `param: status`.
	// Paused collection is not
	// a status: use `collection=paused`.
	Status ListSubscriptionsParamsStatus `form:"status,omitempty" json:"status,omitempty"`

	// Billing `failing` returns only subscriptions that carry a
	// `billing_failure`: those waiting for their next billing attempt
	// and those that are parked. Any other value is a 422 with
	// `param: billing`.
	Billing ListSubscriptionsParamsBilling `form:"billing,omitempty" json:"billing,omitempty"`

	// Collection `paused` returns only active and trialing subscriptions whose
	// `pause_collection` is in force, whether an operator or dunning set
	// it. A timed pause ends at `resumes_at` (on the subscription's test
	// clock, if it has one), even while the response still carries it.
	// Any other value is a 422 with `param: collection`.
	Collection ListSubscriptionsParamsCollection `form:"collection,omitempty" json:"collection,omitempty"`

	// Search Case-insensitive substring match on display name or code.
	Search string `form:"search,omitempty" json:"search,omitempty"`

	// Sort The order of the list. `created_at` (the default),
	// `next_billing_at`, `status`, `display_name` (or `name`) or
	// `trial_end_at`. Any other value is a 422 with `param: sort`. Ties
	// are broken by `id` in the same direction.
	Sort ListSubscriptionsParamsSort `form:"sort,omitempty" json:"sort,omitempty"`

	// Dir Sort direction: `desc` (the default) or `asc`, in lower case. Any
	// other value is a 422 with `param: dir`.
	Dir ListSubscriptionsParamsDir `form:"dir,omitempty" json:"dir,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListSubscriptionsParams defines parameters for ListSubscriptions.

type ListSubscriptionsParamsBilling added in v0.9.2

type ListSubscriptionsParamsBilling string

ListSubscriptionsParamsBilling defines parameters for ListSubscriptions.

const (
	Failing ListSubscriptionsParamsBilling = "failing"
)

Defines values for ListSubscriptionsParamsBilling.

func (ListSubscriptionsParamsBilling) Valid added in v0.9.2

Valid indicates whether the value is a known member of the ListSubscriptionsParamsBilling enum.

type ListSubscriptionsParamsCollection added in v0.9.2

type ListSubscriptionsParamsCollection string

ListSubscriptionsParamsCollection defines parameters for ListSubscriptions.

const (
	Paused ListSubscriptionsParamsCollection = "paused"
)

Defines values for ListSubscriptionsParamsCollection.

func (ListSubscriptionsParamsCollection) Valid added in v0.9.2

Valid indicates whether the value is a known member of the ListSubscriptionsParamsCollection enum.

type ListSubscriptionsParamsDir added in v0.9.2

type ListSubscriptionsParamsDir string

ListSubscriptionsParamsDir defines parameters for ListSubscriptions.

const (
	Asc  ListSubscriptionsParamsDir = "asc"
	Desc ListSubscriptionsParamsDir = "desc"
)

Defines values for ListSubscriptionsParamsDir.

func (ListSubscriptionsParamsDir) Valid added in v0.9.2

func (e ListSubscriptionsParamsDir) Valid() bool

Valid indicates whether the value is a known member of the ListSubscriptionsParamsDir enum.

type ListSubscriptionsParamsSort added in v0.9.2

type ListSubscriptionsParamsSort string

ListSubscriptionsParamsSort defines parameters for ListSubscriptions.

const (
	ListSubscriptionsParamsSortCreatedAt     ListSubscriptionsParamsSort = "created_at"
	ListSubscriptionsParamsSortDisplayName   ListSubscriptionsParamsSort = "display_name"
	ListSubscriptionsParamsSortName          ListSubscriptionsParamsSort = "name"
	ListSubscriptionsParamsSortNextBillingAt ListSubscriptionsParamsSort = "next_billing_at"
	ListSubscriptionsParamsSortStatus        ListSubscriptionsParamsSort = "status"
	ListSubscriptionsParamsSortTrialEndAt    ListSubscriptionsParamsSort = "trial_end_at"
)

Defines values for ListSubscriptionsParamsSort.

func (ListSubscriptionsParamsSort) Valid added in v0.9.2

Valid indicates whether the value is a known member of the ListSubscriptionsParamsSort enum.

type ListSubscriptionsParamsStatus added in v0.9.2

type ListSubscriptionsParamsStatus string

ListSubscriptionsParamsStatus defines parameters for ListSubscriptions.

const (
	ListSubscriptionsParamsStatusActive   ListSubscriptionsParamsStatus = "active"
	ListSubscriptionsParamsStatusCanceled ListSubscriptionsParamsStatus = "canceled"
	ListSubscriptionsParamsStatusDraft    ListSubscriptionsParamsStatus = "draft"
	ListSubscriptionsParamsStatusTrialing ListSubscriptionsParamsStatus = "trialing"
)

Defines values for ListSubscriptionsParamsStatus.

func (ListSubscriptionsParamsStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the ListSubscriptionsParamsStatus enum.

type ListTestClockCustomersParams

type ListTestClockCustomersParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListTestClockCustomersParams defines parameters for ListTestClockCustomers.

type ListTestClockSubscriptionsParams added in v0.9.2

type ListTestClockSubscriptionsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListTestClockSubscriptionsParams defines parameters for ListTestClockSubscriptions.

type ListTestClocksParams added in v0.9.2

type ListTestClocksParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListTestClocksParams defines parameters for ListTestClocks.

type ListTotal

type ListTotal = int

ListTotal How many rows match the request's filters, on every page, not only this one. The audit log and the customer list's search and name or email sort say where they stop counting.

type ListUsageEventsParams added in v0.9.2

type ListUsageEventsParams struct {
	// CustomerId Only this customer's events (`hc_cus_…`, the Hardcount ID, not your external ID).
	CustomerId string `form:"customer_id,omitempty" json:"customer_id,omitempty"`

	// MeterId Only this meter's events (`hc_mtr_…`).
	MeterId string `form:"meter_id,omitempty" json:"meter_id,omitempty"`

	// Dimensions Comma-separated key=value pairs matched against the event's
	// dimensions; every pair must match. Values that read as JSON
	// booleans or numbers match typed values ("cached=true",
	// "attempt=2"); everything else matches as a string. A malformed
	// pair is refused with 422. Example:
	// `model=gpt-4o,token_type=input`.
	Dimensions string `form:"dimensions,omitempty" json:"dimensions,omitempty"`

	// From Only events at or after this time. RFC 3339, or a date (YYYY-MM-DD) meaning 00:00:00 UTC.
	From string `form:"from,omitempty" json:"from,omitempty"`

	// To Only events before this time, exclusive. RFC 3339, or a date (YYYY-MM-DD) meaning 23:59:59.999999 UTC that day, so the day is included.
	To string `form:"to,omitempty" json:"to,omitempty"`

	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListUsageEventsParams defines parameters for ListUsageEvents.

type ListWebhookEndpointDeliveriesParams

type ListWebhookEndpointDeliveriesParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListWebhookEndpointDeliveriesParams defines parameters for ListWebhookEndpointDeliveries.

type ListWebhookEndpointsParams added in v0.9.2

type ListWebhookEndpointsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListWebhookEndpointsParams defines parameters for ListWebhookEndpoints.

type ListWebhookEventsParams added in v0.9.2

type ListWebhookEventsParams struct {
	// Limit Rows per page, from 1 to 100. Default 50. Any other value, one that
	// is not a whole number, or `limit` sent twice is a 422 with
	// `param: limit`. It is never clamped.
	Limit Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset Rows to skip, 0 or more. Default 0. A negative value, one that is
	// not a whole number, or `offset` sent twice is a 422 with
	// `param: offset`.
	Offset Offset `form:"offset,omitempty" json:"offset,omitempty"`
}

ListWebhookEventsParams defines parameters for ListWebhookEvents.

type LitellmSpendLog

type LitellmSpendLog struct {
	// CacheHit `true` when LiteLLM answered from its own response cache. The
	// record is skipped and counted in `cache_hits`: the provider
	// charged nothing.
	CacheHit bool `json:"cache_hit,omitempty"`

	// CallType A record bills on its token counts unless its call type is one
	// Hardcount does not bill (images, audio, realtime, moderation,
	// batches, files, A2A, response retrieval, ...); those are
	// skipped, and a skipped record that carries tokens is logged.
	CallType string `json:"call_type,omitempty"`

	// CompletionTokens Output tokens. Used when there is no `usage` object.
	CompletionTokens int64 `json:"completion_tokens,omitempty"`

	// CostBreakdown The provider's own cost, in dollars. When present, each event's
	// provider cost comes from its part (input, output, cache read or
	// cache write) instead of the provider-costs table. A negative
	// part falls back to the table. A missing `input_cost` or
	// `output_cost` reads as 0 and is recorded as a cost of 0; a
	// missing `cache_read_cost` or `cache_creation_cost` means
	// unknown. `input_cost` includes cache reads and cache writes, so
	// the input event gets `input_cost` minus `cache_read_cost` and
	// `cache_creation_cost`. If there were cache reads but no
	// `cache_read_cost`, the input and cache-read events use the
	// provider-costs table; if there were split-off cache writes but
	// no `cache_creation_cost`, the input and cache-write events do.
	// With 1-hour cache writes the input and cache-write events always
	// do: LiteLLM prices `cache_creation_cost` at the 5-minute rate.
	CostBreakdown struct {
		// CacheCreationCost LiteLLM's cost of the cache writes, in dollars, priced at the 5-minute rate.
		CacheCreationCost float32 `json:"cache_creation_cost,omitempty"`

		// CacheReadCost The part of `input_cost` spent on cache reads, in dollars.
		CacheReadCost float32 `json:"cache_read_cost,omitempty"`

		// InputCost The cost of the whole prompt, in dollars, cache reads and writes included.
		InputCost float32 `json:"input_cost,omitempty"`

		// OutputCost The cost of the output tokens, in dollars.
		OutputCost float32 `json:"output_cost,omitempty"`

		// ToolUsageCost Accepted but not used.
		ToolUsageCost float32 `json:"tool_usage_cost,omitempty"`

		// TotalCost Accepted but not used.
		TotalCost float32 `json:"total_cost,omitempty"`
	} `json:"cost_breakdown,omitempty"`

	// CustomLlmProvider The provider LiteLLM sent the call to, such as `openai`. Each event carries it as the `provider` dimension.
	CustomLlmProvider string `json:"custom_llm_provider,omitempty"`

	// EndTime Unix seconds. The event time. With neither, the customer's current time is used.
	EndTime float32 `json:"endTime,omitempty"`

	// EndUser Where LiteLLM Proxy puts the caller's `user`. Used when `user` is empty.
	EndUser string `json:"end_user,omitempty"`

	// Id LiteLLM's call id. Used to build the events' idempotency keys.
	Id string `json:"id,omitempty"`

	// Metadata `team_id` and `request_tags` become event dimensions (a list of
	// tags becomes one sorted, comma-separated string);
	// `usage_object` is read for token counts; `user_api_key_end_user_id`
	// names the customer when `user` and `end_user` are empty; a
	// `user_api_key_request_route` of `/vertex_ai/live` on a
	// `pass_through_endpoint` record marks Vertex AI Live audio, which
	// is skipped. Other keys do not change billing.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// Model The model the call used, as LiteLLM names it. Each event
	// carries it as the `model_raw` dimension, and as `model` the
	// model family name when Hardcount recognises it (the name as
	// sent otherwise).
	Model string `json:"model,omitempty"`

	// PromptTokens Used when there is no `usage` object.
	PromptTokens int64 `json:"prompt_tokens,omitempty"`

	// ResponseCost Accepted but not stored.
	ResponseCost float32 `json:"response_cost,omitempty"`

	// StartTime Unix seconds. Event time when `endTime` is absent.
	StartTime float32 `json:"startTime,omitempty"`

	// Status A `failure` record (a call the provider refused or that timed out) is skipped, whatever token counts it carries.
	Status string `json:"status,omitempty"`

	// TotalTokens Accepted but not used.
	TotalTokens int64 `json:"total_tokens,omitempty"`

	// Usage The call's token counts. When it is absent, Hardcount reads
	// `metadata.usage_object`, then the top-level `prompt_tokens` and
	// `completion_tokens`.
	Usage struct {
		// CacheCreationInputTokens Cache-write tokens, included in prompt_tokens. Split into `cache_write_5m` and `cache_write_1h` by `prompt_tokens_details.cache_creation_token_details`.
		CacheCreationInputTokens int64 `json:"cache_creation_input_tokens,omitempty"`

		// CacheReadInputTokens Anthropic's cache-read tokens, included in prompt_tokens.
		// Hardcount takes the larger of this and
		// `prompt_tokens_details.cached_tokens` as the `cache_read`
		// event.
		CacheReadInputTokens int64 `json:"cache_read_input_tokens,omitempty"`

		// CompletionTokens Output tokens. They become the `output` event.
		CompletionTokens int64 `json:"completion_tokens,omitempty"`

		// PromptTokens Includes cache-read tokens.
		PromptTokens int64 `json:"prompt_tokens,omitempty"`

		// PromptTokensDetails The breakdown of `prompt_tokens`, as LiteLLM reports it.
		PromptTokensDetails struct {
			// CacheCreationTokenDetails Anthropic's cache writes by cache lifetime. They become
			// `cache_write_5m` and `cache_write_1h` events, taken out
			// of `input`. Without this split, when it does not add up
			// to the cache-write count, or when the writes do not fit
			// in `prompt_tokens` less the cache reads, the writes stay
			// in `input`.
			CacheCreationTokenDetails struct {
				// Ephemeral1hInputTokens Cache writes with a 1-hour lifetime. They become the `cache_write_1h` event.
				Ephemeral1hInputTokens int64 `json:"ephemeral_1h_input_tokens,omitempty"`

				// Ephemeral5mInputTokens Cache writes with a 5-minute lifetime. They become the `cache_write_5m` event.
				Ephemeral5mInputTokens int64 `json:"ephemeral_5m_input_tokens,omitempty"`
			} `json:"cache_creation_token_details,omitempty"`

			// CacheCreationTokens Prompt tokens written to the provider's cache. Hardcount
			// takes the larger of this and
			// `cache_creation_input_tokens`.
			CacheCreationTokens int64 `json:"cache_creation_tokens,omitempty"`

			// CachedTokens Prompt tokens read from the provider's cache. They become
			// the `cache_read` event, taken out of `input`.
			CachedTokens int64 `json:"cached_tokens,omitempty"`
		} `json:"prompt_tokens_details,omitempty"`

		// TotalTokens Accepted but not used.
		TotalTokens int64 `json:"total_tokens,omitempty"`
	} `json:"usage,omitempty"`

	// User The customer's external_id.
	User string `json:"user,omitempty"`
}

LitellmSpendLog The fields of a LiteLLM `StandardLoggingPayload` that Hardcount reads. Other fields are accepted and ignored.

type LitellmSpendResult

type LitellmSpendResult struct {
	// Accepted Usage events newly recorded.
	Accepted int `json:"accepted"`

	// AfterClose Of `accepted`, the events answered `billing_status:
	// after_close`: their time was already invoiced. A replay never
	// counts here.
	AfterClose int `json:"after_close"`

	// CacheHits The LiteLLM response-cache hits among `skipped`. LiteLLM's own spend counts them as $0.
	CacheHits int `json:"cache_hits"`

	// Deduplicated Usage events already recorded, or already held, by an earlier delivery.
	Deduplicated int `json:"deduplicated"`

	// Errors One entry per record that was not recorded. A record's events are
	// recorded together or not at all. Absent when every record was
	// recorded, held or skipped.
	Errors []struct {
		// Error Why the record was not recorded, such as a missing `user`.
		Error string `json:"error"`

		// Id The LiteLLM record id.
		Id string `json:"id"`
	} `json:"errors,omitempty"`

	// Held Usage events kept because their customer or meter does not
	// exist yet. Not billed until released with
	// `POST /v1/usage-events/held/release`.
	Held int `json:"held"`

	// NoPrice Of `accepted`, the events no price of the subscription's plan
	// takes (`billing_status: no_price`), such as a model no price
	// names. A replay never counts here.
	NoPrice int `json:"no_price"`

	// NotOnPlan Of `accepted`, the events whose meter the subscription's plan
	// does not price (`billing_status: not_on_plan`). A replay never
	// counts here.
	NotOnPlan int `json:"not_on_plan"`

	// OutsideSubscription Of `accepted`, the events whose time no subscription of the
	// customer bills (`billing_status: outside_subscription`). A replay
	// never counts here.
	OutsideSubscription int `json:"outside_subscription"`

	// Skipped Records that bill nothing - a call type Hardcount does not bill (even when it carries tokens), no token counts, a failed call (`status` `failure`) or a LiteLLM response-cache hit.
	Skipped int `json:"skipped"`
}

LitellmSpendResult What `POST /v1/integrations/litellm/spend` did with the records it received. Each record becomes up to five usage events, one per token type; the counts below count events, except `skipped` and `cache_hits`, which count records.

type LoginJSONBody added in v0.9.2

type LoginJSONBody struct {
	// Email The user's sign-in email.
	Email openapi_types.Email `json:"email"`

	// Password The user's password.
	Password string `json:"password"`
}

LoginJSONBody defines parameters for Login.

type LoginJSONRequestBody added in v0.9.2

type LoginJSONRequestBody LoginJSONBody

LoginJSONRequestBody defines body for Login for application/json ContentType.

type MarginReport

type MarginReport struct {
	// ByModel One row per model that has stamped cost or attributed revenue in
	// the window, largest revenue first, then largest cost.
	ByModel []struct {
		// Attributed True only when the price that billed the usage names this
		// model, so revenue is never split by a guess.
		Attributed bool `json:"attributed"`

		// CostCents This model's stamped provider cost in US cents, as a decimal string.
		CostCents string `json:"cost_cents"`

		// MarginBps This model's (revenue − cost) / revenue in basis points, by
		// the same formula as the report's `margin_bps`. Absent
		// whenever the report's `margin_bps` is absent for currency or
		// `unresolved_events`, and when the row is not attributed or
		// has no provider cost of its own.
		MarginBps int64 `json:"margin_bps,omitempty"`

		// Model The model, from the events' `model` label (else their
		// `model_raw` label, else `(unknown)`), or from the price's
		// `dimension_match` for revenue with no stamped cost.
		Model string `json:"model"`

		// RevenueCents The revenue of the prices that name this model, in the
		// minor unit of `revenue_currency`. Absent when the row is
		// not attributed or the revenue is 0.
		RevenueCents int64 `json:"revenue_cents,omitempty"`
	} `json:"by_model"`

	// CostCents Total stamped provider cost in US cents, as a decimal string (e.g. "275.75").
	CostCents string `json:"cost_cents"`

	// CostCurrency Currency of `cost_cents`. Always USD.
	CostCurrency string `json:"cost_currency"`

	// CostRatesConfigured Whether the account has any provider cost rate in this mode. False
	// with `costed_events` 0 means no rates are set up.
	CostRatesConfigured bool `json:"cost_rates_configured"`

	// CostedEvents Events in the window that carry a stamped provider cost (zero cost
	// included). 0 means the cost side is unknown.
	CostedEvents int64 `json:"costed_events"`

	// CustomerId The customer the report is about.
	CustomerId string `json:"customer_id"`

	// From Start of the window, inclusive.
	From time.Time `json:"from"`

	// MarginBps (revenue − cost) / revenue in basis points (100 = 1%). Absent
	// when revenue is 0, when `revenue_currency` is not
	// `cost_currency`, when `costed_events` is 0 (no provider cost
	// known), or when `unresolved_events` is above 0 (part of the
	// cost unknown, so the margin would read too high).
	MarginBps int64 `json:"margin_bps,omitempty"`

	// RevenueCents Total rated usage revenue in the window, in the minor unit of
	// `revenue_currency` (cents for USD). It is an estimate at each
	// subscription's current prices. Only active and trialing
	// subscriptions are counted.
	RevenueCents int64 `json:"revenue_cents"`

	// RevenueCurrency Currency of `revenue_cents` (the currency of the customer's
	// prices). Absent when the window's revenue spans more than one
	// currency, or the customer has no priced meter.
	RevenueCurrency string `json:"revenue_currency,omitempty"`

	// To End of the window, exclusive.
	To time.Time `json:"to"`

	// UnattributedRevenueCents The revenue of prices that name no model, in the minor unit of
	// `revenue_currency` (cents for USD).
	UnattributedRevenueCents int64 `json:"unattributed_revenue_cents"`

	// UnresolvedEvents Usage events in the window that carry `provider` and
	// `token_type` labels and a `model` or `model_raw` label, but have
	// no cost: no rate matched (add a rate to cost new events), or the
	// cost, quantity × `unit_cost_cents`, was too large to record
	// (about $9.2 trillion or more, either sign).
	UnresolvedEvents int64 `json:"unresolved_events"`
}

MarginReport One customer's usage revenue against what that usage cost you at your AI providers, for a window: `GET /v1/customers/{id}/margin`. It looks only at usage: base fees, credits and tax are not in it. Revenue is shown per model only where the price that billed the usage names the model in its `dimension_match`; other revenue is reported as unattributed, never split by a guess.

type MarkInvoiceUncollectibleParams

type MarkInvoiceUncollectibleParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

MarkInvoiceUncollectibleParams defines parameters for MarkInvoiceUncollectible.

type MemberInvitation

type MemberInvitation struct {
	// AcceptedAt When the invitee accepted. Absent until then.
	AcceptedAt time.Time `json:"accepted_at,omitempty"`

	// CreatedAt When the invitation was created and its email queued.
	CreatedAt time.Time `json:"created_at"`

	// Email The invited address, in lower case. It becomes the new member's sign-in email.
	Email string `json:"email"`

	// ExpiresAt When the accept link stops working, 7 days after `created_at`.
	ExpiresAt time.Time `json:"expires_at"`

	// Id The invitation's id (`hc_minv_…`).
	Id string `json:"id"`

	// InvitedByEmail The sign-in email of the member who sent the invitation. Absent when that user no longer exists.
	InvitedByEmail string `json:"invited_by_email,omitempty"`

	// RevokedAt When the invitation was revoked, by a member or because its
	// email could not be queued. Absent unless it was revoked.
	RevokedAt time.Time `json:"revoked_at,omitempty"`

	// Role Always `member` for an invitation. Roles are recorded but not
	// enforced yet: every member can do everything in the dashboard.
	Role string `json:"role"`

	// Status `pending` until the invitation is accepted or revoked, or until
	// `expires_at` passes (`expired`). The server works it out each
	// time it answers.
	Status MemberInvitationStatus `json:"status"`
}

MemberInvitation An invitation for a teammate to join this account's dashboard. `POST /v1/members/invite` returns it, and `GET /v1/members` lists every invitation the account has sent, newest first.

type MemberInvitationStatus

type MemberInvitationStatus string

MemberInvitationStatus `pending` until the invitation is accepted or revoked, or until `expires_at` passes (`expired`). The server works it out each time it answers.

const (
	MemberInvitationStatusAccepted MemberInvitationStatus = "accepted"
	MemberInvitationStatusExpired  MemberInvitationStatus = "expired"
	MemberInvitationStatusPending  MemberInvitationStatus = "pending"
	MemberInvitationStatusRevoked  MemberInvitationStatus = "revoked"
)

Defines values for MemberInvitationStatus.

func (MemberInvitationStatus) Valid

func (e MemberInvitationStatus) Valid() bool

Valid indicates whether the value is a known member of the MemberInvitationStatus enum.

type Meter

type Meter struct {
	// Aggregation How the meter rolls its events into one quantity per billing
	// period: `sum` adds the quantities, `count` counts the events,
	// `max` takes the highest quantity, and `last` takes the latest
	// event's quantity, by timestamp, then by id. Every price of the
	// meter bills under it. Fixed once the meter has a usage event
	// (see `has_usage`).
	Aggregation MeterAggregation `json:"aggregation"`

	// CreatedAt When the meter was created.
	CreatedAt time.Time `json:"created_at"`

	// EventName The `event_name` usage events send for this meter. Letters,
	// digits, `-` and `_`, at most 100 characters. Unique in the
	// account and mode, and fixed after create.
	EventName string `json:"event_name"`

	// HasUsage Whether the meter has usage events. Once it has, its
	// `aggregation` cannot change. Held usage for its `event_name`
	// does not count until it is released. Returned when you create,
	// get or update one meter; the meter list leaves it out. A create
	// or update that succeeded leaves it out if it could not be read.
	HasUsage bool `json:"has_usage,omitempty"`

	// Id The meter's ID, `hc_mtr_` and 20 characters.
	Id string `json:"id"`

	// Name The meter's display name, at most 255 bytes (UTF-8).
	Name string `json:"name"`

	// TenantId The account the meter belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// Unit The unit of the quantity, such as `tokens` or `seconds`.
	// `unit` when none was given.
	Unit string `json:"unit"`

	// UpdatedAt When the meter was last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

Meter A meter counts one kind of usage: every usage event that sends its `event_name`. A meter has no price of its own. Plans price it (`/v1/plans/{id}/prices`). Create, list, get and update meters under `/v1/meters`.

type MeterAggregation

type MeterAggregation string

MeterAggregation How the meter rolls its events into one quantity per billing period: `sum` adds the quantities, `count` counts the events, `max` takes the highest quantity, and `last` takes the latest event's quantity, by timestamp, then by id. Every price of the meter bills under it. Fixed once the meter has a usage event (see `has_usage`).

const (
	MeterAggregationCount MeterAggregation = "count"
	MeterAggregationLast  MeterAggregation = "last"
	MeterAggregationMax   MeterAggregation = "max"
	MeterAggregationSum   MeterAggregation = "sum"
)

Defines values for MeterAggregation.

func (MeterAggregation) Valid

func (e MeterAggregation) Valid() bool

Valid indicates whether the value is a known member of the MeterAggregation enum.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Offset

type Offset = int

Offset defines model for Offset.

type PauseSubscriptionCollectionJSONBody

type PauseSubscriptionCollectionJSONBody struct {
	// Behavior What happens to invoices built during the pause. Only
	// `keep_as_draft`, which keeps them as drafts.
	Behavior PauseSubscriptionCollectionJSONBodyBehavior `json:"behavior"`

	// ResumesAt When collection resumes. Must be in the future.
	ResumesAt time.Time `json:"resumes_at,omitempty"`
}

PauseSubscriptionCollectionJSONBody defines parameters for PauseSubscriptionCollection.

type PauseSubscriptionCollectionJSONBodyBehavior

type PauseSubscriptionCollectionJSONBodyBehavior string

PauseSubscriptionCollectionJSONBodyBehavior defines parameters for PauseSubscriptionCollection.

const (
	PauseSubscriptionCollectionJSONBodyBehaviorKeepAsDraft PauseSubscriptionCollectionJSONBodyBehavior = "keep_as_draft"
)

Defines values for PauseSubscriptionCollectionJSONBodyBehavior.

func (PauseSubscriptionCollectionJSONBodyBehavior) Valid

Valid indicates whether the value is a known member of the PauseSubscriptionCollectionJSONBodyBehavior enum.

type PauseSubscriptionCollectionJSONRequestBody

type PauseSubscriptionCollectionJSONRequestBody PauseSubscriptionCollectionJSONBody

PauseSubscriptionCollectionJSONRequestBody defines body for PauseSubscriptionCollection for application/json ContentType.

type PauseSubscriptionCollectionParams

type PauseSubscriptionCollectionParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

PauseSubscriptionCollectionParams defines parameters for PauseSubscriptionCollection.

type PaymentMethod

type PaymentMethod struct {
	// CardBrand The card network as Stripe names it, such as `visa` or
	// `mastercard`. Absent when Stripe sent none.
	CardBrand string `json:"card_brand,omitempty"`

	// CardExpMonth The card's expiry month, 1 to 12. Absent when Stripe sent none.
	CardExpMonth int `json:"card_exp_month,omitempty"`

	// CardExpYear The card's expiry year, such as `2029`. Absent when Stripe sent none.
	CardExpYear int `json:"card_exp_year,omitempty"`

	// CardLast4 The last 4 digits of the card number. Absent when Stripe sent none.
	CardLast4 string `json:"card_last4,omitempty"`

	// CreatedAt When the card was saved.
	CreatedAt time.Time `json:"created_at"`

	// CustomerId The customer the card belongs to.
	CustomerId string `json:"customer_id"`

	// Id The payment method's ID in Hardcount, `hc_pm_` and 24 hex characters.
	Id string `json:"id"`

	// IsDefault Whether this is the card Hardcount charges. A customer with saved
	// cards has one default.
	IsDefault bool `json:"is_default"`

	// Type The kind of payment method. Always `card` today.
	Type string `json:"type"`
}

PaymentMethod A card saved for a customer in Stripe, which Hardcount can charge. The payment-method routes under `/v1/customers/{customer_id}/payment-methods` return it, and the `payment_method.*` webhook events carry it.

type Plan

type Plan struct {
	// BaseAmountCents The recurring base fee per billing period, in the currency's minor
	// unit (cents for USD). 0 for a usage-only plan.
	BaseAmountCents int64 `json:"base_amount_cents"`

	// BaseBillTiming When the base fee is invoiced, relative to the period it
	// covers. `in_arrears`: the base fee and the usage are billed at
	// the period end. `in_advance`: the base fee is billed at the
	// period start; the first invoice comes when the subscription
	// starts, and each cycle invoice carries the next period's base
	// fee with the past period's usage. Usage is always billed at
	// the period end. A plan with no base fee is `in_arrears`.
	BaseBillTiming PlanBaseBillTiming `json:"base_bill_timing"`

	// BillingInterval How often a subscription to the plan is billed. Fixed after create.
	BillingInterval PlanBillingInterval `json:"billing_interval"`

	// Code Your short name for the plan. Letters, digits, `-` and `_`, at
	// most 100 characters, unique in the account and mode. Fixed
	// after create.
	Code string `json:"code"`

	// CreatedAt When the plan was created.
	CreatedAt time.Time `json:"created_at"`

	// Currency ISO 4217 code in upper case, such as `USD`. Fixed after create.
	// The plan's prices take it.
	Currency string `json:"currency"`

	// Description Your description of the plan. Absent when empty.
	Description string `json:"description,omitempty"`

	// Id The plan's ID, `hc_pln_` and 20 characters.
	Id string `json:"id"`

	// Name The plan's display name. Create refuses one longer than 255
	// bytes (UTF-8); an update does not check the length.
	Name string `json:"name"`

	// Prices The plan's usage prices from now on, in the order they were
	// added. A plan's meters are the meters it has a price for.
	Prices []PlanPrice `json:"prices"`

	// Status An archived plan takes no new subscriptions and no plan change
	// onto it. Subscriptions already on it keep billing.
	Status PlanStatus `json:"status"`

	// TaxCode A Stripe product tax code, such as `txcd_10103001`, read only
	// by the Stripe Tax provider. Today only the base fee line of the
	// invoice billed when an in-advance subscription starts carries
	// it; cycle invoices and usage lines use the account's
	// `default_product_tax_code`. Absent when not set.
	TaxCode string `json:"tax_code,omitempty"`

	// TenantId The account the plan belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the plan was last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

Plan A plan is what a subscription buys: a recurring base fee and the usage prices of its meters, in one currency and billing interval. `GET /v1/plans` lists plans in this shape. Get, create and update answer a `PlanDetail`, which adds two fields.

type PlanBaseBillTiming

type PlanBaseBillTiming string

PlanBaseBillTiming When the base fee is invoiced, relative to the period it covers. `in_arrears`: the base fee and the usage are billed at the period end. `in_advance`: the base fee is billed at the period start; the first invoice comes when the subscription starts, and each cycle invoice carries the next period's base fee with the past period's usage. Usage is always billed at the period end. A plan with no base fee is `in_arrears`.

const (
	PlanBaseBillTimingInAdvance PlanBaseBillTiming = "in_advance"
	PlanBaseBillTimingInArrears PlanBaseBillTiming = "in_arrears"
)

Defines values for PlanBaseBillTiming.

func (PlanBaseBillTiming) Valid

func (e PlanBaseBillTiming) Valid() bool

Valid indicates whether the value is a known member of the PlanBaseBillTiming enum.

type PlanBillingInterval

type PlanBillingInterval string

PlanBillingInterval How often a subscription to the plan is billed. Fixed after create.

const (
	PlanBillingIntervalMonthly PlanBillingInterval = "monthly"
	PlanBillingIntervalYearly  PlanBillingInterval = "yearly"
)

Defines values for PlanBillingInterval.

func (PlanBillingInterval) Valid

func (e PlanBillingInterval) Valid() bool

Valid indicates whether the value is a known member of the PlanBillingInterval enum.

type PlanDetail

type PlanDetail struct {
	// BaseAmountCents The recurring base fee per billing period, in the currency's minor
	// unit (cents for USD). 0 for a usage-only plan.
	BaseAmountCents int64 `json:"base_amount_cents"`

	// BaseBillTiming When the base fee is invoiced, relative to the period it
	// covers. `in_arrears`: the base fee and the usage are billed at
	// the period end. `in_advance`: the base fee is billed at the
	// period start; the first invoice comes when the subscription
	// starts, and each cycle invoice carries the next period's base
	// fee with the past period's usage. Usage is always billed at
	// the period end. A plan with no base fee is `in_arrears`.
	BaseBillTiming PlanDetailBaseBillTiming `json:"base_bill_timing"`

	// BillingInterval How often a subscription to the plan is billed. Fixed after create.
	BillingInterval PlanDetailBillingInterval `json:"billing_interval"`

	// Code Your short name for the plan. Letters, digits, `-` and `_`, at
	// most 100 characters, unique in the account and mode. Fixed
	// after create.
	Code string `json:"code"`

	// CreatedAt When the plan was created.
	CreatedAt time.Time `json:"created_at"`

	// Currency ISO 4217 code in upper case, such as `USD`. Fixed after create.
	// The plan's prices take it.
	Currency string `json:"currency"`

	// Description Your description of the plan. Absent when empty.
	Description string `json:"description,omitempty"`

	// Id The plan's ID, `hc_pln_` and 20 characters.
	Id string `json:"id"`

	// LiveSubscriptionCount Subscriptions on this plan that are not canceled. While it
	// is above 0, `base_amount_cents` cannot change (see Update
	// plan). Always 0 on the answer to a create.
	LiveSubscriptionCount int `json:"live_subscription_count"`

	// Name The plan's display name. Create refuses one longer than 255
	// bytes (UTF-8); an update does not check the length.
	Name string `json:"name"`

	// Prices The plan's usage prices from now on, in the order they were
	// added. A plan's meters are the meters it has a price for.
	Prices []PlanPrice `json:"prices"`

	// Status An archived plan takes no new subscriptions and no plan change
	// onto it. Subscriptions already on it keep billing.
	Status PlanDetailStatus `json:"status"`

	// TaxCode A Stripe product tax code, such as `txcd_10103001`, read only
	// by the Stripe Tax provider. Today only the base fee line of the
	// invoice billed when an in-advance subscription starts carries
	// it; cycle invoices and usage lines use the account's
	// `default_product_tax_code`. Absent when not set.
	TaxCode string `json:"tax_code,omitempty"`

	// TenantId The account the plan belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the plan was last changed.
	UpdatedAt time.Time `json:"updated_at"`

	// Used Whether a subscription has ever used the plan (canceled ones
	// and scheduled plan changes included). On a plan no one has
	// used, a price change applies at once; on a used plan, from
	// each subscriber's next billing period, and from the join for
	// a subscriber who first joins the plan in a period after it.
	Used bool `json:"used"`
}

PlanDetail defines model for PlanDetail.

type PlanDetailBaseBillTiming

type PlanDetailBaseBillTiming string

PlanDetailBaseBillTiming When the base fee is invoiced, relative to the period it covers. `in_arrears`: the base fee and the usage are billed at the period end. `in_advance`: the base fee is billed at the period start; the first invoice comes when the subscription starts, and each cycle invoice carries the next period's base fee with the past period's usage. Usage is always billed at the period end. A plan with no base fee is `in_arrears`.

const (
	PlanDetailBaseBillTimingInAdvance PlanDetailBaseBillTiming = "in_advance"
	PlanDetailBaseBillTimingInArrears PlanDetailBaseBillTiming = "in_arrears"
)

Defines values for PlanDetailBaseBillTiming.

func (PlanDetailBaseBillTiming) Valid

func (e PlanDetailBaseBillTiming) Valid() bool

Valid indicates whether the value is a known member of the PlanDetailBaseBillTiming enum.

type PlanDetailBillingInterval

type PlanDetailBillingInterval string

PlanDetailBillingInterval How often a subscription to the plan is billed. Fixed after create.

const (
	PlanDetailBillingIntervalMonthly PlanDetailBillingInterval = "monthly"
	PlanDetailBillingIntervalYearly  PlanDetailBillingInterval = "yearly"
)

Defines values for PlanDetailBillingInterval.

func (PlanDetailBillingInterval) Valid

func (e PlanDetailBillingInterval) Valid() bool

Valid indicates whether the value is a known member of the PlanDetailBillingInterval enum.

type PlanDetailStatus

type PlanDetailStatus string

PlanDetailStatus An archived plan takes no new subscriptions and no plan change onto it. Subscriptions already on it keep billing.

const (
	PlanDetailStatusActive   PlanDetailStatus = "active"
	PlanDetailStatusArchived PlanDetailStatus = "archived"
)

Defines values for PlanDetailStatus.

func (PlanDetailStatus) Valid

func (e PlanDetailStatus) Valid() bool

Valid indicates whether the value is a known member of the PlanDetailStatus enum.

type PlanPrice

type PlanPrice struct {
	// CreatedAt When the price was first added to the plan.
	CreatedAt time.Time `json:"created_at"`

	// DimensionMatch The labels an event must carry for this price to take it, for
	// example `{"model": "claude-opus-4.5", "token_type": "input"}`.
	// `{}` takes every event of the meter. Of the prices whose labels
	// an event carries, the one with the most labels takes it.
	DimensionMatch map[string]string `json:"dimension_match"`

	// Id The price's ID, `hc_prc_` and 20 characters.
	Id string `json:"id"`

	// MeterId The meter whose usage the price bills.
	MeterId string `json:"meter_id"`

	// Mode How the price bills a quantity; see PriceShape.
	Mode PlanPriceMode `json:"mode"`

	// PackageAmountCents Price of one package, as a decimal string of cents. `"0"` unless
	// `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents"`

	// PackageSize The units in one package. 0 unless `mode` is `package`.
	PackageSize int64 `json:"package_size"`

	// PlanId The plan the price belongs to.
	PlanId string `json:"plan_id"`

	// TenantId The account the price belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// Tiers Empty (`[]`) unless `mode` is `graduated`.
	Tiers []PriceTier `json:"tiers"`

	// UnitAmountCents Price per unit, as a decimal string of cents. `"0"` unless `mode`
	// is `per_unit`.
	UnitAmountCents string `json:"unit_amount_cents"`

	// UpdatedAt When the content shown was saved.
	UpdatedAt time.Time `json:"updated_at"`
}

PlanPrice One usage price of a plan: a meter, the events it takes (`dimension_match`) and its rate. The price takes the plan's currency. Its id stays the same when its rate changes; its meter and `dimension_match` are its identity and never change. Every shape field is always sent: the ones the mode does not use are `"0"`, `0` or `[]`.

type PlanPriceMode

type PlanPriceMode string

PlanPriceMode How the price bills a quantity; see PriceShape.

const (
	PlanPriceModeGraduated PlanPriceMode = "graduated"
	PlanPriceModePackage   PlanPriceMode = "package"
	PlanPriceModePerUnit   PlanPriceMode = "per_unit"
)

Defines values for PlanPriceMode.

func (PlanPriceMode) Valid

func (e PlanPriceMode) Valid() bool

Valid indicates whether the value is a known member of the PlanPriceMode enum.

type PlanStatus

type PlanStatus string

PlanStatus An archived plan takes no new subscriptions and no plan change onto it. Subscriptions already on it keep billing.

const (
	PlanStatusActive   PlanStatus = "active"
	PlanStatusArchived PlanStatus = "archived"
)

Defines values for PlanStatus.

func (PlanStatus) Valid

func (e PlanStatus) Valid() bool

Valid indicates whether the value is a known member of the PlanStatus enum.

type PreviewRecipeJSONBody

type PreviewRecipeJSONBody struct {
	// Overrides Values for the recipe's `overridable` keys, such as
	// `{"currency": "EUR"}`. A key the recipe does not list, or
	// a value that breaks the key's rules, is refused with 422.
	// Keys you leave out take their defaults.
	Overrides map[string]interface{} `json:"overrides,omitempty"`
}

PreviewRecipeJSONBody defines parameters for PreviewRecipe.

type PreviewRecipeJSONRequestBody

type PreviewRecipeJSONRequestBody PreviewRecipeJSONBody

PreviewRecipeJSONRequestBody defines body for PreviewRecipe for application/json ContentType.

type PreviewRecipeParams

type PreviewRecipeParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

PreviewRecipeParams defines parameters for PreviewRecipe.

type PriceInput

type PriceInput struct {
	// DimensionMatch The labels an event must carry for the price to take it.
	// At most 16 labels. Each key and each value is a string of 1
	// to 100 bytes (UTF-8), and a key may not be only spaces.
	// Omitted or `{}` takes every event of the meter. Two prices of
	// one plan and meter that could both take one event with the
	// same number of labels are refused (409 `price_conflict`).
	DimensionMatch map[string]string `json:"dimension_match,omitempty"`

	// MeterId The meter whose usage the price bills. It must be a meter in
	// this account and mode.
	MeterId string `json:"meter_id"`

	// Mode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.
	Mode PriceInputMode `json:"mode"`

	// PackageAmountCents Price of one package in cents, as a decimal string (e.g. "0.2" with `package_size` 1000 = $0.002 per 1,000 units), with the limits of `unit_amount_cents`. Used when `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents,omitempty"`

	// PackageSize Used when `mode` is `package`. The units in one package, above 0.
	PackageSize int64 `json:"package_size,omitempty"`

	// Tiers Used when `mode` is `graduated`. Each `up_to` is a whole number above the one before. The last tier has `up_to: null` (no upper bound), and only the last. Otherwise 422 with `param` `tiers`. A tier's rate takes the limits of `unit_amount_cents`; a refusal names `tiers[i].unit_amount_cents` (i counts from 0).
	Tiers []PriceTier `json:"tiers,omitempty"`

	// UnitAmountCents Price per unit in cents, as a decimal string (e.g. "0.0003" = $3.00 per 1,000,000 units). Used when `mode` is `per_unit`. 0 or more, under 10^18, at most 12 decimal places (trailing zeros do not count), and at most 100 characters. A JSON number is also read. A value outside them is refused with 422 and `param` naming the field. Invoice line amounts round to whole cents.
	UnitAmountCents string `json:"unit_amount_cents,omitempty"`
}

PriceInput defines model for PriceInput.

type PriceInputMode

type PriceInputMode string

PriceInputMode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.

const (
	PriceInputModeGraduated PriceInputMode = "graduated"
	PriceInputModePackage   PriceInputMode = "package"
	PriceInputModePerUnit   PriceInputMode = "per_unit"
)

Defines values for PriceInputMode.

func (PriceInputMode) Valid

func (e PriceInputMode) Valid() bool

Valid indicates whether the value is a known member of the PriceInputMode enum.

type PriceShape

type PriceShape struct {
	// Mode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.
	Mode PriceShapeMode `json:"mode"`

	// PackageAmountCents Price of one package in cents, as a decimal string (e.g. "0.2" with `package_size` 1000 = $0.002 per 1,000 units), with the limits of `unit_amount_cents`. Used when `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents,omitempty"`

	// PackageSize Used when `mode` is `package`. The units in one package, above 0.
	PackageSize int64 `json:"package_size,omitempty"`

	// Tiers Used when `mode` is `graduated`. Each `up_to` is a whole number above the one before. The last tier has `up_to: null` (no upper bound), and only the last. Otherwise 422 with `param` `tiers`. A tier's rate takes the limits of `unit_amount_cents`; a refusal names `tiers[i].unit_amount_cents` (i counts from 0).
	Tiers []PriceTier `json:"tiers,omitempty"`

	// UnitAmountCents Price per unit in cents, as a decimal string (e.g. "0.0003" = $3.00 per 1,000,000 units). Used when `mode` is `per_unit`. 0 or more, under 10^18, at most 12 decimal places (trailing zeros do not count), and at most 100 characters. A JSON number is also read. A value outside them is refused with 422 and `param` naming the field. Invoice line amounts round to whole cents.
	UnitAmountCents string `json:"unit_amount_cents,omitempty"`
}

PriceShape How a price bills a quantity: its mode and the mode's fields. It is the body of `PATCH /v1/plans/{id}/prices/{price_id}` and part of every price you add. Send only the mode's fields: a field the mode does not use must be 0 or left out (`tiers`: `[]` or left out), or the request is refused with 422 and `param` naming it.

type PriceShapeMode

type PriceShapeMode string

PriceShapeMode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.

const (
	PriceShapeModeGraduated PriceShapeMode = "graduated"
	PriceShapeModePackage   PriceShapeMode = "package"
	PriceShapeModePerUnit   PriceShapeMode = "per_unit"
)

Defines values for PriceShapeMode.

func (PriceShapeMode) Valid

func (e PriceShapeMode) Valid() bool

Valid indicates whether the value is a known member of the PriceShapeMode enum.

type PriceTier

type PriceTier struct {
	// UnitAmountCents Price per unit in cents in this tier, as a decimal string. `"0"`
	// makes the tier free.
	UnitAmountCents string `json:"unit_amount_cents"`

	// UpTo The tier's upper bound in whole units: the tier prices the quantity above the previous tier's bound, up to this one. `null` on the last tier, which has no upper bound. Only the last tier is `null`, and it must be.
	UpTo int64 `json:"up_to"`
}

PriceTier One tier of a graduated price.

type PriceWrite

type PriceWrite struct {
	// CreatedAt When the price was first added to the plan.
	CreatedAt time.Time `json:"created_at"`

	// DimensionMatch The labels an event must carry for this price to take it, for
	// example `{"model": "claude-opus-4.5", "token_type": "input"}`.
	// `{}` takes every event of the meter. Of the prices whose labels
	// an event carries, the one with the most labels takes it.
	DimensionMatch map[string]string `json:"dimension_match"`

	// Effective When the write applies, as explained above.
	Effective PriceWriteEffective `json:"effective"`

	// EndedOverrides On a removal, the customer overrides of the price it ended
	// (`[]` when there were none). Each ends when the removal
	// takes effect for its customer. Absent on an add or a
	// change.
	EndedOverrides []struct {
		// CustomerId The customer the override was for.
		CustomerId string `json:"customer_id"`

		// Id The ended override's ID.
		Id string `json:"id"`
	} `json:"ended_overrides,omitempty"`

	// Id The price's ID, `hc_prc_` and 20 characters.
	Id string `json:"id"`

	// MeterId The meter whose usage the price bills.
	MeterId string `json:"meter_id"`

	// Mode How the price bills a quantity; see PriceShape.
	Mode PriceWriteMode `json:"mode"`

	// PackageAmountCents Price of one package, as a decimal string of cents. `"0"` unless
	// `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents"`

	// PackageSize The units in one package. 0 unless `mode` is `package`.
	PackageSize int64 `json:"package_size"`

	// PlanId The plan the price belongs to.
	PlanId string `json:"plan_id"`

	// Removed True on the answer to a removal. Absent otherwise.
	Removed bool `json:"removed,omitempty"`

	// TenantId The account the price belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// Tiers Empty (`[]`) unless `mode` is `graduated`.
	Tiers []PriceTier `json:"tiers"`

	// UnitAmountCents Price per unit, as a decimal string of cents. `"0"` unless `mode`
	// is `per_unit`.
	UnitAmountCents string `json:"unit_amount_cents"`

	// UpdatedAt When the content shown was saved.
	UpdatedAt time.Time `json:"updated_at"`
}

PriceWrite defines model for PriceWrite.

type PriceWriteEffective

type PriceWriteEffective string

PriceWriteEffective When the write applies, as explained above.

const (
	NextPeriod PriceWriteEffective = "next_period"
	Now        PriceWriteEffective = "now"
)

Defines values for PriceWriteEffective.

func (PriceWriteEffective) Valid

func (e PriceWriteEffective) Valid() bool

Valid indicates whether the value is a known member of the PriceWriteEffective enum.

type PriceWriteMode

type PriceWriteMode string

PriceWriteMode How the price bills a quantity; see PriceShape.

const (
	PriceWriteModeGraduated PriceWriteMode = "graduated"
	PriceWriteModePackage   PriceWriteMode = "package"
	PriceWriteModePerUnit   PriceWriteMode = "per_unit"
)

Defines values for PriceWriteMode.

func (PriceWriteMode) Valid

func (e PriceWriteMode) Valid() bool

Valid indicates whether the value is a known member of the PriceWriteMode enum.

type ProviderCostRate

type ProviderCostRate struct {
	// CreatedAt When the rate was first set.
	CreatedAt time.Time `json:"created_at"`

	// Currency Always USD. Cost and margin count every rate in US cents.
	Currency ProviderCostRateCurrency `json:"currency"`

	// Id The rate's ID, `hc_pcr_` and 24 hex characters.
	Id string `json:"id"`

	// Model The model, such as `claude-sonnet-4.5`. An event matches on its
	// `model_raw` label first, then on its `model` label.
	Model string `json:"model"`

	// Provider The provider, in lower case, such as `anthropic`. It must equal
	// the `provider` label of the usage events it costs.
	Provider string `json:"provider"`

	// TenantId The account the rate belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// TokenType The kind of token, in lower case, such as `input`, `output` or
	// `cache_read`. It must equal the `token_type` label of the usage
	// events it costs.
	TokenType string `json:"token_type"`

	// UnitCostCents US cents per token, as a decimal string (e.g. "0.0003" = $3.00 per
	// 1,000,000 tokens).
	UnitCostCents string `json:"unit_cost_cents"`

	// UpdatedAt When the rate was last set.
	UpdatedAt time.Time `json:"updated_at"`
}

ProviderCostRate What you pay an upstream AI provider per token, for one provider, model and token type. When a usage event with matching `provider`, `model` and `token_type` labels arrives, Hardcount stamps this cost on it, unless the event already brings a cost the provider reported. The margin report adds the stamps up. Editing or deleting a rate changes only events that arrive later. The `/v1/provider-costs` routes manage rates.

type ProviderCostRateCurrency

type ProviderCostRateCurrency string

ProviderCostRateCurrency Always USD. Cost and margin count every rate in US cents.

const (
	ProviderCostRateCurrencyUSD ProviderCostRateCurrency = "USD"
)

Defines values for ProviderCostRateCurrency.

func (ProviderCostRateCurrency) Valid

func (e ProviderCostRateCurrency) Valid() bool

Valid indicates whether the value is a known member of the ProviderCostRateCurrency enum.

type PublicPaymentUpdate

type PublicPaymentUpdate struct {
	// AmountDueCents What is due on the invoice, in the currency's minor unit (cents
	// for USD). Not cleared when the invoice is voided: check
	// `invoice_status` before asking for payment.
	AmountDueCents int64 `json:"amount_due_cents"`

	// Branding The seller's branding from its account settings. A field the
	// seller has not set is absent.
	Branding struct {
		// BrandColor The seller's brand color, such as `#4F46E5`.
		BrandColor string `json:"brand_color,omitempty"`

		// CompanyEmail The seller's contact email.
		CompanyEmail string `json:"company_email,omitempty"`

		// CompanyName The seller's company name.
		CompanyName string `json:"company_name,omitempty"`

		// LogoUrl The address of the seller's logo.
		LogoUrl string `json:"logo_url,omitempty"`

		// SupportUrl Where the customer can get help.
		SupportUrl string `json:"support_url,omitempty"`
	} `json:"branding"`

	// Currency The invoice's currency, such as `USD`.
	Currency string `json:"currency"`

	// CustomerName The customer's display name.
	CustomerName string `json:"customer_name"`

	// InvoiceNumber The number of the invoice the link was sent for.
	InvoiceNumber string `json:"invoice_number"`

	// InvoiceStatus Where the invoice is in its life.
	// - `draft`: not issued yet. Lines can still be added, and nothing is
	//   charged.
	// - `finalized`: issued and owed. Hardcount collects it.
	// - `paid`: settled, by card, credit, an offline payment or a credit
	//   note that left nothing due.
	// - `voided`: cancelled. Nothing is owed. Voiding is final.
	// - `uncollectible`: written off as bad debt, by you
	//   (`POST /v1/invoices/{id}/mark-uncollectible`) or by a dunning
	//   policy's final action. Hardcount stops collecting it, but it stays
	//   on the books and can still be paid.
	InvoiceStatus InvoiceStatus `json:"invoice_status"`
}

PublicPaymentUpdate What the payment-update page shows before the customer adds a card: `GET /v1/public/payment-updates/{token}`. The page opens from the link in a payment setup email. Hardcount queues one when an invoice has no payment method to charge, the customer has an email address and the server's `PAYMENT_UPDATE_URL` is set, and again on each `POST /v1/invoices/{id}/resend-setup-link`.

type RateLimited added in v0.9.2

type RateLimited = Error

RateLimited The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type ReadinessReport

type ReadinessReport struct {
	// Checks One entry per check. `api` is `ok` or `draining`. `database` is
	// `ok` or `error`. `scheduler` starts with `ok` or `degraded`,
	// followed by detail such as `ok: last run 12s ago`. While
	// draining, only `api` is sent.
	Checks map[string]string `json:"checks"`

	// Status `ok` when every check passed. `degraded` when the database
	// cannot be reached (503) or the billing scheduler is late (still
	// 200). `draining` while the server shuts down (503).
	Status ReadinessReportStatus `json:"status"`
}

ReadinessReport The body of `GET /health/ready`, on both 200 and 503.

type ReadinessReportStatus

type ReadinessReportStatus string

ReadinessReportStatus `ok` when every check passed. `degraded` when the database cannot be reached (503) or the billing scheduler is late (still 200). `draining` while the server shuts down (503).

const (
	ReadinessReportStatusDegraded ReadinessReportStatus = "degraded"
	ReadinessReportStatusDraining ReadinessReportStatus = "draining"
	ReadinessReportStatusOk       ReadinessReportStatus = "ok"
)

Defines values for ReadinessReportStatus.

func (ReadinessReportStatus) Valid

func (e ReadinessReportStatus) Valid() bool

Valid indicates whether the value is a known member of the ReadinessReportStatus enum.

type ReceivePostmarkWebhook200JSONResponseBodyStatus

type ReceivePostmarkWebhook200JSONResponseBodyStatus string

ReceivePostmarkWebhook200JSONResponseBodyStatus defines parameters for ReceivePostmarkWebhook.

const (
	ReceivePostmarkWebhook200JSONResponseBodyStatusIgnored   ReceivePostmarkWebhook200JSONResponseBodyStatus = "ignored"
	ReceivePostmarkWebhook200JSONResponseBodyStatusProcessed ReceivePostmarkWebhook200JSONResponseBodyStatus = "processed"
	ReceivePostmarkWebhook200JSONResponseBodyStatusSkipped   ReceivePostmarkWebhook200JSONResponseBodyStatus = "skipped"
)

Defines values for ReceivePostmarkWebhook200JSONResponseBodyStatus.

func (ReceivePostmarkWebhook200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the ReceivePostmarkWebhook200JSONResponseBodyStatus enum.

type ReceivePostmarkWebhookJSONBody

type ReceivePostmarkWebhookJSONBody map[string]interface{}

ReceivePostmarkWebhookJSONBody defines parameters for ReceivePostmarkWebhook.

type ReceivePostmarkWebhookJSONRequestBody

type ReceivePostmarkWebhookJSONRequestBody ReceivePostmarkWebhookJSONBody

ReceivePostmarkWebhookJSONRequestBody defines body for ReceivePostmarkWebhook for application/json ContentType.

type ReceiveStripeWebhook200JSONResponseBodyStatus

type ReceiveStripeWebhook200JSONResponseBodyStatus string

ReceiveStripeWebhook200JSONResponseBodyStatus defines parameters for ReceiveStripeWebhook.

const (
	ReceiveStripeWebhook200JSONResponseBodyStatusProcessed ReceiveStripeWebhook200JSONResponseBodyStatus = "processed"
	ReceiveStripeWebhook200JSONResponseBodyStatusSkipped   ReceiveStripeWebhook200JSONResponseBodyStatus = "skipped"
)

Defines values for ReceiveStripeWebhook200JSONResponseBodyStatus.

func (ReceiveStripeWebhook200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the ReceiveStripeWebhook200JSONResponseBodyStatus enum.

type ReceiveStripeWebhookJSONBody

type ReceiveStripeWebhookJSONBody map[string]interface{}

ReceiveStripeWebhookJSONBody defines parameters for ReceiveStripeWebhook.

type ReceiveStripeWebhookJSONRequestBody

type ReceiveStripeWebhookJSONRequestBody ReceiveStripeWebhookJSONBody

ReceiveStripeWebhookJSONRequestBody defines body for ReceiveStripeWebhook for application/json ContentType.

type ReceiveStripeWebhookParams

type ReceiveStripeWebhookParams struct {
	// StripeSignature Stripe's signature of the body. Hardcount checks it with the connection's webhook signing secret.
	StripeSignature string `json:"Stripe-Signature"`
}

ReceiveStripeWebhookParams defines parameters for ReceiveStripeWebhook.

type Recipe

type Recipe struct {
	// Description A longer description. Absent when the recipe has none.
	Description string `json:"description,omitempty"`

	// Key The recipe's key, used in the recipe routes, such as `replicate_style`.
	Key string `json:"key"`

	// Meters The meters the recipe creates or reuses.
	Meters []RecipeMeter `json:"meters"`

	// Name The recipe's display name.
	Name string `json:"name"`

	// Overridable The values you can set before installing.
	Overridable []RecipeOverride `json:"overridable"`

	// Plans The plans the recipe creates, with their prices.
	Plans []RecipePlan `json:"plans"`

	// Summary A short description of what the recipe sets up.
	Summary string `json:"summary"`

	// Version The recipe's version.
	Version string `json:"version"`
}

Recipe A ready-made pricing setup built into Hardcount: its meters, and its plans with their prices, with every overridable value at its default. Installing it creates those objects. A recipe creates nothing else.

type RecipeCreatedObjects

type RecipeCreatedObjects struct {
	// MeterIds The meters the install made or reused.
	MeterIds []string `json:"meter_ids,omitempty"`

	// PlanIds The plans the install made.
	PlanIds []string `json:"plan_ids,omitempty"`

	// PriceIds The prices the install put on its plans.
	PriceIds []string `json:"price_ids,omitempty"`
}

RecipeCreatedObjects The IDs of the objects an install made, by kind. `meter_ids` also holds a meter the install reused rather than made. Each list is absent when empty.

type RecipeCreates

type RecipeCreates struct {
	// Meters The meters the recipe declares. An install reuses a matching meter
	// instead of making a new one.
	Meters int `json:"meters"`

	// Plans The plans an install creates.
	Plans int `json:"plans"`

	// Prices The prices the install puts on its plans.
	Prices int `json:"prices"`
}

RecipeCreates How many objects a recipe makes when installed, by kind. A recipe makes only meters, plans and prices.

type RecipeDetail

type RecipeDetail struct {
	// Creates How many objects a recipe makes when installed, by kind. A recipe makes only meters, plans and prices.
	Creates RecipeCreates `json:"creates"`

	// Description A longer description. Absent when the recipe has none.
	Description string `json:"description,omitempty"`

	// Key The recipe's key, used in the recipe routes, such as `replicate_style`.
	Key string `json:"key"`

	// Meters The meters the recipe creates or reuses.
	Meters []RecipeMeter `json:"meters"`

	// Name The recipe's display name.
	Name string `json:"name"`

	// Overridable The values you can set before installing.
	Overridable []RecipeOverride `json:"overridable"`

	// Plans The plans the recipe creates, with their prices.
	Plans []RecipePlan `json:"plans"`

	// Summary A short description of what the recipe sets up.
	Summary string `json:"summary"`

	// Version The recipe's version.
	Version string `json:"version"`
}

RecipeDetail defines model for RecipeDetail.

type RecipeInstance

type RecipeInstance struct {
	// CreatedAt When the recipe was installed.
	CreatedAt time.Time `json:"created_at"`

	// CreatedBy The ID of the API key that installed the recipe. Absent for an
	// install from a dashboard session.
	CreatedBy string `json:"created_by,omitempty"`

	// CreatedObjects The IDs of the objects an install made, by kind. `meter_ids` also holds a meter the install reused rather than made. Each list is absent when empty.
	CreatedObjects RecipeCreatedObjects `json:"created_objects"`

	// Id The install's ID, `hc_rec_` and 24 hex characters.
	Id string `json:"id"`

	// Overrides The overrides the install was sent, as sent (`{}` when none).
	// Defaults are not filled in.
	Overrides map[string]interface{} `json:"overrides"`

	// RecipeKey The `key` of the recipe installed.
	RecipeKey string `json:"recipe_key"`

	// RecipeVersion The recipe's `version` at the install.
	RecipeVersion string `json:"recipe_version"`

	// TenantId The account the recipe was installed in.
	TenantId string `json:"tenant_id,omitempty"`
}

RecipeInstance The record that a recipe was installed in this account and mode, and what the install made. A recipe is installed once per mode; installing it again returns this record. Its fields are `recipe_key` and `recipe_version`, not the recipe's own `key` and `version`.

type RecipeListItem

type RecipeListItem struct {
	// Creates How many objects a recipe makes when installed, by kind. A recipe makes only meters, plans and prices.
	Creates RecipeCreates `json:"creates"`

	// Description A longer description. Absent when the recipe has none.
	Description string `json:"description,omitempty"`

	// Instantiated The record that a recipe was installed in this account and mode, and what the install made. A recipe is installed once per mode; installing it again returns this record. Its fields are `recipe_key` and `recipe_version`, not the recipe's own `key` and `version`.
	Instantiated RecipeInstance `json:"instantiated,omitempty"`

	// Key The recipe's key, used in the recipe routes, such as `replicate_style`.
	Key string `json:"key"`

	// Meters The meters the recipe creates or reuses.
	Meters []RecipeMeter `json:"meters"`

	// Name The recipe's display name.
	Name string `json:"name"`

	// Overridable The values you can set before installing.
	Overridable []RecipeOverride `json:"overridable"`

	// Plans The plans the recipe creates, with their prices.
	Plans []RecipePlan `json:"plans"`

	// Summary A short description of what the recipe sets up.
	Summary string `json:"summary"`

	// Version The recipe's version.
	Version string `json:"version"`
}

RecipeListItem defines model for RecipeListItem.

type RecipeMeter

type RecipeMeter struct {
	// Aggregation How the meter rolls its events into one quantity per period, one
	// of `sum`, `count`, `max` or `last`.
	Aggregation string `json:"aggregation"`

	// EventName The `event_name` usage events send for the meter.
	EventName string `json:"event_name"`

	// Name The meter's display name.
	Name string `json:"name"`

	// Unit The unit of the quantity, such as `seconds`.
	Unit string `json:"unit"`
}

RecipeMeter A meter a recipe creates, or reuses when one with the same `event_name` and aggregation exists.

type RecipeOverride

type RecipeOverride struct {
	// Default Default value applied when the override is not supplied.
	Default interface{} `json:"default"`

	// Enum The only values allowed. Absent when any value of the type is allowed.
	Enum []string `json:"enum,omitempty"`

	// Key The name to use in `overrides`, such as `currency`.
	Key string `json:"key"`

	// MaxLength The most bytes a string value may have. Absent when there is no limit.
	MaxLength int `json:"max_length,omitempty"`

	// Pattern A regular expression a string value must match. Absent when there is none.
	Pattern string `json:"pattern,omitempty"`

	// Type The JSON type the value must have. `int` takes any JSON number.
	Type RecipeOverrideType `json:"type"`
}

RecipeOverride One value of a recipe you can set before you install it, such as the currency or the plan's name. The recipe's `overridable` list holds them; preview and install check `overrides` against them.

type RecipeOverrideType

type RecipeOverrideType string

RecipeOverrideType The JSON type the value must have. `int` takes any JSON number.

const (
	Int    RecipeOverrideType = "int"
	String RecipeOverrideType = "string"
)

Defines values for RecipeOverrideType.

func (RecipeOverrideType) Valid

func (e RecipeOverrideType) Valid() bool

Valid indicates whether the value is a known member of the RecipeOverrideType enum.

type RecipePlan

type RecipePlan struct {
	// BaseAmountCents The plan's recurring base fee, in the currency's minor unit (cents for USD).
	BaseAmountCents int64 `json:"base_amount_cents"`

	// BaseBillTiming When the base fee is billed; see Plan. Absent when the recipe
	// leaves it out, which it may only with a base fee of 0. The plan is
	// then `in_arrears`.
	BaseBillTiming RecipePlanBaseBillTiming `json:"base_bill_timing,omitempty"`

	// BillingInterval How often a subscription to the plan is billed.
	BillingInterval RecipePlanBillingInterval `json:"billing_interval"`

	// Code The plan's code. When a plan with this code exists, the install
	// gives the new plan the first free code with `_2`, `_3` and so
	// on added.
	Code string `json:"code"`

	// Currency The plan's currency, such as `USD`.
	Currency string `json:"currency"`

	// Name The plan's name.
	Name string `json:"name"`

	// Prices The plan's usage prices. Each takes the plan's currency.
	Prices []RecipePrice `json:"prices"`
}

RecipePlan A plan a recipe creates, with its usage prices. An install always creates a new plan.

type RecipePlanBaseBillTiming

type RecipePlanBaseBillTiming string

RecipePlanBaseBillTiming When the base fee is billed; see Plan. Absent when the recipe leaves it out, which it may only with a base fee of 0. The plan is then `in_arrears`.

const (
	RecipePlanBaseBillTimingInAdvance RecipePlanBaseBillTiming = "in_advance"
	RecipePlanBaseBillTimingInArrears RecipePlanBaseBillTiming = "in_arrears"
)

Defines values for RecipePlanBaseBillTiming.

func (RecipePlanBaseBillTiming) Valid

func (e RecipePlanBaseBillTiming) Valid() bool

Valid indicates whether the value is a known member of the RecipePlanBaseBillTiming enum.

type RecipePlanBillingInterval

type RecipePlanBillingInterval string

RecipePlanBillingInterval How often a subscription to the plan is billed.

const (
	RecipePlanBillingIntervalMonthly RecipePlanBillingInterval = "monthly"
	RecipePlanBillingIntervalYearly  RecipePlanBillingInterval = "yearly"
)

Defines values for RecipePlanBillingInterval.

func (RecipePlanBillingInterval) Valid

func (e RecipePlanBillingInterval) Valid() bool

Valid indicates whether the value is a known member of the RecipePlanBillingInterval enum.

type RecipePreviewObjects

type RecipePreviewObjects struct {
	// Meters The meters the install creates or reuses.
	Meters []RecipeMeter `json:"meters"`

	// Plans The plans the install creates, with the overrides applied. An
	// install that finds a plan's code taken gives the new plan the
	// first free code with `_2`, `_3` and so on added.
	Plans []RecipePlan `json:"plans"`
}

RecipePreviewObjects What an install creates: the meters, and each plan with its prices. Both arrays are always present. An install reuses a meter that already exists with the same `event_name` and aggregation.

type RecipePreviewResult

type RecipePreviewResult struct {
	// Key The recipe's key.
	Key string `json:"key"`

	// Objects What an install creates: the meters, and each plan with its prices. Both arrays are always present. An install reuses a meter that already exists with the same `event_name` and aggregation.
	Objects RecipePreviewObjects `json:"objects"`

	// Version The recipe's version.
	Version string `json:"version"`

	// Warnings Problems that would not stop the install. Always empty today.
	Warnings []string `json:"warnings"`
}

RecipePreviewResult The answer to `POST /v1/recipes/{key}/preview`: what installing the recipe with your overrides would create. Nothing is written.

type RecipePrice

type RecipePrice struct {
	// DimensionMatch The labels an event must carry for the price to take it. `{}`
	// takes every event of the meter.
	DimensionMatch map[string]string `json:"dimension_match"`

	// Meter The `event_name` of the recipe meter the price is on.
	Meter string `json:"meter"`

	// Mode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.
	Mode RecipePriceMode `json:"mode"`

	// PackageAmountCents Price of one package in cents, as a decimal string (e.g. "0.2" with `package_size` 1000 = $0.002 per 1,000 units), with the limits of `unit_amount_cents`. Used when `mode` is `package`.
	PackageAmountCents string `json:"package_amount_cents,omitempty"`

	// PackageSize Used when `mode` is `package`. The units in one package, above 0.
	PackageSize int64 `json:"package_size,omitempty"`

	// Tiers Used when `mode` is `graduated`. Each `up_to` is a whole number above the one before. The last tier has `up_to: null` (no upper bound), and only the last. Otherwise 422 with `param` `tiers`. A tier's rate takes the limits of `unit_amount_cents`; a refusal names `tiers[i].unit_amount_cents` (i counts from 0).
	Tiers []PriceTier `json:"tiers,omitempty"`

	// UnitAmountCents Price per unit in cents, as a decimal string (e.g. "0.0003" = $3.00 per 1,000,000 units). Used when `mode` is `per_unit`. 0 or more, under 10^18, at most 12 decimal places (trailing zeros do not count), and at most 100 characters. A JSON number is also read. A value outside them is refused with 422 and `param` naming the field. Invoice line amounts round to whole cents.
	UnitAmountCents string `json:"unit_amount_cents,omitempty"`
}

RecipePrice defines model for RecipePrice.

type RecipePriceMode

type RecipePriceMode string

RecipePriceMode `per_unit` bills quantity × `unit_amount_cents`. `graduated` bills each tier's part of the quantity at that tier's rate. `package` bills ceil(quantity ÷ `package_size`) × `package_amount_cents`: a part package bills as a whole one.

const (
	RecipePriceModeGraduated RecipePriceMode = "graduated"
	RecipePriceModePackage   RecipePriceMode = "package"
	RecipePriceModePerUnit   RecipePriceMode = "per_unit"
)

Defines values for RecipePriceMode.

func (RecipePriceMode) Valid

func (e RecipePriceMode) Valid() bool

Valid indicates whether the value is a known member of the RecipePriceMode enum.

type RecordInvoicePaymentJSONBody

type RecordInvoicePaymentJSONBody struct {
	// Note Free text, for example "Cheque 1234". Do not put personal data here: the audit log cannot be edited.
	Note string `json:"note,omitempty"`
}

RecordInvoicePaymentJSONBody defines parameters for RecordInvoicePayment.

type RecordInvoicePaymentJSONRequestBody

type RecordInvoicePaymentJSONRequestBody RecordInvoicePaymentJSONBody

RecordInvoicePaymentJSONRequestBody defines body for RecordInvoicePayment for application/json ContentType.

type RecordInvoicePaymentParams

type RecordInvoicePaymentParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RecordInvoicePaymentParams defines parameters for RecordInvoicePayment.

type RecoveryWarning

type RecoveryWarning struct {
	// Blocked Always false. This object only warns; it never refuses.
	Blocked bool `json:"blocked"`

	// Code What will not reconcile.
	// `tax_reversed_unrecoverable`: the invoice's Stripe Tax
	// transaction was reversed, and recording the payment does not
	// report it again, so the tax collected will not appear in your
	// tax provider's records.
	// `relief_not_reissued`: a credit the invoice was owed was never
	// applied, so `amount_due_cents` is higher than what is owed and the
	// customer may have overpaid.
	Code RecoveryWarningCode `json:"code,omitempty"`

	// Message One sentence for the operator naming the consequence and what to
	// do about it.
	Message string `json:"message,omitempty"`
}

RecoveryWarning What you should know before you record an offline payment on a written-off invoice (`status` `uncollectible`): a consequence that will not reconcile on its own. It never refuses the payment, because the money already arrived. A written-off invoice is never charged by card. It is settled only by recording a payment: an offline payment, or a card payment Stripe shows succeeded.

type RecoveryWarningCode

type RecoveryWarningCode string

RecoveryWarningCode What will not reconcile. `tax_reversed_unrecoverable`: the invoice's Stripe Tax transaction was reversed, and recording the payment does not report it again, so the tax collected will not appear in your tax provider's records. `relief_not_reissued`: a credit the invoice was owed was never applied, so `amount_due_cents` is higher than what is owed and the customer may have overpaid.

const (
	ReliefNotReissued        RecoveryWarningCode = "relief_not_reissued"
	TaxReversedUnrecoverable RecoveryWarningCode = "tax_reversed_unrecoverable"
)

Defines values for RecoveryWarningCode.

func (RecoveryWarningCode) Valid

func (e RecoveryWarningCode) Valid() bool

Valid indicates whether the value is a known member of the RecoveryWarningCode enum.

type RefundInvoiceJSONBody

type RefundInvoiceJSONBody struct {
	// AmountCents Amount to refund. 0 or absent refunds what was paid by card less the refunds on the invoice's credit notes that are not voided, up to what is left of the invoice total.
	AmountCents int64 `json:"amount_cents,omitempty"`

	// Description Text for the credit note line. Defaults to "Refund: <reason>".
	Description string `json:"description,omitempty"`

	// Reason Why you are refunding, stored as the credit note's `reason`.
	Reason RefundInvoiceJSONBodyReason `json:"reason"`
}

RefundInvoiceJSONBody defines parameters for RefundInvoice.

type RefundInvoiceJSONBodyReason

type RefundInvoiceJSONBodyReason string

RefundInvoiceJSONBodyReason defines parameters for RefundInvoice.

const (
	Duplicate           RefundInvoiceJSONBodyReason = "duplicate"
	Fraudulent          RefundInvoiceJSONBodyReason = "fraudulent"
	Other               RefundInvoiceJSONBodyReason = "other"
	RequestedByCustomer RefundInvoiceJSONBodyReason = "requested_by_customer"
)

Defines values for RefundInvoiceJSONBodyReason.

func (RefundInvoiceJSONBodyReason) Valid

Valid indicates whether the value is a known member of the RefundInvoiceJSONBodyReason enum.

type RefundInvoiceJSONRequestBody

type RefundInvoiceJSONRequestBody RefundInvoiceJSONBody

RefundInvoiceJSONRequestBody defines body for RefundInvoice for application/json ContentType.

type RefundInvoiceParams

type RefundInvoiceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RefundInvoiceParams defines parameters for RefundInvoice.

type ReleaseHeldUsageJSONBody

type ReleaseHeldUsageJSONBody struct {
	// CustomerId Release into this customer (an `hc_cus_` id) instead of
	// the one whose external ID matches, for a `user` value
	// that had a typo.
	CustomerId string `json:"customer_id,omitempty"`

	// ExternalCustomerId The external ID the rows were held under.
	ExternalCustomerId string `json:"external_customer_id"`
}

ReleaseHeldUsageJSONBody defines parameters for ReleaseHeldUsage.

type ReleaseHeldUsageJSONRequestBody

type ReleaseHeldUsageJSONRequestBody ReleaseHeldUsageJSONBody

ReleaseHeldUsageJSONRequestBody defines body for ReleaseHeldUsage for application/json ContentType.

type ReplayWebhookDeliveryParams

type ReplayWebhookDeliveryParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ReplayWebhookDeliveryParams defines parameters for ReplayWebhookDelivery.

type ReplayWebhookEventParams

type ReplayWebhookEventParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ReplayWebhookEventParams defines parameters for ReplayWebhookEvent.

type RequestPasswordReset200JSONResponseBodyEmailDelivery added in v0.9.2

type RequestPasswordReset200JSONResponseBodyEmailDelivery string

RequestPasswordReset200JSONResponseBodyEmailDelivery defines parameters for RequestPasswordReset.

Defines values for RequestPasswordReset200JSONResponseBodyEmailDelivery.

func (RequestPasswordReset200JSONResponseBodyEmailDelivery) Valid added in v0.9.2

Valid indicates whether the value is a known member of the RequestPasswordReset200JSONResponseBodyEmailDelivery enum.

type RequestPasswordResetJSONBody added in v0.9.2

type RequestPasswordResetJSONBody struct {
	// Email The sign-in email of the account to reset.
	Email openapi_types.Email `json:"email"`
}

RequestPasswordResetJSONBody defines parameters for RequestPasswordReset.

type RequestPasswordResetJSONRequestBody added in v0.9.2

type RequestPasswordResetJSONRequestBody RequestPasswordResetJSONBody

RequestPasswordResetJSONRequestBody defines body for RequestPasswordReset for application/json ContentType.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ResendInvoiceSetupLink200JSONResponseBodyStatus

type ResendInvoiceSetupLink200JSONResponseBodyStatus string

ResendInvoiceSetupLink200JSONResponseBodyStatus defines parameters for ResendInvoiceSetupLink.

const (
	ResendInvoiceSetupLink200JSONResponseBodyStatusSent ResendInvoiceSetupLink200JSONResponseBodyStatus = "sent"
)

Defines values for ResendInvoiceSetupLink200JSONResponseBodyStatus.

func (ResendInvoiceSetupLink200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the ResendInvoiceSetupLink200JSONResponseBodyStatus enum.

type ResendInvoiceSetupLinkParams

type ResendInvoiceSetupLinkParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ResendInvoiceSetupLinkParams defines parameters for ResendInvoiceSetupLink.

type ResolveDunningRunJSONBody

type ResolveDunningRunJSONBody struct {
	// Resolution How the run ends, and what happens to its invoice (see above).
	Resolution ResolveDunningRunJSONBodyResolution `json:"resolution"`
}

ResolveDunningRunJSONBody defines parameters for ResolveDunningRun.

type ResolveDunningRunJSONBodyResolution

type ResolveDunningRunJSONBodyResolution string

ResolveDunningRunJSONBodyResolution defines parameters for ResolveDunningRun.

const (
	InvoiceNotCollectible ResolveDunningRunJSONBodyResolution = "invoice_not_collectible"
	InvoiceVoided         ResolveDunningRunJSONBodyResolution = "invoice_voided"
	PaymentRecovered      ResolveDunningRunJSONBodyResolution = "payment_recovered"
)

Defines values for ResolveDunningRunJSONBodyResolution.

func (ResolveDunningRunJSONBodyResolution) Valid

Valid indicates whether the value is a known member of the ResolveDunningRunJSONBodyResolution enum.

type ResolveDunningRunJSONRequestBody

type ResolveDunningRunJSONRequestBody ResolveDunningRunJSONBody

ResolveDunningRunJSONRequestBody defines body for ResolveDunningRun for application/json ContentType.

type ResolveDunningRunParams

type ResolveDunningRunParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ResolveDunningRunParams defines parameters for ResolveDunningRun.

type RetryCreditNoteRefundParams

type RetryCreditNoteRefundParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RetryCreditNoteRefundParams defines parameters for RetryCreditNoteRefund.

type RetryInvoiceTaxParams added in v0.9.2

type RetryInvoiceTaxParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RetryInvoiceTaxParams defines parameters for RetryInvoiceTax.

type RetrySubscriptionBillingParams added in v0.9.2

type RetrySubscriptionBillingParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RetrySubscriptionBillingParams defines parameters for RetrySubscriptionBilling.

type RetryTestClockAdvanceParams added in v0.9.2

type RetryTestClockAdvanceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RetryTestClockAdvanceParams defines parameters for RetryTestClockAdvance.

type RotateApiKeyJSONBody

type RotateApiKeyJSONBody struct {
	// ExpiresInSeconds Grace period for the old key. 0 revokes it immediately.
	ExpiresInSeconds int64 `json:"expires_in_seconds,omitempty"`
}

RotateApiKeyJSONBody defines parameters for RotateApiKey.

type RotateApiKeyJSONRequestBody

type RotateApiKeyJSONRequestBody RotateApiKeyJSONBody

RotateApiKeyJSONRequestBody defines body for RotateApiKey for application/json ContentType.

type RotateApiKeyParams

type RotateApiKeyParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RotateApiKeyParams defines parameters for RotateApiKey.

type RotateCustomerCostDashboardTokenParams added in v0.9.2

type RotateCustomerCostDashboardTokenParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RotateCustomerCostDashboardTokenParams defines parameters for RotateCustomerCostDashboardToken.

type RotateInvoicePublicTokenParams

type RotateInvoicePublicTokenParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RotateInvoicePublicTokenParams defines parameters for RotateInvoicePublicToken.

type RotateWebhookEndpointSecretParams added in v0.9.2

type RotateWebhookEndpointSecretParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RotateWebhookEndpointSecretParams defines parameters for RotateWebhookEndpointSecret.

type RunBillingParams added in v0.9.2

type RunBillingParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

RunBillingParams defines parameters for RunBilling.

type ScheduleSubscriptionCancelJSONBody

type ScheduleSubscriptionCancelJSONBody struct {
	// AtPeriodEnd Cancel at the end of the current period (or of the trial, while trialing).
	AtPeriodEnd bool `json:"at_period_end,omitempty"`

	// CancelAt Cancel at this instant. Must be in the future.
	CancelAt time.Time `json:"cancel_at,omitempty"`
}

ScheduleSubscriptionCancelJSONBody defines parameters for ScheduleSubscriptionCancel.

type ScheduleSubscriptionCancelJSONRequestBody

type ScheduleSubscriptionCancelJSONRequestBody ScheduleSubscriptionCancelJSONBody

ScheduleSubscriptionCancelJSONRequestBody defines body for ScheduleSubscriptionCancel for application/json ContentType.

type ScheduleSubscriptionCancelParams

type ScheduleSubscriptionCancelParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

ScheduleSubscriptionCancelParams defines parameters for ScheduleSubscriptionCancel.

type SendCreditNote200JSONResponseBodyStatus added in v0.9.2

type SendCreditNote200JSONResponseBodyStatus string

SendCreditNote200JSONResponseBodyStatus defines parameters for SendCreditNote.

const (
	SendCreditNote200JSONResponseBodyStatusSent SendCreditNote200JSONResponseBodyStatus = "sent"
)

Defines values for SendCreditNote200JSONResponseBodyStatus.

func (SendCreditNote200JSONResponseBodyStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the SendCreditNote200JSONResponseBodyStatus enum.

type SendCreditNoteJSONBody added in v0.9.2

type SendCreditNoteJSONBody struct {
	// AdditionalEmails Addresses to copy on this send. Absent copies the customer's stored list; `[]` copies nobody.
	AdditionalEmails []string `json:"additional_emails,omitempty"`

	// Email The recipient, one plain address such as `billing@acme.example`, with no display name.
	Email openapi_types.Email `json:"email"`
}

SendCreditNoteJSONBody defines parameters for SendCreditNote.

type SendCreditNoteJSONRequestBody added in v0.9.2

type SendCreditNoteJSONRequestBody SendCreditNoteJSONBody

SendCreditNoteJSONRequestBody defines body for SendCreditNote for application/json ContentType.

type SendCreditNoteParams added in v0.9.2

type SendCreditNoteParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SendCreditNoteParams defines parameters for SendCreditNote.

type SendCustomerPaymentSetupEmailJSONBody

type SendCustomerPaymentSetupEmailJSONBody struct {
	// Note Optional text shown at the top of the email. At most
	// 2000 bytes (UTF-8) after trimming whitespace.
	Note string `json:"note,omitempty"`
}

SendCustomerPaymentSetupEmailJSONBody defines parameters for SendCustomerPaymentSetupEmail.

type SendCustomerPaymentSetupEmailJSONRequestBody

type SendCustomerPaymentSetupEmailJSONRequestBody SendCustomerPaymentSetupEmailJSONBody

SendCustomerPaymentSetupEmailJSONRequestBody defines body for SendCustomerPaymentSetupEmail for application/json ContentType.

type SendCustomerPaymentSetupEmailParams

type SendCustomerPaymentSetupEmailParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SendCustomerPaymentSetupEmailParams defines parameters for SendCustomerPaymentSetupEmail.

type SendInvoice200JSONResponseBodyStatus added in v0.9.2

type SendInvoice200JSONResponseBodyStatus string

SendInvoice200JSONResponseBodyStatus defines parameters for SendInvoice.

const (
	Sent SendInvoice200JSONResponseBodyStatus = "sent"
)

Defines values for SendInvoice200JSONResponseBodyStatus.

func (SendInvoice200JSONResponseBodyStatus) Valid added in v0.9.2

Valid indicates whether the value is a known member of the SendInvoice200JSONResponseBodyStatus enum.

type SendInvoiceJSONBody added in v0.9.2

type SendInvoiceJSONBody struct {
	// AdditionalEmails Addresses to copy on this send. See the description for absent, empty and a list.
	AdditionalEmails []string `json:"additional_emails,omitempty"`

	// Email The recipient, one plain address such as `billing@acme.example`, with no display name.
	Email openapi_types.Email `json:"email"`
}

SendInvoiceJSONBody defines parameters for SendInvoice.

type SendInvoiceJSONRequestBody added in v0.9.2

type SendInvoiceJSONRequestBody SendInvoiceJSONBody

SendInvoiceJSONRequestBody defines body for SendInvoice for application/json ContentType.

type SendInvoiceParams added in v0.9.2

type SendInvoiceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SendInvoiceParams defines parameters for SendInvoice.

type SendTestEmailParams

type SendTestEmailParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SendTestEmailParams defines parameters for SendTestEmail.

type SentEmail

type SentEmail struct {
	// CreatedAt When the email was queued.
	CreatedAt time.Time `json:"created_at"`

	// DeliveryState What the email provider reported back about delivery.
	// `unknown` until it reports.
	DeliveryState SentEmailDeliveryState `json:"delivery_state"`

	// DispatchedAt When the mail server accepted the email. Absent until then.
	DispatchedAt time.Time `json:"dispatched_at,omitempty"`

	// EmailType Which email it is: the invoice, a payment receipt, a failed
	// payment notice, a request to add a payment method, a payment
	// reminder (`dunning_warning`), a final notice
	// (`dunning_escalation`), or a credit note.
	EmailType SentEmailEmailType `json:"email_type"`

	// Id The email's ID, `hc_emob_` and 20 characters.
	Id string `json:"id"`

	// InvoiceNumber The number of the invoice the email is about.
	InvoiceNumber string `json:"invoice_number,omitempty"`

	// LastError Why the last send attempt failed, or, on a `skipped` email, why
	// it was not sent. Cleared when the email is dispatched. Absent
	// when there is none.
	LastError string `json:"last_error,omitempty"`

	// Line The email in the words of the activity line standard, the same
	// as on the invoice's payment timeline: its name and what
	// happened to it ("Receipt email delivered"), why it was not
	// sent, the invoice it was about, and who it went to. Dated when
	// the mail server took it, or when it was queued if it was not
	// sent. For an email caused on a test clock, it is dated at the
	// clock time instead, with the real send time as `recorded_at`.
	// Present for every email type this list returns.
	Line ActivityLine `json:"line,omitempty"`

	// Recipient The address the email was sent to: its To address. CC copies
	// are not listed.
	Recipient string `json:"recipient"`

	// Status Hardcount's send state. `pending`: queued, or waiting to retry
	// after a failed attempt. `dispatched`: the mail server accepted
	// it. `failed`: it could not be sent, and Hardcount stopped
	// trying.
	// `skipped`: Hardcount did not send it because its invoice was
	// paid, voided or marked uncollectible while it waited. Only the
	// payment requests are skipped (failed payment notice, payment
	// reminder, final notice, payment setup request); a final notice
	// or payment setup request still goes out for an uncollectible
	// invoice.
	Status SentEmailStatus `json:"status"`
}

SentEmail One billing email Hardcount sent, or tried to send, to a customer about one of its invoices. `GET /v1/customers/{id}/sent-emails` lists them.

type SentEmailDeliveryState

type SentEmailDeliveryState string

SentEmailDeliveryState What the email provider reported back about delivery. `unknown` until it reports.

const (
	SentEmailDeliveryStateBounced    SentEmailDeliveryState = "bounced"
	SentEmailDeliveryStateComplained SentEmailDeliveryState = "complained"
	SentEmailDeliveryStateDelivered  SentEmailDeliveryState = "delivered"
	SentEmailDeliveryStateUnknown    SentEmailDeliveryState = "unknown"
)

Defines values for SentEmailDeliveryState.

func (SentEmailDeliveryState) Valid

func (e SentEmailDeliveryState) Valid() bool

Valid indicates whether the value is a known member of the SentEmailDeliveryState enum.

type SentEmailEmailType

type SentEmailEmailType string

SentEmailEmailType Which email it is: the invoice, a payment receipt, a failed payment notice, a request to add a payment method, a payment reminder (`dunning_warning`), a final notice (`dunning_escalation`), or a credit note.

const (
	SentEmailEmailTypeCreditNote          SentEmailEmailType = "credit_note"
	SentEmailEmailTypeDunningEscalation   SentEmailEmailType = "dunning_escalation"
	SentEmailEmailTypeDunningWarning      SentEmailEmailType = "dunning_warning"
	SentEmailEmailTypeInvoice             SentEmailEmailType = "invoice"
	SentEmailEmailTypePaymentFailed       SentEmailEmailType = "payment_failed"
	SentEmailEmailTypePaymentReceipt      SentEmailEmailType = "payment_receipt"
	SentEmailEmailTypePaymentSetupRequest SentEmailEmailType = "payment_setup_request"
)

Defines values for SentEmailEmailType.

func (SentEmailEmailType) Valid

func (e SentEmailEmailType) Valid() bool

Valid indicates whether the value is a known member of the SentEmailEmailType enum.

type SentEmailStatus

type SentEmailStatus string

SentEmailStatus Hardcount's send state. `pending`: queued, or waiting to retry after a failed attempt. `dispatched`: the mail server accepted it. `failed`: it could not be sent, and Hardcount stopped trying. `skipped`: Hardcount did not send it because its invoice was paid, voided or marked uncollectible while it waited. Only the payment requests are skipped (failed payment notice, payment reminder, final notice, payment setup request); a final notice or payment setup request still goes out for an uncollectible invoice.

const (
	SentEmailStatusDispatched SentEmailStatus = "dispatched"
	SentEmailStatusFailed     SentEmailStatus = "failed"
	SentEmailStatusPending    SentEmailStatus = "pending"
	SentEmailStatusSkipped    SentEmailStatus = "skipped"
)

Defines values for SentEmailStatus.

func (SentEmailStatus) Valid

func (e SentEmailStatus) Valid() bool

Valid indicates whether the value is a known member of the SentEmailStatus enum.

type ServerInterface

type ServerInterface interface {
	// Check that the server is up
	// (GET /health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// Check that the server can take requests
	// (GET /health/ready)
	GetHealthReady(w http.ResponseWriter, r *http.Request)
	// Get Prometheus metrics
	// (GET /metrics)
	GetMetrics(w http.ResponseWriter, r *http.Request)
	// Get MRR movement over time
	// (GET /v1/analytics/mrr-movement)
	GetAnalyticsMrrMovement(w http.ResponseWriter, r *http.Request, params GetAnalyticsMrrMovementParams)
	// Get headline billing metrics
	// (GET /v1/analytics/overview)
	GetAnalyticsOverview(w http.ResponseWriter, r *http.Request, params GetAnalyticsOverviewParams)
	// Get revenue over time
	// (GET /v1/analytics/revenue-chart)
	GetAnalyticsRevenueChart(w http.ResponseWriter, r *http.Request, params GetAnalyticsRevenueChartParams)
	// Get usage over time
	// (GET /v1/analytics/usage)
	GetAnalyticsUsage(w http.ResponseWriter, r *http.Request, params GetAnalyticsUsageParams)
	// List API keys
	// (GET /v1/api-keys)
	ListApiKeys(w http.ResponseWriter, r *http.Request, params ListApiKeysParams)
	// Create an API key
	// (POST /v1/api-keys)
	CreateApiKey(w http.ResponseWriter, r *http.Request, params CreateApiKeyParams)
	// Revoke an API key
	// (DELETE /v1/api-keys/{id})
	RevokeApiKey(w http.ResponseWriter, r *http.Request, id string)
	// Rotate an API key
	// (POST /v1/api-keys/{id}/rotate)
	RotateApiKey(w http.ResponseWriter, r *http.Request, id string, params RotateApiKeyParams)
	// List audit log entries
	// (GET /v1/audit-log)
	ListAuditLog(w http.ResponseWriter, r *http.Request, params ListAuditLogParams)
	// List audit log filter values
	// (GET /v1/audit-log/filters)
	GetAuditLogFilters(w http.ResponseWriter, r *http.Request)
	// Accept a team invitation
	// (POST /v1/auth/accept-invite)
	AcceptInvitation(w http.ResponseWriter, r *http.Request)
	// Preview a team invitation
	// (GET /v1/auth/invite/{token})
	GetInvitation(w http.ResponseWriter, r *http.Request, token string)
	// Sign in to the dashboard with email and password
	// (POST /v1/auth/login)
	Login(w http.ResponseWriter, r *http.Request)
	// Sign out of the dashboard
	// (POST /v1/auth/logout)
	Logout(w http.ResponseWriter, r *http.Request)
	// Switch the dashboard session between test and live mode
	// (POST /v1/auth/mode)
	SwitchSessionMode(w http.ResponseWriter, r *http.Request)
	// Check a password reset token
	// (GET /v1/auth/password-reset/check)
	CheckPasswordResetToken(w http.ResponseWriter, r *http.Request, params CheckPasswordResetTokenParams)
	// Set a new password using a reset token
	// (POST /v1/auth/password-reset/confirm)
	ConfirmPasswordReset(w http.ResponseWriter, r *http.Request)
	// Request a password reset link
	// (POST /v1/auth/password-reset/request)
	RequestPasswordReset(w http.ResponseWriter, r *http.Request)
	// Run billing now
	// (POST /v1/billing/run)
	RunBilling(w http.ResponseWriter, r *http.Request, params RunBillingParams)
	// Set up a new installation
	// (POST /v1/bootstrap)
	Bootstrap(w http.ResponseWriter, r *http.Request)
	// List credit notes
	// (GET /v1/credit-notes)
	ListCreditNotes(w http.ResponseWriter, r *http.Request, params ListCreditNotesParams)
	// Create a credit note
	// (POST /v1/credit-notes)
	CreateCreditNote(w http.ResponseWriter, r *http.Request, params CreateCreditNoteParams)
	// Get credit note totals
	// (GET /v1/credit-notes/stats)
	GetCreditNoteStats(w http.ResponseWriter, r *http.Request)
	// Get a credit note
	// (GET /v1/credit-notes/{id})
	GetCreditNote(w http.ResponseWriter, r *http.Request, id string)
	// Attach a refund made in Stripe to a credit note
	// (POST /v1/credit-notes/{id}/attach-stripe-refund)
	AttachStripeRefundToCreditNote(w http.ResponseWriter, r *http.Request, id string, params AttachStripeRefundToCreditNoteParams)
	// Issue a draft credit note
	// (POST /v1/credit-notes/{id}/issue)
	IssueCreditNote(w http.ResponseWriter, r *http.Request, id string, params IssueCreditNoteParams)
	// Download credit note PDF
	// (GET /v1/credit-notes/{id}/pdf)
	GetCreditNotePdf(w http.ResponseWriter, r *http.Request, id string)
	// Retry a failed credit-note refund
	// (POST /v1/credit-notes/{id}/retry-refund)
	RetryCreditNoteRefund(w http.ResponseWriter, r *http.Request, id string, params RetryCreditNoteRefundParams)
	// Email a credit note to the customer
	// (POST /v1/credit-notes/{id}/send)
	SendCreditNote(w http.ResponseWriter, r *http.Request, id string, params SendCreditNoteParams)
	// Void a draft credit note
	// (POST /v1/credit-notes/{id}/void)
	VoidCreditNote(w http.ResponseWriter, r *http.Request, id string, params VoidCreditNoteParams)
	// Add or remove credit
	// (POST /v1/credits/adjust)
	AdjustCredits(w http.ResponseWriter, r *http.Request, params AdjustCreditsParams)
	// Get a customer's credit balance
	// (GET /v1/credits/balance/{customer_id})
	GetCreditBalance(w http.ResponseWriter, r *http.Request, customerId string)
	// Get a customer's live credit balance
	// (GET /v1/credits/balance/{customer_id}/live)
	GetLiveCreditBalance(w http.ResponseWriter, r *http.Request, customerId string)
	// List credit balances
	// (GET /v1/credits/balances)
	ListCreditBalances(w http.ResponseWriter, r *http.Request, params ListCreditBalancesParams)
	// Grant credit to a customer
	// (POST /v1/credits/grant)
	GrantCredits(w http.ResponseWriter, r *http.Request, params GrantCreditsParams)
	// List a customer's credit grants
	// (GET /v1/credits/grants/{customer_id})
	GetCreditGrants(w http.ResponseWriter, r *http.Request, customerId string, params GetCreditGrantsParams)
	// List a customer's credit ledger
	// (GET /v1/credits/ledger/{customer_id})
	ListCreditLedgerEntries(w http.ResponseWriter, r *http.Request, customerId string, params ListCreditLedgerEntriesParams)
	// List customers
	// (GET /v1/customers)
	ListCustomers(w http.ResponseWriter, r *http.Request, params ListCustomersParams)
	// Create a customer
	// (POST /v1/customers)
	CreateCustomer(w http.ResponseWriter, r *http.Request, params CreateCustomerParams)
	// Get a customer overview
	// (GET /v1/customers/{customer_id}/overview)
	GetCustomerOverview(w http.ResponseWriter, r *http.Request, customerId string)
	// List the customer's payment methods
	// (GET /v1/customers/{customer_id}/payment-methods)
	ListCustomerPaymentMethods(w http.ResponseWriter, r *http.Request, customerId string, params ListCustomerPaymentMethodsParams)
	// Email the customer a link to add a payment method
	// (POST /v1/customers/{customer_id}/payment-methods/send-setup-email)
	SendCustomerPaymentSetupEmail(w http.ResponseWriter, r *http.Request, customerId string, params SendCustomerPaymentSetupEmailParams)
	// Create a link for the customer to add a payment method
	// (POST /v1/customers/{customer_id}/payment-methods/setup-session)
	CreateCustomerPaymentSetupSession(w http.ResponseWriter, r *http.Request, customerId string, params CreateCustomerPaymentSetupSessionParams)
	// Detach a payment method
	// (DELETE /v1/customers/{customer_id}/payment-methods/{pmID})
	DetachCustomerPaymentMethod(w http.ResponseWriter, r *http.Request, customerId string, pmid string)
	// Make a payment method the default
	// (POST /v1/customers/{customer_id}/payment-methods/{pmID}/default)
	SetCustomerDefaultPaymentMethod(w http.ResponseWriter, r *http.Request, customerId string, pmid string, params SetCustomerDefaultPaymentMethodParams)
	// Get a customer
	// (GET /v1/customers/{id})
	GetCustomer(w http.ResponseWriter, r *http.Request, id string)
	// Update a customer
	// (PATCH /v1/customers/{id})
	UpdateCustomer(w http.ResponseWriter, r *http.Request, id string, params UpdateCustomerParams)
	// Get the customer's billing profile
	// (GET /v1/customers/{id}/billing-profile)
	GetCustomerBillingProfile(w http.ResponseWriter, r *http.Request, id string)
	// Create or replace the customer's billing profile
	// (PUT /v1/customers/{id}/billing-profile)
	UpsertCustomerBillingProfile(w http.ResponseWriter, r *http.Request, id string, params UpsertCustomerBillingProfileParams)
	// Get a customer's margin report
	// (GET /v1/customers/{id}/margin)
	GetCustomerMargin(w http.ResponseWriter, r *http.Request, id string, params GetCustomerMarginParams)
	// Rotate the customer's public cost-dashboard link
	// (POST /v1/customers/{id}/rotate-cost-dashboard-token)
	RotateCustomerCostDashboardToken(w http.ResponseWriter, r *http.Request, id string, params RotateCustomerCostDashboardTokenParams)
	// List emails sent to the customer
	// (GET /v1/customers/{id}/sent-emails)
	ListCustomerSentEmails(w http.ResponseWriter, r *http.Request, id string, params ListCustomerSentEmailsParams)
	// Get the customer's usage and cost for a period
	// (GET /v1/customers/{id}/usage)
	GetCustomerUsage(w http.ResponseWriter, r *http.Request, id string, params GetCustomerUsageParams)
	// List dunning policies
	// (GET /v1/dunning/policies)
	ListDunningPolicies(w http.ResponseWriter, r *http.Request, params ListDunningPoliciesParams)
	// Create a dunning policy
	// (POST /v1/dunning/policies)
	CreateDunningPolicy(w http.ResponseWriter, r *http.Request, params CreateDunningPolicyParams)
	// Delete a dunning policy
	// (DELETE /v1/dunning/policies/{id})
	DeleteDunningPolicy(w http.ResponseWriter, r *http.Request, id string)
	// Get a dunning policy
	// (GET /v1/dunning/policies/{id})
	GetDunningPolicy(w http.ResponseWriter, r *http.Request, id string)
	// Replace a dunning policy's settings
	// (PATCH /v1/dunning/policies/{id})
	UpdateDunningPolicy(w http.ResponseWriter, r *http.Request, id string, params UpdateDunningPolicyParams)
	// Make a dunning policy the default
	// (POST /v1/dunning/policies/{id}/set-default)
	SetDefaultDunningPolicy(w http.ResponseWriter, r *http.Request, id string, params SetDefaultDunningPolicyParams)
	// List dunning runs
	// (GET /v1/dunning/runs)
	ListDunningRuns(w http.ResponseWriter, r *http.Request, params ListDunningRunsParams)
	// Get a dunning run with its events
	// (GET /v1/dunning/runs/{id})
	GetDunningRun(w http.ResponseWriter, r *http.Request, id string)
	// Resolve a dunning run
	// (POST /v1/dunning/runs/{id}/resolve)
	ResolveDunningRun(w http.ResponseWriter, r *http.Request, id string, params ResolveDunningRunParams)
	// Get dunning totals
	// (GET /v1/dunning/stats)
	GetDunningStats(w http.ResponseWriter, r *http.Request)
	// Export the audit log as CSV
	// (GET /v1/exports/audit-log.csv)
	ExportAuditLogCsv(w http.ResponseWriter, r *http.Request, params ExportAuditLogCsvParams)
	// Export customers as CSV
	// (GET /v1/exports/customers.csv)
	ExportCustomersCsv(w http.ResponseWriter, r *http.Request, params ExportCustomersCsvParams)
	// Export invoices as CSV
	// (GET /v1/exports/invoices.csv)
	ExportInvoicesCsv(w http.ResponseWriter, r *http.Request, params ExportInvoicesCsvParams)
	// Export subscriptions as CSV
	// (GET /v1/exports/subscriptions.csv)
	ExportSubscriptionsCsv(w http.ResponseWriter, r *http.Request, params ExportSubscriptionsCsvParams)
	// Export usage events as CSV
	// (GET /v1/exports/usage-events.csv)
	ExportUsageEventsCsv(w http.ResponseWriter, r *http.Request, params ExportUsageEventsCsvParams)
	// Receive LiteLLM spend logs
	// (POST /v1/integrations/litellm/spend)
	IngestLitellmSpend(w http.ResponseWriter, r *http.Request)
	// List invoices
	// (GET /v1/invoices)
	ListInvoices(w http.ResponseWriter, r *http.Request, params ListInvoicesParams)
	// Create a draft invoice
	// (POST /v1/invoices)
	CreateInvoice(w http.ResponseWriter, r *http.Request, params CreateInvoiceParams)
	// Preview a customer's next invoice
	// (POST /v1/invoices/create_preview)
	CreateInvoicePreview(w http.ResponseWriter, r *http.Request, params CreateInvoicePreviewParams)
	// Get an invoice with its line items
	// (GET /v1/invoices/{id})
	GetInvoice(w http.ResponseWriter, r *http.Request, id string)
	// Charge a finalized invoice now
	// (POST /v1/invoices/{id}/collect)
	CollectInvoicePayment(w http.ResponseWriter, r *http.Request, id string, params CollectInvoicePaymentParams)
	// List the card disputes on an invoice
	// (GET /v1/invoices/{id}/disputes)
	ListInvoiceDisputes(w http.ResponseWriter, r *http.Request, id string, params ListInvoiceDisputesParams)
	// Finalize a draft invoice
	// (POST /v1/invoices/{id}/finalize)
	FinalizeInvoice(w http.ResponseWriter, r *http.Request, id string, params FinalizeInvoiceParams)
	// Add a line item to a draft invoice
	// (POST /v1/invoices/{id}/line-items)
	AddInvoiceLineItem(w http.ResponseWriter, r *http.Request, id string, params AddInvoiceLineItemParams)
	// Write off an invoice as uncollectible
	// (POST /v1/invoices/{id}/mark-uncollectible)
	MarkInvoiceUncollectible(w http.ResponseWriter, r *http.Request, id string, params MarkInvoiceUncollectibleParams)
	// Get the invoice activity timeline
	// (GET /v1/invoices/{id}/payment-timeline)
	GetInvoicePaymentTimeline(w http.ResponseWriter, r *http.Request, id string)
	// Download an invoice PDF
	// (GET /v1/invoices/{id}/pdf)
	GetInvoicePdf(w http.ResponseWriter, r *http.Request, id string)
	// Record a payment made outside Stripe
	// (POST /v1/invoices/{id}/record-payment)
	RecordInvoicePayment(w http.ResponseWriter, r *http.Request, id string, params RecordInvoicePaymentParams)
	// Refund a paid invoice
	// (POST /v1/invoices/{id}/refund)
	RefundInvoice(w http.ResponseWriter, r *http.Request, id string, params RefundInvoiceParams)
	// Resend the payment-method setup link
	// (POST /v1/invoices/{id}/resend-setup-link)
	ResendInvoiceSetupLink(w http.ResponseWriter, r *http.Request, id string, params ResendInvoiceSetupLinkParams)
	// Retry tax calculation on a draft invoice
	// (POST /v1/invoices/{id}/retry-tax)
	RetryInvoiceTax(w http.ResponseWriter, r *http.Request, id string, params RetryInvoiceTaxParams)
	// Replace the hosted invoice link
	// (POST /v1/invoices/{id}/rotate-public-token)
	RotateInvoicePublicToken(w http.ResponseWriter, r *http.Request, id string, params RotateInvoicePublicTokenParams)
	// Email an invoice to the customer
	// (POST /v1/invoices/{id}/send)
	SendInvoice(w http.ResponseWriter, r *http.Request, id string, params SendInvoiceParams)
	// List the refunds made in Stripe on an invoice
	// (GET /v1/invoices/{id}/stripe-refunds)
	ListInvoiceStripeRefunds(w http.ResponseWriter, r *http.Request, id string, params ListInvoiceStripeRefundsParams)
	// Dismiss a refund made in Stripe
	// (POST /v1/invoices/{id}/stripe-refunds/{stripe_refund_id}/dismiss)
	DismissInvoiceStripeRefund(w http.ResponseWriter, r *http.Request, id string, stripeRefundId string, params DismissInvoiceStripeRefundParams)
	// Void an invoice
	// (POST /v1/invoices/{id}/void)
	VoidInvoice(w http.ResponseWriter, r *http.Request, id string, params VoidInvoiceParams)
	// List team members and invitations
	// (GET /v1/members)
	ListMembers(w http.ResponseWriter, r *http.Request)
	// Revoke an invitation
	// (DELETE /v1/members/invitations/{id})
	RevokeMemberInvitation(w http.ResponseWriter, r *http.Request, id string)
	// Invite a teammate by email
	// (POST /v1/members/invite)
	InviteMember(w http.ResponseWriter, r *http.Request, params InviteMemberParams)
	// Remove a member from the account
	// (DELETE /v1/members/{userID})
	RemoveMember(w http.ResponseWriter, r *http.Request, userID string)
	// List meters
	// (GET /v1/meters)
	ListMeters(w http.ResponseWriter, r *http.Request, params ListMetersParams)
	// Create a meter
	// (POST /v1/meters)
	CreateMeter(w http.ResponseWriter, r *http.Request, params CreateMeterParams)
	// Get a meter
	// (GET /v1/meters/{id})
	GetMeter(w http.ResponseWriter, r *http.Request, id string)
	// Update a meter
	// (PATCH /v1/meters/{id})
	UpdateMeter(w http.ResponseWriter, r *http.Request, id string, params UpdateMeterParams)
	// List plans
	// (GET /v1/plans)
	ListPlans(w http.ResponseWriter, r *http.Request, params ListPlansParams)
	// Create a plan
	// (POST /v1/plans)
	CreatePlan(w http.ResponseWriter, r *http.Request, params CreatePlanParams)
	// Get a plan
	// (GET /v1/plans/{id})
	GetPlan(w http.ResponseWriter, r *http.Request, id string)
	// Update a plan
	// (PATCH /v1/plans/{id})
	UpdatePlan(w http.ResponseWriter, r *http.Request, id string, params UpdatePlanParams)
	// List a plan's prices
	// (GET /v1/plans/{id}/prices)
	ListPlanPrices(w http.ResponseWriter, r *http.Request, id string, params ListPlanPricesParams)
	// Add a price to a plan
	// (POST /v1/plans/{id}/prices)
	AddPlanPrice(w http.ResponseWriter, r *http.Request, id string, params AddPlanPriceParams)
	// Remove a price from a plan
	// (DELETE /v1/plans/{id}/prices/{price_id})
	RemovePlanPrice(w http.ResponseWriter, r *http.Request, id string, priceId string)
	// Change a price's rate
	// (PATCH /v1/plans/{id}/prices/{price_id})
	UpdatePlanPrice(w http.ResponseWriter, r *http.Request, id string, priceId string, params UpdatePlanPriceParams)
	// List active price overrides
	// (GET /v1/price-overrides)
	ListPriceOverrides(w http.ResponseWriter, r *http.Request, params ListPriceOverridesParams)
	// Create a customer price override
	// (POST /v1/price-overrides)
	CreatePriceOverride(w http.ResponseWriter, r *http.Request, params CreatePriceOverrideParams)
	// End a customer price override
	// (DELETE /v1/price-overrides/{id})
	DeletePriceOverride(w http.ResponseWriter, r *http.Request, id string)
	// List provider cost rates
	// (GET /v1/provider-costs)
	ListProviderCosts(w http.ResponseWriter, r *http.Request, params ListProviderCostsParams)
	// Create or update a provider cost rate
	// (PUT /v1/provider-costs)
	UpsertProviderCost(w http.ResponseWriter, r *http.Request, params UpsertProviderCostParams)
	// Delete a provider cost rate
	// (DELETE /v1/provider-costs/{id})
	DeleteProviderCost(w http.ResponseWriter, r *http.Request, id string)
	// Get a customer's public cost dashboard
	// (GET /v1/public/cost-dashboard/{token})
	GetPublicCostDashboard(w http.ResponseWriter, r *http.Request, token string)
	// Data behind the hosted invoice page
	// (GET /v1/public/invoices/{token})
	GetHostedInvoice(w http.ResponseWriter, r *http.Request, token string)
	// Start paying the invoice in Stripe Checkout
	// (POST /v1/public/invoices/{token}/checkout)
	CreateHostedInvoiceCheckout(w http.ResponseWriter, r *http.Request, token string)
	// Download the hosted invoice PDF
	// (GET /v1/public/invoices/{token}/pdf)
	GetHostedInvoicePdf(w http.ResponseWriter, r *http.Request, token string)
	// Get what the payment-update page shows
	// (GET /v1/public/payment-updates/{token})
	GetPublicPaymentUpdate(w http.ResponseWriter, r *http.Request, token string)
	// Start adding a card in Stripe Checkout
	// (POST /v1/public/payment-updates/{token}/checkout)
	CreatePublicPaymentUpdateCheckout(w http.ResponseWriter, r *http.Request, token string)
	// List recipes
	// (GET /v1/recipes)
	ListRecipes(w http.ResponseWriter, r *http.Request, params ListRecipesParams)
	// List installed recipes
	// (GET /v1/recipes/instances)
	ListRecipeInstances(w http.ResponseWriter, r *http.Request, params ListRecipeInstancesParams)
	// Get a recipe
	// (GET /v1/recipes/{key})
	GetRecipe(w http.ResponseWriter, r *http.Request, key string)
	// Install a recipe
	// (POST /v1/recipes/{key}/instantiate)
	InstantiateRecipe(w http.ResponseWriter, r *http.Request, key string, params InstantiateRecipeParams)
	// Preview a recipe
	// (POST /v1/recipes/{key}/preview)
	PreviewRecipe(w http.ResponseWriter, r *http.Request, key string, params PreviewRecipeParams)
	// Get account settings
	// (GET /v1/settings)
	GetTenantSettings(w http.ResponseWriter, r *http.Request)
	// Update account settings
	// (PUT /v1/settings)
	UpdateTenantSettings(w http.ResponseWriter, r *http.Request, params UpdateTenantSettingsParams)
	// Get the email setup status
	// (GET /v1/settings/email)
	GetEmailSettings(w http.ResponseWriter, r *http.Request)
	// Send a test email
	// (POST /v1/settings/email/test)
	SendTestEmail(w http.ResponseWriter, r *http.Request, params SendTestEmailParams)
	// List Stripe connections
	// (GET /v1/settings/stripe)
	ListStripeConnections(w http.ResponseWriter, r *http.Request)
	// Connect a Stripe account
	// (POST /v1/settings/stripe)
	ConnectStripe(w http.ResponseWriter, r *http.Request, params ConnectStripeParams)
	// Disconnect Stripe for one mode
	// (DELETE /v1/settings/stripe/{mode})
	DisconnectStripe(w http.ResponseWriter, r *http.Request, mode DisconnectStripeParamsMode)
	// Set the Stripe webhook signing secret
	// (PATCH /v1/settings/stripe/{mode}/webhook)
	SetStripeWebhookSecret(w http.ResponseWriter, r *http.Request, mode SetStripeWebhookSecretParamsMode, params SetStripeWebhookSecretParams)
	// List subscriptions
	// (GET /v1/subscriptions)
	ListSubscriptions(w http.ResponseWriter, r *http.Request, params ListSubscriptionsParams)
	// Create a subscription
	// (POST /v1/subscriptions)
	CreateSubscription(w http.ResponseWriter, r *http.Request, params CreateSubscriptionParams)
	// Get a subscription
	// (GET /v1/subscriptions/{id})
	GetSubscription(w http.ResponseWriter, r *http.Request, id string)
	// Activate a draft subscription
	// (POST /v1/subscriptions/{id}/activate)
	ActivateSubscription(w http.ResponseWriter, r *http.Request, id string, params ActivateSubscriptionParams)
	// Clear billing thresholds
	// (DELETE /v1/subscriptions/{id}/billing-thresholds)
	ClearSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request, id string)
	// Set billing thresholds
	// (PUT /v1/subscriptions/{id}/billing-thresholds)
	SetSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request, id string, params SetSubscriptionBillingThresholdsParams)
	// Cancel a subscription now
	// (POST /v1/subscriptions/{id}/cancel)
	CancelSubscription(w http.ResponseWriter, r *http.Request, id string, params CancelSubscriptionParams)
	// End a trial now
	// (POST /v1/subscriptions/{id}/end-trial)
	EndSubscriptionTrial(w http.ResponseWriter, r *http.Request, id string, params EndSubscriptionTrialParams)
	// Extend a trial
	// (POST /v1/subscriptions/{id}/extend-trial)
	ExtendSubscriptionTrial(w http.ResponseWriter, r *http.Request, id string, params ExtendSubscriptionTrialParams)
	// Add an item to a subscription
	// (POST /v1/subscriptions/{id}/items)
	AddSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, params AddSubscriptionItemParams)
	// Remove a subscription item
	// (DELETE /v1/subscriptions/{id}/items/{itemID})
	RemoveSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, itemID string)
	// Change a subscription item
	// (PATCH /v1/subscriptions/{id}/items/{itemID})
	UpdateSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, itemID string, params UpdateSubscriptionItemParams)
	// Cancel a scheduled plan change
	// (DELETE /v1/subscriptions/{id}/items/{itemID}/pending-change)
	CancelSubscriptionItemPendingChange(w http.ResponseWriter, r *http.Request, id string, itemID string)
	// Resume collection
	// (DELETE /v1/subscriptions/{id}/pause-collection)
	ResumeSubscriptionCollection(w http.ResponseWriter, r *http.Request, id string)
	// Pause collection
	// (PUT /v1/subscriptions/{id}/pause-collection)
	PauseSubscriptionCollection(w http.ResponseWriter, r *http.Request, id string, params PauseSubscriptionCollectionParams)
	// Retry a subscription's failed billing
	// (POST /v1/subscriptions/{id}/retry-billing)
	RetrySubscriptionBilling(w http.ResponseWriter, r *http.Request, id string, params RetrySubscriptionBillingParams)
	// Schedule a cancel
	// (POST /v1/subscriptions/{id}/schedule-cancel)
	ScheduleSubscriptionCancel(w http.ResponseWriter, r *http.Request, id string, params ScheduleSubscriptionCancelParams)
	// Clear a scheduled cancel
	// (DELETE /v1/subscriptions/{id}/scheduled-cancel)
	ClearSubscriptionScheduledCancel(w http.ResponseWriter, r *http.Request, id string)
	// Get a subscription's activity timeline
	// (GET /v1/subscriptions/{id}/timeline)
	GetSubscriptionTimeline(w http.ResponseWriter, r *http.Request, id string)
	// List test clocks
	// (GET /v1/test-clocks)
	ListTestClocks(w http.ResponseWriter, r *http.Request, params ListTestClocksParams)
	// Create a test clock
	// (POST /v1/test-clocks)
	CreateTestClock(w http.ResponseWriter, r *http.Request, params CreateTestClockParams)
	// Delete a test clock and its simulated data
	// (DELETE /v1/test-clocks/{id})
	DeleteTestClock(w http.ResponseWriter, r *http.Request, id string)
	// Get a test clock
	// (GET /v1/test-clocks/{id})
	GetTestClock(w http.ResponseWriter, r *http.Request, id string)
	// Advance a test clock
	// (POST /v1/test-clocks/{id}/advance)
	AdvanceTestClock(w http.ResponseWriter, r *http.Request, id string, params AdvanceTestClockParams)
	// List customers attached to a test clock
	// (GET /v1/test-clocks/{id}/customers)
	ListTestClockCustomers(w http.ResponseWriter, r *http.Request, id string, params ListTestClockCustomersParams)
	// Retry a failed test clock advance
	// (POST /v1/test-clocks/{id}/retry-advance)
	RetryTestClockAdvance(w http.ResponseWriter, r *http.Request, id string, params RetryTestClockAdvanceParams)
	// List a test clock's subscriptions
	// (GET /v1/test-clocks/{id}/subscriptions)
	ListTestClockSubscriptions(w http.ResponseWriter, r *http.Request, id string, params ListTestClockSubscriptionsParams)
	// List usage events
	// (GET /v1/usage-events)
	ListUsageEvents(w http.ResponseWriter, r *http.Request, params ListUsageEventsParams)
	// Send a usage event
	// (POST /v1/usage-events)
	CreateUsageEvent(w http.ResponseWriter, r *http.Request)
	// Get usage totals
	// (GET /v1/usage-events/aggregate)
	AggregateUsageEvents(w http.ResponseWriter, r *http.Request, params AggregateUsageEventsParams)
	// Backfill a past usage event
	// (POST /v1/usage-events/backfill)
	BackfillUsageEvent(w http.ResponseWriter, r *http.Request)
	// Send a batch of usage events
	// (POST /v1/usage-events/batch)
	CreateUsageEventBatch(w http.ResponseWriter, r *http.Request)
	// List held usage
	// (GET /v1/usage-events/held)
	ListHeldUsage(w http.ResponseWriter, r *http.Request)
	// Discard held usage
	// (POST /v1/usage-events/held/discard)
	DiscardHeldUsage(w http.ResponseWriter, r *http.Request)
	// Release held usage
	// (POST /v1/usage-events/held/release)
	ReleaseHeldUsage(w http.ResponseWriter, r *http.Request)
	// List webhook endpoints
	// (GET /v1/webhook-endpoints/endpoints)
	ListWebhookEndpoints(w http.ResponseWriter, r *http.Request, params ListWebhookEndpointsParams)
	// Create a webhook endpoint
	// (POST /v1/webhook-endpoints/endpoints)
	CreateWebhookEndpoint(w http.ResponseWriter, r *http.Request, params CreateWebhookEndpointParams)
	// Get delivery counts per webhook endpoint
	// (GET /v1/webhook-endpoints/endpoints/stats)
	GetWebhookEndpointStats(w http.ResponseWriter, r *http.Request, params GetWebhookEndpointStatsParams)
	// Delete a webhook endpoint
	// (DELETE /v1/webhook-endpoints/endpoints/{id})
	DeleteWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string)
	// Get a webhook endpoint
	// (GET /v1/webhook-endpoints/endpoints/{id})
	GetWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string)
	// Update a webhook endpoint
	// (PATCH /v1/webhook-endpoints/endpoints/{id})
	UpdateWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string, params UpdateWebhookEndpointParams)
	// List an endpoint's deliveries
	// (GET /v1/webhook-endpoints/endpoints/{id}/deliveries)
	ListWebhookEndpointDeliveries(w http.ResponseWriter, r *http.Request, id string, params ListWebhookEndpointDeliveriesParams)
	// Resend one delivery to its endpoint
	// (POST /v1/webhook-endpoints/endpoints/{id}/deliveries/{deliveryID}/replay)
	ReplayWebhookDelivery(w http.ResponseWriter, r *http.Request, id string, deliveryID string, params ReplayWebhookDeliveryParams)
	// Rotate a webhook endpoint's signing secret
	// (POST /v1/webhook-endpoints/endpoints/{id}/rotate-secret)
	RotateWebhookEndpointSecret(w http.ResponseWriter, r *http.Request, id string, params RotateWebhookEndpointSecretParams)
	// List webhook events
	// (GET /v1/webhook-endpoints/events)
	ListWebhookEvents(w http.ResponseWriter, r *http.Request, params ListWebhookEventsParams)
	// Stream webhook events as they happen
	// (GET /v1/webhook_events/stream)
	StreamWebhookEvents(w http.ResponseWriter, r *http.Request)
	// List all deliveries of an event and its replays
	// (GET /v1/webhook_events/{id}/deliveries)
	ListWebhookEventDeliveries(w http.ResponseWriter, r *http.Request, id string)
	// Replay an event to all matching endpoints
	// (POST /v1/webhook_events/{id}/replay)
	ReplayWebhookEvent(w http.ResponseWriter, r *http.Request, id string, params ReplayWebhookEventParams)
	// Receive a Postmark delivery webhook
	// (POST /v1/webhooks/postmark)
	ReceivePostmarkWebhook(w http.ResponseWriter, r *http.Request)
	// Receive a Stripe webhook
	// (POST /v1/webhooks/stripe/{endpoint_id})
	ReceiveStripeWebhook(w http.ResponseWriter, r *http.Request, endpointId string, params ReceiveStripeWebhookParams)
	// Get the account and mode of the current credential
	// (GET /v1/whoami)
	GetWhoami(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AcceptInvitation added in v0.9.2

func (siw *ServerInterfaceWrapper) AcceptInvitation(w http.ResponseWriter, r *http.Request)

AcceptInvitation operation middleware

func (*ServerInterfaceWrapper) ActivateSubscription added in v0.9.2

func (siw *ServerInterfaceWrapper) ActivateSubscription(w http.ResponseWriter, r *http.Request)

ActivateSubscription operation middleware

func (*ServerInterfaceWrapper) AddInvoiceLineItem

func (siw *ServerInterfaceWrapper) AddInvoiceLineItem(w http.ResponseWriter, r *http.Request)

AddInvoiceLineItem operation middleware

func (*ServerInterfaceWrapper) AddPlanPrice

func (siw *ServerInterfaceWrapper) AddPlanPrice(w http.ResponseWriter, r *http.Request)

AddPlanPrice operation middleware

func (*ServerInterfaceWrapper) AddSubscriptionItem

func (siw *ServerInterfaceWrapper) AddSubscriptionItem(w http.ResponseWriter, r *http.Request)

AddSubscriptionItem operation middleware

func (*ServerInterfaceWrapper) AdjustCredits

func (siw *ServerInterfaceWrapper) AdjustCredits(w http.ResponseWriter, r *http.Request)

AdjustCredits operation middleware

func (*ServerInterfaceWrapper) AdvanceTestClock added in v0.9.2

func (siw *ServerInterfaceWrapper) AdvanceTestClock(w http.ResponseWriter, r *http.Request)

AdvanceTestClock operation middleware

func (*ServerInterfaceWrapper) AggregateUsageEvents

func (siw *ServerInterfaceWrapper) AggregateUsageEvents(w http.ResponseWriter, r *http.Request)

AggregateUsageEvents operation middleware

func (*ServerInterfaceWrapper) AttachStripeRefundToCreditNote added in v0.9.2

func (siw *ServerInterfaceWrapper) AttachStripeRefundToCreditNote(w http.ResponseWriter, r *http.Request)

AttachStripeRefundToCreditNote operation middleware

func (*ServerInterfaceWrapper) BackfillUsageEvent

func (siw *ServerInterfaceWrapper) BackfillUsageEvent(w http.ResponseWriter, r *http.Request)

BackfillUsageEvent operation middleware

func (*ServerInterfaceWrapper) Bootstrap

func (siw *ServerInterfaceWrapper) Bootstrap(w http.ResponseWriter, r *http.Request)

Bootstrap operation middleware

func (*ServerInterfaceWrapper) CancelSubscription

func (siw *ServerInterfaceWrapper) CancelSubscription(w http.ResponseWriter, r *http.Request)

CancelSubscription operation middleware

func (*ServerInterfaceWrapper) CancelSubscriptionItemPendingChange

func (siw *ServerInterfaceWrapper) CancelSubscriptionItemPendingChange(w http.ResponseWriter, r *http.Request)

CancelSubscriptionItemPendingChange operation middleware

func (*ServerInterfaceWrapper) CheckPasswordResetToken

func (siw *ServerInterfaceWrapper) CheckPasswordResetToken(w http.ResponseWriter, r *http.Request)

CheckPasswordResetToken operation middleware

func (*ServerInterfaceWrapper) ClearSubscriptionBillingThresholds

func (siw *ServerInterfaceWrapper) ClearSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request)

ClearSubscriptionBillingThresholds operation middleware

func (*ServerInterfaceWrapper) ClearSubscriptionScheduledCancel

func (siw *ServerInterfaceWrapper) ClearSubscriptionScheduledCancel(w http.ResponseWriter, r *http.Request)

ClearSubscriptionScheduledCancel operation middleware

func (*ServerInterfaceWrapper) CollectInvoicePayment

func (siw *ServerInterfaceWrapper) CollectInvoicePayment(w http.ResponseWriter, r *http.Request)

CollectInvoicePayment operation middleware

func (*ServerInterfaceWrapper) ConfirmPasswordReset added in v0.9.2

func (siw *ServerInterfaceWrapper) ConfirmPasswordReset(w http.ResponseWriter, r *http.Request)

ConfirmPasswordReset operation middleware

func (*ServerInterfaceWrapper) ConnectStripe

func (siw *ServerInterfaceWrapper) ConnectStripe(w http.ResponseWriter, r *http.Request)

ConnectStripe operation middleware

func (*ServerInterfaceWrapper) CreateApiKey

func (siw *ServerInterfaceWrapper) CreateApiKey(w http.ResponseWriter, r *http.Request)

CreateApiKey operation middleware

func (*ServerInterfaceWrapper) CreateCreditNote added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateCreditNote(w http.ResponseWriter, r *http.Request)

CreateCreditNote operation middleware

func (*ServerInterfaceWrapper) CreateCustomer added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateCustomer(w http.ResponseWriter, r *http.Request)

CreateCustomer operation middleware

func (*ServerInterfaceWrapper) CreateCustomerPaymentSetupSession

func (siw *ServerInterfaceWrapper) CreateCustomerPaymentSetupSession(w http.ResponseWriter, r *http.Request)

CreateCustomerPaymentSetupSession operation middleware

func (*ServerInterfaceWrapper) CreateDunningPolicy

func (siw *ServerInterfaceWrapper) CreateDunningPolicy(w http.ResponseWriter, r *http.Request)

CreateDunningPolicy operation middleware

func (*ServerInterfaceWrapper) CreateHostedInvoiceCheckout

func (siw *ServerInterfaceWrapper) CreateHostedInvoiceCheckout(w http.ResponseWriter, r *http.Request)

CreateHostedInvoiceCheckout operation middleware

func (*ServerInterfaceWrapper) CreateInvoice

func (siw *ServerInterfaceWrapper) CreateInvoice(w http.ResponseWriter, r *http.Request)

CreateInvoice operation middleware

func (*ServerInterfaceWrapper) CreateInvoicePreview added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateInvoicePreview(w http.ResponseWriter, r *http.Request)

CreateInvoicePreview operation middleware

func (*ServerInterfaceWrapper) CreateMeter added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateMeter(w http.ResponseWriter, r *http.Request)

CreateMeter operation middleware

func (*ServerInterfaceWrapper) CreatePlan added in v0.9.2

func (siw *ServerInterfaceWrapper) CreatePlan(w http.ResponseWriter, r *http.Request)

CreatePlan operation middleware

func (*ServerInterfaceWrapper) CreatePriceOverride

func (siw *ServerInterfaceWrapper) CreatePriceOverride(w http.ResponseWriter, r *http.Request)

CreatePriceOverride operation middleware

func (*ServerInterfaceWrapper) CreatePublicPaymentUpdateCheckout

func (siw *ServerInterfaceWrapper) CreatePublicPaymentUpdateCheckout(w http.ResponseWriter, r *http.Request)

CreatePublicPaymentUpdateCheckout operation middleware

func (*ServerInterfaceWrapper) CreateSubscription added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateSubscription(w http.ResponseWriter, r *http.Request)

CreateSubscription operation middleware

func (*ServerInterfaceWrapper) CreateTestClock added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateTestClock(w http.ResponseWriter, r *http.Request)

CreateTestClock operation middleware

func (*ServerInterfaceWrapper) CreateUsageEvent added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateUsageEvent(w http.ResponseWriter, r *http.Request)

CreateUsageEvent operation middleware

func (*ServerInterfaceWrapper) CreateUsageEventBatch added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateUsageEventBatch(w http.ResponseWriter, r *http.Request)

CreateUsageEventBatch operation middleware

func (*ServerInterfaceWrapper) CreateWebhookEndpoint added in v0.9.2

func (siw *ServerInterfaceWrapper) CreateWebhookEndpoint(w http.ResponseWriter, r *http.Request)

CreateWebhookEndpoint operation middleware

func (*ServerInterfaceWrapper) DeleteDunningPolicy

func (siw *ServerInterfaceWrapper) DeleteDunningPolicy(w http.ResponseWriter, r *http.Request)

DeleteDunningPolicy operation middleware

func (*ServerInterfaceWrapper) DeletePriceOverride

func (siw *ServerInterfaceWrapper) DeletePriceOverride(w http.ResponseWriter, r *http.Request)

DeletePriceOverride operation middleware

func (*ServerInterfaceWrapper) DeleteProviderCost added in v0.9.2

func (siw *ServerInterfaceWrapper) DeleteProviderCost(w http.ResponseWriter, r *http.Request)

DeleteProviderCost operation middleware

func (*ServerInterfaceWrapper) DeleteTestClock added in v0.9.2

func (siw *ServerInterfaceWrapper) DeleteTestClock(w http.ResponseWriter, r *http.Request)

DeleteTestClock operation middleware

func (*ServerInterfaceWrapper) DeleteWebhookEndpoint added in v0.9.2

func (siw *ServerInterfaceWrapper) DeleteWebhookEndpoint(w http.ResponseWriter, r *http.Request)

DeleteWebhookEndpoint operation middleware

func (*ServerInterfaceWrapper) DetachCustomerPaymentMethod

func (siw *ServerInterfaceWrapper) DetachCustomerPaymentMethod(w http.ResponseWriter, r *http.Request)

DetachCustomerPaymentMethod operation middleware

func (*ServerInterfaceWrapper) DiscardHeldUsage

func (siw *ServerInterfaceWrapper) DiscardHeldUsage(w http.ResponseWriter, r *http.Request)

DiscardHeldUsage operation middleware

func (*ServerInterfaceWrapper) DisconnectStripe

func (siw *ServerInterfaceWrapper) DisconnectStripe(w http.ResponseWriter, r *http.Request)

DisconnectStripe operation middleware

func (*ServerInterfaceWrapper) DismissInvoiceStripeRefund added in v0.9.2

func (siw *ServerInterfaceWrapper) DismissInvoiceStripeRefund(w http.ResponseWriter, r *http.Request)

DismissInvoiceStripeRefund operation middleware

func (*ServerInterfaceWrapper) EndSubscriptionTrial

func (siw *ServerInterfaceWrapper) EndSubscriptionTrial(w http.ResponseWriter, r *http.Request)

EndSubscriptionTrial operation middleware

func (*ServerInterfaceWrapper) ExportAuditLogCsv

func (siw *ServerInterfaceWrapper) ExportAuditLogCsv(w http.ResponseWriter, r *http.Request)

ExportAuditLogCsv operation middleware

func (*ServerInterfaceWrapper) ExportCustomersCsv

func (siw *ServerInterfaceWrapper) ExportCustomersCsv(w http.ResponseWriter, r *http.Request)

ExportCustomersCsv operation middleware

func (*ServerInterfaceWrapper) ExportInvoicesCsv

func (siw *ServerInterfaceWrapper) ExportInvoicesCsv(w http.ResponseWriter, r *http.Request)

ExportInvoicesCsv operation middleware

func (*ServerInterfaceWrapper) ExportSubscriptionsCsv

func (siw *ServerInterfaceWrapper) ExportSubscriptionsCsv(w http.ResponseWriter, r *http.Request)

ExportSubscriptionsCsv operation middleware

func (*ServerInterfaceWrapper) ExportUsageEventsCsv

func (siw *ServerInterfaceWrapper) ExportUsageEventsCsv(w http.ResponseWriter, r *http.Request)

ExportUsageEventsCsv operation middleware

func (*ServerInterfaceWrapper) ExtendSubscriptionTrial

func (siw *ServerInterfaceWrapper) ExtendSubscriptionTrial(w http.ResponseWriter, r *http.Request)

ExtendSubscriptionTrial operation middleware

func (*ServerInterfaceWrapper) FinalizeInvoice added in v0.9.2

func (siw *ServerInterfaceWrapper) FinalizeInvoice(w http.ResponseWriter, r *http.Request)

FinalizeInvoice operation middleware

func (*ServerInterfaceWrapper) GetAnalyticsMrrMovement

func (siw *ServerInterfaceWrapper) GetAnalyticsMrrMovement(w http.ResponseWriter, r *http.Request)

GetAnalyticsMrrMovement operation middleware

func (*ServerInterfaceWrapper) GetAnalyticsOverview

func (siw *ServerInterfaceWrapper) GetAnalyticsOverview(w http.ResponseWriter, r *http.Request)

GetAnalyticsOverview operation middleware

func (*ServerInterfaceWrapper) GetAnalyticsRevenueChart

func (siw *ServerInterfaceWrapper) GetAnalyticsRevenueChart(w http.ResponseWriter, r *http.Request)

GetAnalyticsRevenueChart operation middleware

func (*ServerInterfaceWrapper) GetAnalyticsUsage

func (siw *ServerInterfaceWrapper) GetAnalyticsUsage(w http.ResponseWriter, r *http.Request)

GetAnalyticsUsage operation middleware

func (*ServerInterfaceWrapper) GetAuditLogFilters

func (siw *ServerInterfaceWrapper) GetAuditLogFilters(w http.ResponseWriter, r *http.Request)

GetAuditLogFilters operation middleware

func (*ServerInterfaceWrapper) GetCreditBalance added in v0.9.2

func (siw *ServerInterfaceWrapper) GetCreditBalance(w http.ResponseWriter, r *http.Request)

GetCreditBalance operation middleware

func (*ServerInterfaceWrapper) GetCreditGrants added in v0.9.2

func (siw *ServerInterfaceWrapper) GetCreditGrants(w http.ResponseWriter, r *http.Request)

GetCreditGrants operation middleware

func (*ServerInterfaceWrapper) GetCreditNote

func (siw *ServerInterfaceWrapper) GetCreditNote(w http.ResponseWriter, r *http.Request)

GetCreditNote operation middleware

func (*ServerInterfaceWrapper) GetCreditNotePdf

func (siw *ServerInterfaceWrapper) GetCreditNotePdf(w http.ResponseWriter, r *http.Request)

GetCreditNotePdf operation middleware

func (*ServerInterfaceWrapper) GetCreditNoteStats

func (siw *ServerInterfaceWrapper) GetCreditNoteStats(w http.ResponseWriter, r *http.Request)

GetCreditNoteStats operation middleware

func (*ServerInterfaceWrapper) GetCustomer

func (siw *ServerInterfaceWrapper) GetCustomer(w http.ResponseWriter, r *http.Request)

GetCustomer operation middleware

func (*ServerInterfaceWrapper) GetCustomerBillingProfile

func (siw *ServerInterfaceWrapper) GetCustomerBillingProfile(w http.ResponseWriter, r *http.Request)

GetCustomerBillingProfile operation middleware

func (*ServerInterfaceWrapper) GetCustomerMargin added in v0.9.2

func (siw *ServerInterfaceWrapper) GetCustomerMargin(w http.ResponseWriter, r *http.Request)

GetCustomerMargin operation middleware

func (*ServerInterfaceWrapper) GetCustomerOverview

func (siw *ServerInterfaceWrapper) GetCustomerOverview(w http.ResponseWriter, r *http.Request)

GetCustomerOverview operation middleware

func (*ServerInterfaceWrapper) GetCustomerUsage

func (siw *ServerInterfaceWrapper) GetCustomerUsage(w http.ResponseWriter, r *http.Request)

GetCustomerUsage operation middleware

func (*ServerInterfaceWrapper) GetDunningPolicy

func (siw *ServerInterfaceWrapper) GetDunningPolicy(w http.ResponseWriter, r *http.Request)

GetDunningPolicy operation middleware

func (*ServerInterfaceWrapper) GetDunningRun

func (siw *ServerInterfaceWrapper) GetDunningRun(w http.ResponseWriter, r *http.Request)

GetDunningRun operation middleware

func (*ServerInterfaceWrapper) GetDunningStats

func (siw *ServerInterfaceWrapper) GetDunningStats(w http.ResponseWriter, r *http.Request)

GetDunningStats operation middleware

func (*ServerInterfaceWrapper) GetEmailSettings

func (siw *ServerInterfaceWrapper) GetEmailSettings(w http.ResponseWriter, r *http.Request)

GetEmailSettings operation middleware

func (*ServerInterfaceWrapper) GetHealth

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetHealthReady

func (siw *ServerInterfaceWrapper) GetHealthReady(w http.ResponseWriter, r *http.Request)

GetHealthReady operation middleware

func (*ServerInterfaceWrapper) GetHostedInvoice

func (siw *ServerInterfaceWrapper) GetHostedInvoice(w http.ResponseWriter, r *http.Request)

GetHostedInvoice operation middleware

func (*ServerInterfaceWrapper) GetHostedInvoicePdf

func (siw *ServerInterfaceWrapper) GetHostedInvoicePdf(w http.ResponseWriter, r *http.Request)

GetHostedInvoicePdf operation middleware

func (*ServerInterfaceWrapper) GetInvitation added in v0.9.2

func (siw *ServerInterfaceWrapper) GetInvitation(w http.ResponseWriter, r *http.Request)

GetInvitation operation middleware

func (*ServerInterfaceWrapper) GetInvoice

func (siw *ServerInterfaceWrapper) GetInvoice(w http.ResponseWriter, r *http.Request)

GetInvoice operation middleware

func (*ServerInterfaceWrapper) GetInvoicePaymentTimeline

func (siw *ServerInterfaceWrapper) GetInvoicePaymentTimeline(w http.ResponseWriter, r *http.Request)

GetInvoicePaymentTimeline operation middleware

func (*ServerInterfaceWrapper) GetInvoicePdf added in v0.9.2

func (siw *ServerInterfaceWrapper) GetInvoicePdf(w http.ResponseWriter, r *http.Request)

GetInvoicePdf operation middleware

func (*ServerInterfaceWrapper) GetLiveCreditBalance added in v0.9.2

func (siw *ServerInterfaceWrapper) GetLiveCreditBalance(w http.ResponseWriter, r *http.Request)

GetLiveCreditBalance operation middleware

func (*ServerInterfaceWrapper) GetMeter

func (siw *ServerInterfaceWrapper) GetMeter(w http.ResponseWriter, r *http.Request)

GetMeter operation middleware

func (*ServerInterfaceWrapper) GetMetrics

func (siw *ServerInterfaceWrapper) GetMetrics(w http.ResponseWriter, r *http.Request)

GetMetrics operation middleware

func (*ServerInterfaceWrapper) GetPlan

GetPlan operation middleware

func (*ServerInterfaceWrapper) GetPublicCostDashboard added in v0.9.2

func (siw *ServerInterfaceWrapper) GetPublicCostDashboard(w http.ResponseWriter, r *http.Request)

GetPublicCostDashboard operation middleware

func (*ServerInterfaceWrapper) GetPublicPaymentUpdate

func (siw *ServerInterfaceWrapper) GetPublicPaymentUpdate(w http.ResponseWriter, r *http.Request)

GetPublicPaymentUpdate operation middleware

func (*ServerInterfaceWrapper) GetRecipe

func (siw *ServerInterfaceWrapper) GetRecipe(w http.ResponseWriter, r *http.Request)

GetRecipe operation middleware

func (*ServerInterfaceWrapper) GetSubscription

func (siw *ServerInterfaceWrapper) GetSubscription(w http.ResponseWriter, r *http.Request)

GetSubscription operation middleware

func (*ServerInterfaceWrapper) GetSubscriptionTimeline

func (siw *ServerInterfaceWrapper) GetSubscriptionTimeline(w http.ResponseWriter, r *http.Request)

GetSubscriptionTimeline operation middleware

func (*ServerInterfaceWrapper) GetTenantSettings

func (siw *ServerInterfaceWrapper) GetTenantSettings(w http.ResponseWriter, r *http.Request)

GetTenantSettings operation middleware

func (*ServerInterfaceWrapper) GetTestClock added in v0.9.2

func (siw *ServerInterfaceWrapper) GetTestClock(w http.ResponseWriter, r *http.Request)

GetTestClock operation middleware

func (*ServerInterfaceWrapper) GetWebhookEndpoint

func (siw *ServerInterfaceWrapper) GetWebhookEndpoint(w http.ResponseWriter, r *http.Request)

GetWebhookEndpoint operation middleware

func (*ServerInterfaceWrapper) GetWebhookEndpointStats

func (siw *ServerInterfaceWrapper) GetWebhookEndpointStats(w http.ResponseWriter, r *http.Request)

GetWebhookEndpointStats operation middleware

func (*ServerInterfaceWrapper) GetWhoami added in v0.9.2

func (siw *ServerInterfaceWrapper) GetWhoami(w http.ResponseWriter, r *http.Request)

GetWhoami operation middleware

func (*ServerInterfaceWrapper) GrantCredits added in v0.9.2

func (siw *ServerInterfaceWrapper) GrantCredits(w http.ResponseWriter, r *http.Request)

GrantCredits operation middleware

func (*ServerInterfaceWrapper) IngestLitellmSpend

func (siw *ServerInterfaceWrapper) IngestLitellmSpend(w http.ResponseWriter, r *http.Request)

IngestLitellmSpend operation middleware

func (*ServerInterfaceWrapper) InstantiateRecipe

func (siw *ServerInterfaceWrapper) InstantiateRecipe(w http.ResponseWriter, r *http.Request)

InstantiateRecipe operation middleware

func (*ServerInterfaceWrapper) InviteMember

func (siw *ServerInterfaceWrapper) InviteMember(w http.ResponseWriter, r *http.Request)

InviteMember operation middleware

func (*ServerInterfaceWrapper) IssueCreditNote

func (siw *ServerInterfaceWrapper) IssueCreditNote(w http.ResponseWriter, r *http.Request)

IssueCreditNote operation middleware

func (*ServerInterfaceWrapper) ListApiKeys

func (siw *ServerInterfaceWrapper) ListApiKeys(w http.ResponseWriter, r *http.Request)

ListApiKeys operation middleware

func (*ServerInterfaceWrapper) ListAuditLog

func (siw *ServerInterfaceWrapper) ListAuditLog(w http.ResponseWriter, r *http.Request)

ListAuditLog operation middleware

func (*ServerInterfaceWrapper) ListCreditBalances

func (siw *ServerInterfaceWrapper) ListCreditBalances(w http.ResponseWriter, r *http.Request)

ListCreditBalances operation middleware

func (*ServerInterfaceWrapper) ListCreditLedgerEntries

func (siw *ServerInterfaceWrapper) ListCreditLedgerEntries(w http.ResponseWriter, r *http.Request)

ListCreditLedgerEntries operation middleware

func (*ServerInterfaceWrapper) ListCreditNotes

func (siw *ServerInterfaceWrapper) ListCreditNotes(w http.ResponseWriter, r *http.Request)

ListCreditNotes operation middleware

func (*ServerInterfaceWrapper) ListCustomerPaymentMethods

func (siw *ServerInterfaceWrapper) ListCustomerPaymentMethods(w http.ResponseWriter, r *http.Request)

ListCustomerPaymentMethods operation middleware

func (*ServerInterfaceWrapper) ListCustomerSentEmails

func (siw *ServerInterfaceWrapper) ListCustomerSentEmails(w http.ResponseWriter, r *http.Request)

ListCustomerSentEmails operation middleware

func (*ServerInterfaceWrapper) ListCustomers added in v0.9.2

func (siw *ServerInterfaceWrapper) ListCustomers(w http.ResponseWriter, r *http.Request)

ListCustomers operation middleware

func (*ServerInterfaceWrapper) ListDunningPolicies

func (siw *ServerInterfaceWrapper) ListDunningPolicies(w http.ResponseWriter, r *http.Request)

ListDunningPolicies operation middleware

func (*ServerInterfaceWrapper) ListDunningRuns

func (siw *ServerInterfaceWrapper) ListDunningRuns(w http.ResponseWriter, r *http.Request)

ListDunningRuns operation middleware

func (*ServerInterfaceWrapper) ListHeldUsage

func (siw *ServerInterfaceWrapper) ListHeldUsage(w http.ResponseWriter, r *http.Request)

ListHeldUsage operation middleware

func (*ServerInterfaceWrapper) ListInvoiceDisputes

func (siw *ServerInterfaceWrapper) ListInvoiceDisputes(w http.ResponseWriter, r *http.Request)

ListInvoiceDisputes operation middleware

func (*ServerInterfaceWrapper) ListInvoiceStripeRefunds added in v0.9.2

func (siw *ServerInterfaceWrapper) ListInvoiceStripeRefunds(w http.ResponseWriter, r *http.Request)

ListInvoiceStripeRefunds operation middleware

func (*ServerInterfaceWrapper) ListInvoices added in v0.9.2

func (siw *ServerInterfaceWrapper) ListInvoices(w http.ResponseWriter, r *http.Request)

ListInvoices operation middleware

func (*ServerInterfaceWrapper) ListMembers

func (siw *ServerInterfaceWrapper) ListMembers(w http.ResponseWriter, r *http.Request)

ListMembers operation middleware

func (*ServerInterfaceWrapper) ListMeters added in v0.9.2

func (siw *ServerInterfaceWrapper) ListMeters(w http.ResponseWriter, r *http.Request)

ListMeters operation middleware

func (*ServerInterfaceWrapper) ListPlanPrices

func (siw *ServerInterfaceWrapper) ListPlanPrices(w http.ResponseWriter, r *http.Request)

ListPlanPrices operation middleware

func (*ServerInterfaceWrapper) ListPlans added in v0.9.2

func (siw *ServerInterfaceWrapper) ListPlans(w http.ResponseWriter, r *http.Request)

ListPlans operation middleware

func (*ServerInterfaceWrapper) ListPriceOverrides

func (siw *ServerInterfaceWrapper) ListPriceOverrides(w http.ResponseWriter, r *http.Request)

ListPriceOverrides operation middleware

func (*ServerInterfaceWrapper) ListProviderCosts added in v0.9.2

func (siw *ServerInterfaceWrapper) ListProviderCosts(w http.ResponseWriter, r *http.Request)

ListProviderCosts operation middleware

func (*ServerInterfaceWrapper) ListRecipeInstances

func (siw *ServerInterfaceWrapper) ListRecipeInstances(w http.ResponseWriter, r *http.Request)

ListRecipeInstances operation middleware

func (*ServerInterfaceWrapper) ListRecipes

func (siw *ServerInterfaceWrapper) ListRecipes(w http.ResponseWriter, r *http.Request)

ListRecipes operation middleware

func (*ServerInterfaceWrapper) ListStripeConnections

func (siw *ServerInterfaceWrapper) ListStripeConnections(w http.ResponseWriter, r *http.Request)

ListStripeConnections operation middleware

func (*ServerInterfaceWrapper) ListSubscriptions added in v0.9.2

func (siw *ServerInterfaceWrapper) ListSubscriptions(w http.ResponseWriter, r *http.Request)

ListSubscriptions operation middleware

func (*ServerInterfaceWrapper) ListTestClockCustomers

func (siw *ServerInterfaceWrapper) ListTestClockCustomers(w http.ResponseWriter, r *http.Request)

ListTestClockCustomers operation middleware

func (*ServerInterfaceWrapper) ListTestClockSubscriptions added in v0.9.2

func (siw *ServerInterfaceWrapper) ListTestClockSubscriptions(w http.ResponseWriter, r *http.Request)

ListTestClockSubscriptions operation middleware

func (*ServerInterfaceWrapper) ListTestClocks added in v0.9.2

func (siw *ServerInterfaceWrapper) ListTestClocks(w http.ResponseWriter, r *http.Request)

ListTestClocks operation middleware

func (*ServerInterfaceWrapper) ListUsageEvents added in v0.9.2

func (siw *ServerInterfaceWrapper) ListUsageEvents(w http.ResponseWriter, r *http.Request)

ListUsageEvents operation middleware

func (*ServerInterfaceWrapper) ListWebhookEndpointDeliveries

func (siw *ServerInterfaceWrapper) ListWebhookEndpointDeliveries(w http.ResponseWriter, r *http.Request)

ListWebhookEndpointDeliveries operation middleware

func (*ServerInterfaceWrapper) ListWebhookEndpoints added in v0.9.2

func (siw *ServerInterfaceWrapper) ListWebhookEndpoints(w http.ResponseWriter, r *http.Request)

ListWebhookEndpoints operation middleware

func (*ServerInterfaceWrapper) ListWebhookEventDeliveries

func (siw *ServerInterfaceWrapper) ListWebhookEventDeliveries(w http.ResponseWriter, r *http.Request)

ListWebhookEventDeliveries operation middleware

func (*ServerInterfaceWrapper) ListWebhookEvents added in v0.9.2

func (siw *ServerInterfaceWrapper) ListWebhookEvents(w http.ResponseWriter, r *http.Request)

ListWebhookEvents operation middleware

func (*ServerInterfaceWrapper) Login added in v0.9.2

Login operation middleware

func (*ServerInterfaceWrapper) Logout added in v0.9.2

Logout operation middleware

func (*ServerInterfaceWrapper) MarkInvoiceUncollectible

func (siw *ServerInterfaceWrapper) MarkInvoiceUncollectible(w http.ResponseWriter, r *http.Request)

MarkInvoiceUncollectible operation middleware

func (*ServerInterfaceWrapper) PauseSubscriptionCollection

func (siw *ServerInterfaceWrapper) PauseSubscriptionCollection(w http.ResponseWriter, r *http.Request)

PauseSubscriptionCollection operation middleware

func (*ServerInterfaceWrapper) PreviewRecipe

func (siw *ServerInterfaceWrapper) PreviewRecipe(w http.ResponseWriter, r *http.Request)

PreviewRecipe operation middleware

func (*ServerInterfaceWrapper) ReceivePostmarkWebhook

func (siw *ServerInterfaceWrapper) ReceivePostmarkWebhook(w http.ResponseWriter, r *http.Request)

ReceivePostmarkWebhook operation middleware

func (*ServerInterfaceWrapper) ReceiveStripeWebhook

func (siw *ServerInterfaceWrapper) ReceiveStripeWebhook(w http.ResponseWriter, r *http.Request)

ReceiveStripeWebhook operation middleware

func (*ServerInterfaceWrapper) RecordInvoicePayment

func (siw *ServerInterfaceWrapper) RecordInvoicePayment(w http.ResponseWriter, r *http.Request)

RecordInvoicePayment operation middleware

func (*ServerInterfaceWrapper) RefundInvoice

func (siw *ServerInterfaceWrapper) RefundInvoice(w http.ResponseWriter, r *http.Request)

RefundInvoice operation middleware

func (*ServerInterfaceWrapper) ReleaseHeldUsage

func (siw *ServerInterfaceWrapper) ReleaseHeldUsage(w http.ResponseWriter, r *http.Request)

ReleaseHeldUsage operation middleware

func (*ServerInterfaceWrapper) RemoveMember

func (siw *ServerInterfaceWrapper) RemoveMember(w http.ResponseWriter, r *http.Request)

RemoveMember operation middleware

func (*ServerInterfaceWrapper) RemovePlanPrice

func (siw *ServerInterfaceWrapper) RemovePlanPrice(w http.ResponseWriter, r *http.Request)

RemovePlanPrice operation middleware

func (*ServerInterfaceWrapper) RemoveSubscriptionItem

func (siw *ServerInterfaceWrapper) RemoveSubscriptionItem(w http.ResponseWriter, r *http.Request)

RemoveSubscriptionItem operation middleware

func (*ServerInterfaceWrapper) ReplayWebhookDelivery

func (siw *ServerInterfaceWrapper) ReplayWebhookDelivery(w http.ResponseWriter, r *http.Request)

ReplayWebhookDelivery operation middleware

func (*ServerInterfaceWrapper) ReplayWebhookEvent

func (siw *ServerInterfaceWrapper) ReplayWebhookEvent(w http.ResponseWriter, r *http.Request)

ReplayWebhookEvent operation middleware

func (*ServerInterfaceWrapper) RequestPasswordReset added in v0.9.2

func (siw *ServerInterfaceWrapper) RequestPasswordReset(w http.ResponseWriter, r *http.Request)

RequestPasswordReset operation middleware

func (siw *ServerInterfaceWrapper) ResendInvoiceSetupLink(w http.ResponseWriter, r *http.Request)

ResendInvoiceSetupLink operation middleware

func (*ServerInterfaceWrapper) ResolveDunningRun

func (siw *ServerInterfaceWrapper) ResolveDunningRun(w http.ResponseWriter, r *http.Request)

ResolveDunningRun operation middleware

func (*ServerInterfaceWrapper) ResumeSubscriptionCollection

func (siw *ServerInterfaceWrapper) ResumeSubscriptionCollection(w http.ResponseWriter, r *http.Request)

ResumeSubscriptionCollection operation middleware

func (*ServerInterfaceWrapper) RetryCreditNoteRefund

func (siw *ServerInterfaceWrapper) RetryCreditNoteRefund(w http.ResponseWriter, r *http.Request)

RetryCreditNoteRefund operation middleware

func (*ServerInterfaceWrapper) RetryInvoiceTax added in v0.9.2

func (siw *ServerInterfaceWrapper) RetryInvoiceTax(w http.ResponseWriter, r *http.Request)

RetryInvoiceTax operation middleware

func (*ServerInterfaceWrapper) RetrySubscriptionBilling added in v0.9.2

func (siw *ServerInterfaceWrapper) RetrySubscriptionBilling(w http.ResponseWriter, r *http.Request)

RetrySubscriptionBilling operation middleware

func (*ServerInterfaceWrapper) RetryTestClockAdvance added in v0.9.2

func (siw *ServerInterfaceWrapper) RetryTestClockAdvance(w http.ResponseWriter, r *http.Request)

RetryTestClockAdvance operation middleware

func (*ServerInterfaceWrapper) RevokeApiKey

func (siw *ServerInterfaceWrapper) RevokeApiKey(w http.ResponseWriter, r *http.Request)

RevokeApiKey operation middleware

func (*ServerInterfaceWrapper) RevokeMemberInvitation

func (siw *ServerInterfaceWrapper) RevokeMemberInvitation(w http.ResponseWriter, r *http.Request)

RevokeMemberInvitation operation middleware

func (*ServerInterfaceWrapper) RotateApiKey

func (siw *ServerInterfaceWrapper) RotateApiKey(w http.ResponseWriter, r *http.Request)

RotateApiKey operation middleware

func (*ServerInterfaceWrapper) RotateCustomerCostDashboardToken added in v0.9.2

func (siw *ServerInterfaceWrapper) RotateCustomerCostDashboardToken(w http.ResponseWriter, r *http.Request)

RotateCustomerCostDashboardToken operation middleware

func (*ServerInterfaceWrapper) RotateInvoicePublicToken

func (siw *ServerInterfaceWrapper) RotateInvoicePublicToken(w http.ResponseWriter, r *http.Request)

RotateInvoicePublicToken operation middleware

func (*ServerInterfaceWrapper) RotateWebhookEndpointSecret added in v0.9.2

func (siw *ServerInterfaceWrapper) RotateWebhookEndpointSecret(w http.ResponseWriter, r *http.Request)

RotateWebhookEndpointSecret operation middleware

func (*ServerInterfaceWrapper) RunBilling added in v0.9.2

func (siw *ServerInterfaceWrapper) RunBilling(w http.ResponseWriter, r *http.Request)

RunBilling operation middleware

func (*ServerInterfaceWrapper) ScheduleSubscriptionCancel

func (siw *ServerInterfaceWrapper) ScheduleSubscriptionCancel(w http.ResponseWriter, r *http.Request)

ScheduleSubscriptionCancel operation middleware

func (*ServerInterfaceWrapper) SendCreditNote added in v0.9.2

func (siw *ServerInterfaceWrapper) SendCreditNote(w http.ResponseWriter, r *http.Request)

SendCreditNote operation middleware

func (*ServerInterfaceWrapper) SendCustomerPaymentSetupEmail

func (siw *ServerInterfaceWrapper) SendCustomerPaymentSetupEmail(w http.ResponseWriter, r *http.Request)

SendCustomerPaymentSetupEmail operation middleware

func (*ServerInterfaceWrapper) SendInvoice added in v0.9.2

func (siw *ServerInterfaceWrapper) SendInvoice(w http.ResponseWriter, r *http.Request)

SendInvoice operation middleware

func (*ServerInterfaceWrapper) SendTestEmail

func (siw *ServerInterfaceWrapper) SendTestEmail(w http.ResponseWriter, r *http.Request)

SendTestEmail operation middleware

func (*ServerInterfaceWrapper) SetCustomerDefaultPaymentMethod

func (siw *ServerInterfaceWrapper) SetCustomerDefaultPaymentMethod(w http.ResponseWriter, r *http.Request)

SetCustomerDefaultPaymentMethod operation middleware

func (*ServerInterfaceWrapper) SetDefaultDunningPolicy

func (siw *ServerInterfaceWrapper) SetDefaultDunningPolicy(w http.ResponseWriter, r *http.Request)

SetDefaultDunningPolicy operation middleware

func (*ServerInterfaceWrapper) SetStripeWebhookSecret

func (siw *ServerInterfaceWrapper) SetStripeWebhookSecret(w http.ResponseWriter, r *http.Request)

SetStripeWebhookSecret operation middleware

func (*ServerInterfaceWrapper) SetSubscriptionBillingThresholds

func (siw *ServerInterfaceWrapper) SetSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request)

SetSubscriptionBillingThresholds operation middleware

func (*ServerInterfaceWrapper) StreamWebhookEvents

func (siw *ServerInterfaceWrapper) StreamWebhookEvents(w http.ResponseWriter, r *http.Request)

StreamWebhookEvents operation middleware

func (*ServerInterfaceWrapper) SwitchSessionMode added in v0.9.2

func (siw *ServerInterfaceWrapper) SwitchSessionMode(w http.ResponseWriter, r *http.Request)

SwitchSessionMode operation middleware

func (*ServerInterfaceWrapper) UpdateCustomer

func (siw *ServerInterfaceWrapper) UpdateCustomer(w http.ResponseWriter, r *http.Request)

UpdateCustomer operation middleware

func (*ServerInterfaceWrapper) UpdateDunningPolicy

func (siw *ServerInterfaceWrapper) UpdateDunningPolicy(w http.ResponseWriter, r *http.Request)

UpdateDunningPolicy operation middleware

func (*ServerInterfaceWrapper) UpdateMeter added in v0.9.2

func (siw *ServerInterfaceWrapper) UpdateMeter(w http.ResponseWriter, r *http.Request)

UpdateMeter operation middleware

func (*ServerInterfaceWrapper) UpdatePlan

func (siw *ServerInterfaceWrapper) UpdatePlan(w http.ResponseWriter, r *http.Request)

UpdatePlan operation middleware

func (*ServerInterfaceWrapper) UpdatePlanPrice

func (siw *ServerInterfaceWrapper) UpdatePlanPrice(w http.ResponseWriter, r *http.Request)

UpdatePlanPrice operation middleware

func (*ServerInterfaceWrapper) UpdateSubscriptionItem

func (siw *ServerInterfaceWrapper) UpdateSubscriptionItem(w http.ResponseWriter, r *http.Request)

UpdateSubscriptionItem operation middleware

func (*ServerInterfaceWrapper) UpdateTenantSettings

func (siw *ServerInterfaceWrapper) UpdateTenantSettings(w http.ResponseWriter, r *http.Request)

UpdateTenantSettings operation middleware

func (*ServerInterfaceWrapper) UpdateWebhookEndpoint added in v0.9.2

func (siw *ServerInterfaceWrapper) UpdateWebhookEndpoint(w http.ResponseWriter, r *http.Request)

UpdateWebhookEndpoint operation middleware

func (*ServerInterfaceWrapper) UpsertCustomerBillingProfile

func (siw *ServerInterfaceWrapper) UpsertCustomerBillingProfile(w http.ResponseWriter, r *http.Request)

UpsertCustomerBillingProfile operation middleware

func (*ServerInterfaceWrapper) UpsertProviderCost added in v0.9.2

func (siw *ServerInterfaceWrapper) UpsertProviderCost(w http.ResponseWriter, r *http.Request)

UpsertProviderCost operation middleware

func (*ServerInterfaceWrapper) VoidCreditNote

func (siw *ServerInterfaceWrapper) VoidCreditNote(w http.ResponseWriter, r *http.Request)

VoidCreditNote operation middleware

func (*ServerInterfaceWrapper) VoidInvoice

func (siw *ServerInterfaceWrapper) VoidInvoice(w http.ResponseWriter, r *http.Request)

VoidInvoice operation middleware

type SetCustomerDefaultPaymentMethodParams

type SetCustomerDefaultPaymentMethodParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SetCustomerDefaultPaymentMethodParams defines parameters for SetCustomerDefaultPaymentMethod.

type SetDefaultDunningPolicy200JSONResponseBodyStatus

type SetDefaultDunningPolicy200JSONResponseBodyStatus string

SetDefaultDunningPolicy200JSONResponseBodyStatus defines parameters for SetDefaultDunningPolicy.

const (
	DefaultUpdated SetDefaultDunningPolicy200JSONResponseBodyStatus = "default_updated"
)

Defines values for SetDefaultDunningPolicy200JSONResponseBodyStatus.

func (SetDefaultDunningPolicy200JSONResponseBodyStatus) Valid

Valid indicates whether the value is a known member of the SetDefaultDunningPolicy200JSONResponseBodyStatus enum.

type SetDefaultDunningPolicyParams

type SetDefaultDunningPolicyParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SetDefaultDunningPolicyParams defines parameters for SetDefaultDunningPolicy.

type SetStripeWebhookSecretJSONBody

type SetStripeWebhookSecretJSONBody struct {
	// WebhookSecret Must start with `whsec_`.
	WebhookSecret string `json:"webhook_secret"`
}

SetStripeWebhookSecretJSONBody defines parameters for SetStripeWebhookSecret.

type SetStripeWebhookSecretJSONRequestBody

type SetStripeWebhookSecretJSONRequestBody SetStripeWebhookSecretJSONBody

SetStripeWebhookSecretJSONRequestBody defines body for SetStripeWebhookSecret for application/json ContentType.

type SetStripeWebhookSecretParams

type SetStripeWebhookSecretParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SetStripeWebhookSecretParams defines parameters for SetStripeWebhookSecret.

type SetStripeWebhookSecretParamsMode

type SetStripeWebhookSecretParamsMode string

SetStripeWebhookSecretParamsMode defines parameters for SetStripeWebhookSecret.

const (
	SetStripeWebhookSecretParamsModeLive SetStripeWebhookSecretParamsMode = "live"
	SetStripeWebhookSecretParamsModeTest SetStripeWebhookSecretParamsMode = "test"
)

Defines values for SetStripeWebhookSecretParamsMode.

func (SetStripeWebhookSecretParamsMode) Valid

Valid indicates whether the value is a known member of the SetStripeWebhookSecretParamsMode enum.

type SetSubscriptionBillingThresholdsJSONBody

type SetSubscriptionBillingThresholdsJSONBody struct {
	// AmountGte Invoice early when the period's usage so far reaches
	// this amount, in the subscription currency's minor unit
	// (cents for USD). The base fee is not counted. 0 or
	// absent sets no amount threshold.
	AmountGte int64 `json:"amount_gte,omitempty"`

	// ItemThresholds Per-item usage thresholds. Each item of this
	// subscription can appear once. Absent or empty sets none.
	ItemThresholds []struct {
		// SubscriptionItemId An item of this subscription. Each item can appear once.
		SubscriptionItemId string `json:"subscription_item_id"`

		// UsageGte Invoice early when the item's usage in the period reaches this quantity. A decimal string (e.g. "1000" or "3.14"): more than 0, under 10^26, at most 12 decimal places (trailing zeros do not count), and at most 100 characters.
		UsageGte string `json:"usage_gte"`
	} `json:"item_thresholds,omitempty"`
}

SetSubscriptionBillingThresholdsJSONBody defines parameters for SetSubscriptionBillingThresholds.

type SetSubscriptionBillingThresholdsJSONRequestBody

type SetSubscriptionBillingThresholdsJSONRequestBody SetSubscriptionBillingThresholdsJSONBody

SetSubscriptionBillingThresholdsJSONRequestBody defines body for SetSubscriptionBillingThresholds for application/json ContentType.

type SetSubscriptionBillingThresholdsParams

type SetSubscriptionBillingThresholdsParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

SetSubscriptionBillingThresholdsParams defines parameters for SetSubscriptionBillingThresholds.

type StripeConnection

type StripeConnection struct {
	// CreatedAt When keys were first saved for this mode.
	CreatedAt time.Time `json:"created_at"`

	// HasWebhookSecret Whether a webhook signing secret is saved. Until one is, Stripe
	// webhooks sent to this connection are refused with 404.
	HasWebhookSecret bool `json:"has_webhook_secret"`

	// Id The connection's id (`hc_spc_…`). It is also the
	// `{endpoint_id}` in the Stripe webhook URL
	// `/v1/webhooks/stripe/{endpoint_id}`.
	Id string `json:"id"`

	// LastVerifiedError Why the last Stripe check failed, in Stripe's own words (or the
	// network error when Stripe was not reached). Also set when Stripe
	// refuses the key on a charge (401, or 403 for a restricted key);
	// the next charge that goes through clears that. Absent when the
	// check passed.
	LastVerifiedError string `json:"last_verified_error,omitempty"`

	// LastVerifiedErrorKind What kind of failure `last_verified_error` is. `rejected`: Stripe
	// answered and refused the key (invalid, revoked, or without access).
	// `unavailable`: Stripe was not reached, or answered 429/5xx, so the
	// key was not checked; connecting again may work. Absent when the
	// check passed, and on keys that failed before this field existed.
	LastVerifiedErrorKind StripeConnectionLastVerifiedErrorKind `json:"last_verified_error_kind,omitempty"`

	// Livemode True for live-mode keys (`sk_live_…`), false for test-mode keys.
	Livemode bool `json:"livemode"`

	// PublishableKey The publishable key, in full. It is not a secret.
	PublishableKey string `json:"publishable_key"`

	// RetriesQueued Only in the answer to `POST /v1/settings/stripe`, and only when
	// above 0: how many invoices that were stuck waiting for Stripe
	// keys are now being retried in the background.
	RetriesQueued int `json:"retries_queued,omitempty"`

	// SecretKeyLast4 Last 4 characters of the secret key.
	SecretKeyLast4 string `json:"secret_key_last4"`

	// SecretKeyPrefix First 12 characters of the secret key.
	SecretKeyPrefix string `json:"secret_key_prefix,omitempty"`

	// StripeAccountId The Stripe account the key belongs to (`acct_…`). Absent until Stripe first accepts a key for this mode.
	StripeAccountId string `json:"stripe_account_id,omitempty"`

	// StripeAccountName The Stripe account's business name, or its dashboard name or
	// email when it has none. Absent until Stripe accepts a key.
	StripeAccountName string `json:"stripe_account_name,omitempty"`

	// TenantId The account the keys belong to.
	TenantId string `json:"tenant_id"`

	// UpdatedAt When the connection last changed.
	UpdatedAt time.Time `json:"updated_at"`

	// VerifiedAt When Stripe last accepted the key. Absent until it does. Saving
	// new keys clears it until the next check passes.
	VerifiedAt time.Time `json:"verified_at,omitempty"`

	// WebhookSecretLast4 Last 4 characters of the webhook signing secret. Absent until one is saved.
	WebhookSecretLast4 string `json:"webhook_secret_last4,omitempty"`
}

StripeConnection The account's own Stripe keys for one mode, without the secrets. Hardcount uses them to charge customers and to read Stripe's answers. `GET /v1/settings/stripe` lists one per connected mode.

type StripeConnectionLastVerifiedErrorKind

type StripeConnectionLastVerifiedErrorKind string

StripeConnectionLastVerifiedErrorKind What kind of failure `last_verified_error` is. `rejected`: Stripe answered and refused the key (invalid, revoked, or without access). `unavailable`: Stripe was not reached, or answered 429/5xx, so the key was not checked; connecting again may work. Absent when the check passed, and on keys that failed before this field existed.

const (
	Rejected    StripeConnectionLastVerifiedErrorKind = "rejected"
	Unavailable StripeConnectionLastVerifiedErrorKind = "unavailable"
)

Defines values for StripeConnectionLastVerifiedErrorKind.

func (StripeConnectionLastVerifiedErrorKind) Valid

Valid indicates whether the value is a known member of the StripeConnectionLastVerifiedErrorKind enum.

type StripeRefundWebhookEventData added in v0.9.2

type StripeRefundWebhookEventData struct {
	// Invoice A bill for one customer, in one currency. The billing engine creates
	// one at the end of each subscription period (and for a subscription's
	// start when a fee is billed in advance, a change, a cancel or a spend
	// threshold); you can also create one-off invoices with
	// `POST /v1/invoices`. The engine creates its invoices already
	// `finalized`, or as a `draft` while their tax is pending or collection
	// is paused on the subscription. An invoice you create starts as a
	// `draft` until you finalize it. A finalized invoice ends `paid`,
	// `voided` or `uncollectible`. Every amount is a whole number in the
	// currency's minor unit (cents for USD). The invoice routes and the
	// `invoice.*` and `payment.*` webhook events return it.
	Invoice Invoice `json:"invoice"`

	// Refund A refund made in Stripe outside Hardcount (the Stripe dashboard, or
	// Stripe's API called directly) on one of the invoice's payments,
	// recorded from Stripe's `refund.created`, `refund.updated`,
	// `refund.failed` and `charge.refund.updated` webhook events. It holds
	// the refund as the newest of those events showed it. Hardcount's own
	// refunds are never listed here. `outcome` is what Hardcount did with
	// the refund: decided when Hardcount first sees it, or, for a refund
	// first seen in flight (`awaiting`), when a later event shows how it
	// ended. After that only you change it, by recording a flagged refund
	// with a credit note or dismissing it.
	Refund InvoiceStripeRefund `json:"refund"`
}

StripeRefundWebhookEventData The `data` of the outbound webhook event `payment.refunded_in_stripe` ([Webhook events](https://gethardcount.com/docs/api/webhook-events/)): the invoice the refunded payment belongs to, as it stood (a refund never changes it), and the refund as the API returns it. The invoice leaves out `attention`, `recovery_warning`, `billing_period_display` and `test_clock_id`, which are worked out per read. Sent once per refund, when its outcome is decided: when Hardcount first sees it, or, for a refund first seen in flight, when it succeeds, fails or is canceled. Saved in the same transaction that records it. A later change to the refund sends nothing more.

type Subscription

type Subscription struct {
	// ActivatedAt When the subscription became `active`: at creation without a
	// trial, at activation of a draft, or when its trial ended.
	// Absent on a draft and while it trials.
	ActivatedAt time.Time `json:"activated_at,omitempty"`

	// BillingAnchorDay Day of the month the subscription bills on (1-31): the day its
	// first period started, or the day of its last immediate change to
	// a plan with another billing interval. Absent on a draft and for
	// calendar-monthly subscriptions.
	BillingAnchorDay int `json:"billing_anchor_day,omitempty"`

	// BillingFailure Present on a subscription while the billing run is failing on the
	// work that subscription has due now (a period close, or a scheduled
	// mid-period cancel). Absent otherwise: a subscription that bills
	// cleanly, or whose due work changed, carries no `billing_failure`.
	//
	// After each failed attempt the billing run waits before the next one:
	// 15 minutes, 1 hour, 4 hours, 12 hours, then 24 hours three times.
	// The eighth failure parks the subscription (`parked: true`, no
	// `next_attempt_at`). A parked subscription is not attempted again
	// until `POST /v1/subscriptions/{id}/retry-billing` is called.
	//
	// Never set on a subscription attached to a test clock.
	BillingFailure BillingFailure `json:"billing_failure,omitempty"`

	// BillingThresholds Limits that make Hardcount invoice before the period ends. A threshold
	// invoice bills the period's usage so far, and no base fee. The period
	// keeps its dates, the base fee is billed as it would be with no
	// threshold, and the period's next invoice bills the rest of the usage.
	// Absent on a subscription with no thresholds. Set them with
	// `PUT /v1/subscriptions/{id}/billing-thresholds`.
	BillingThresholds SubscriptionBillingThresholds `json:"billing_thresholds,omitempty"`

	// BillingTime How monthly periods line up. The first period starts on the day
	// the subscription starts to bill: the day it is created or
	// activated, or, with a trial, the day the trial ends.
	// `calendar`: every period ends on the 1st of a month, in your
	// account's billing time zone, so the first period runs from that
	// day to the next 1st. `anniversary`: each period starts on the
	// same day of the month as the first one (the last day of a
	// shorter month). A plan billed yearly always bills a year from
	// that first day, whatever this says. An immediate change to a
	// plan with another billing interval starts a new first period at
	// the change.
	BillingTime SubscriptionBillingTime `json:"billing_time"`

	// CancelAt The instant a cancel is scheduled for, when it was scheduled
	// with `cancel_at`. Absent when none is set, and after the
	// subscription is canceled.
	CancelAt time.Time `json:"cancel_at,omitempty"`

	// CancelAtPeriodEnd True when the subscription cancels at the end of the current
	// period, or, while it trials, at the end of the trial. False
	// after the subscription is canceled.
	CancelAtPeriodEnd bool `json:"cancel_at_period_end"`

	// CancelEffectiveAt When a scheduled cancel takes effect: `cancel_at` when set;
	// otherwise, with `cancel_at_period_end`, `trial_end_at` while
	// the subscription trials and `current_billing_period_end`
	// after. Absent when no cancel is scheduled.
	CancelEffectiveAt time.Time `json:"cancel_effective_at,omitempty"`

	// CanceledAt When the subscription was canceled. Absent until then.
	CanceledAt time.Time `json:"canceled_at,omitempty"`

	// Code Your code for the subscription: letters, digits, hyphens and
	// underscores. Unique in your account and mode (live or test).
	Code string `json:"code"`

	// CreatedAt When the subscription was created. For a customer on a test clock, the clock's time.
	CreatedAt time.Time `json:"created_at"`

	// CurrentBillingPeriodDisplay The current period as text, with the last day included, in your
	// account's billing time zone, for example "Oct 1, 2026 – Oct 31,
	// 2026". Absent when the subscription has no current period, when
	// the time zone could not be read, and on the rows of
	// `GET /v1/test-clocks/{id}/subscriptions`.
	CurrentBillingPeriodDisplay string `json:"current_billing_period_display,omitempty"`

	// CurrentBillingPeriodEnd End of the current period (exclusive): the start of the next
	// one. While the subscription trials, the end of the first paid
	// period. Absent on a draft. On a canceled subscription it keeps
	// its last value.
	CurrentBillingPeriodEnd time.Time `json:"current_billing_period_end,omitempty"`

	// CurrentBillingPeriodStart Start of the current billing period, normally the beginning of
	// a day in your account's billing time zone. While the
	// subscription trials, it is the start of the first paid period:
	// the beginning of the day the trial ends, not `trial_end_at`
	// itself. After an immediate change to a plan with another billing
	// interval, a period can start or end at the instant of the
	// change. Absent on a draft. On a canceled subscription it keeps
	// its last value.
	CurrentBillingPeriodStart time.Time `json:"current_billing_period_start,omitempty"`

	// CustomerId The customer the subscription bills (`hc_cus_…`).
	CustomerId string `json:"customer_id"`

	// DisplayName The subscription's name, as shown in the dashboard.
	DisplayName string `json:"display_name"`

	// Id The subscription's ID (`hc_sub_…`).
	Id string `json:"id"`

	// Items The subscription's priced lines. Each item names its plan.
	Items []SubscriptionItem `json:"items,omitempty"`

	// NextBillingAt When the current period's invoice is due to be built: the end
	// of the current period. The billing run builds it once the
	// invoice grace after that time has passed. Absent on a draft. A
	// canceled subscription keeps its last value, and nothing is
	// billed at that time.
	NextBillingAt time.Time `json:"next_billing_at,omitempty"`

	// PauseCollection Present on a subscription while collection is paused. New invoices
	// are still created, but stay drafts and are not charged. Absent when
	// collection runs normally. A cancel leaves it in place: it still
	// holds the subscription's unpaid invoices, and
	// `DELETE /v1/subscriptions/{id}/pause-collection` releases them.
	PauseCollection SubscriptionPauseCollection `json:"pause_collection,omitempty"`

	// StartedAt When the subscription started: when it was created, or, for a
	// draft, when it was activated. Absent on a draft.
	StartedAt time.Time `json:"started_at,omitempty"`

	// Status Where the subscription is in its life.
	//
	// - `draft`: created with `status: draft`. It has no billing
	//   period and bills nothing until you activate it with
	//   `POST /v1/subscriptions/{id}/activate`.
	// - `trialing`: in a free trial until `trial_end_at`. Usage in
	//   the trial is not billed. When the trial ends, Hardcount makes
	//   the subscription `active` and its first paid period starts.
	//   If a cancel is scheduled for the trial end, it becomes
	//   `canceled` instead, with no charge.
	// - `active`: billing. Usage and base fees billed in arrears are
	//   invoiced when each period ends; a base fee billed in advance
	//   when its period starts.
	// - `canceled`: ended at `canceled_at`. It bills nothing more,
	//   and no route makes it `active` again.
	//
	// A paused collection is not a status: see `pause_collection`.
	Status SubscriptionStatus `json:"status"`

	// TenantId The account the subscription belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// TestClockId The test clock the subscription runs on (test mode only),
	// taken from its customer when it was created. Absent when the
	// customer is not on a test clock.
	TestClockId string `json:"test_clock_id,omitempty"`

	// TrialEndAt When the trial ends, or ended. The first paid period starts at
	// the beginning of that day in your account's billing time zone.
	// Ending the trial early (`POST /v1/subscriptions/{id}/end-trial`)
	// sets it to that moment. Absent when the subscription had no
	// trial.
	TrialEndAt time.Time `json:"trial_end_at,omitempty"`

	// TrialStartAt When the trial started. Absent when the subscription had no trial.
	TrialStartAt time.Time `json:"trial_start_at,omitempty"`

	// UpdatedAt When the subscription last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

Subscription A customer's subscription: the plans it bills (its `items`), its status and its current billing period. Every route under `/v1/subscriptions` that returns a subscription returns this object, with its items.

A subscription bills in one currency, the currency of its plans. All its items share one billing interval and one base-fee timing. Usage, and a base fee billed in arrears, are invoiced when a period ends. A base fee billed in advance is invoiced when its period starts: the first one in the same transaction that creates or activates the subscription or ends its trial, each later one on the invoice that closes the period before.

type SubscriptionBillingThresholds

type SubscriptionBillingThresholds struct {
	// AmountGte Usage threshold in the subscription currency's minor unit
	// (cents for USD), compared with the period's usage so far (the
	// base fee is not counted). Absent when not set.
	AmountGte int64 `json:"amount_gte,omitempty"`

	// ItemThresholds Per-item usage quantity thresholds. Empty when only `amount_gte` is set.
	ItemThresholds []SubscriptionItemThreshold `json:"item_thresholds"`
}

SubscriptionBillingThresholds Limits that make Hardcount invoice before the period ends. A threshold invoice bills the period's usage so far, and no base fee. The period keeps its dates, the base fee is billed as it would be with no threshold, and the period's next invoice bills the rest of the usage. Absent on a subscription with no thresholds. Set them with `PUT /v1/subscriptions/{id}/billing-thresholds`.

type SubscriptionBillingTime

type SubscriptionBillingTime string

SubscriptionBillingTime How monthly periods line up. The first period starts on the day the subscription starts to bill: the day it is created or activated, or, with a trial, the day the trial ends. `calendar`: every period ends on the 1st of a month, in your account's billing time zone, so the first period runs from that day to the next 1st. `anniversary`: each period starts on the same day of the month as the first one (the last day of a shorter month). A plan billed yearly always bills a year from that first day, whatever this says. An immediate change to a plan with another billing interval starts a new first period at the change.

const (
	SubscriptionBillingTimeAnniversary SubscriptionBillingTime = "anniversary"
	SubscriptionBillingTimeCalendar    SubscriptionBillingTime = "calendar"
)

Defines values for SubscriptionBillingTime.

func (SubscriptionBillingTime) Valid

func (e SubscriptionBillingTime) Valid() bool

Valid indicates whether the value is a known member of the SubscriptionBillingTime enum.

type SubscriptionItem

type SubscriptionItem struct {
	// CreatedAt When the item was added.
	CreatedAt time.Time `json:"created_at"`

	// Id The item's ID (`hc_si_…`).
	Id string `json:"id"`

	// Metadata The item's stored metadata. Absent when empty.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// PendingPlanEffectiveAt When the scheduled plan change takes effect: the end of the
	// period in which it was scheduled. Absent when no change is
	// scheduled.
	PendingPlanEffectiveAt time.Time `json:"pending_plan_effective_at,omitempty"`

	// PendingPlanId Plan the item moves to at `pending_plan_effective_at`. Absent when no change is scheduled.
	PendingPlanId string `json:"pending_plan_id,omitempty"`

	// PlanChangedAt When the plan was last changed immediately. Absent until the first such change.
	PlanChangedAt time.Time `json:"plan_changed_at,omitempty"`

	// PlanId The plan the item bills now. A scheduled plan change shows in
	// `pending_plan_id` until it takes effect.
	PlanId string `json:"plan_id"`

	// Quantity How many of the plan the item bills: the plan's base fee is
	// charged this many times. At least 1.
	Quantity int64 `json:"quantity"`

	// SubscriptionId The subscription the item is on.
	SubscriptionId string `json:"subscription_id"`

	// TenantId The account the item belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the item last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

SubscriptionItem One priced line of a subscription. It pairs a plan with a quantity. Returned inside a subscription's `items`, and by the item routes.

type SubscriptionItemChangeResult

type SubscriptionItemChangeResult struct {
	// EffectiveAt When the change takes effect. For a scheduled plan change, the end of the current period.
	EffectiveAt time.Time `json:"effective_at"`

	// Item One priced line of a subscription. It pairs a plan with a quantity.
	// Returned inside a subscription's `items`, and by the item routes.
	Item SubscriptionItem `json:"item"`

	// NewPeriodInvoice The invoice an immediate change to a plan with another billing
	// interval created for the new period it starts.
	NewPeriodInvoice SubscriptionNewPeriodInvoice `json:"new_period_invoice,omitempty"`

	// Proration What Hardcount did to settle the rest of the period for an item change.
	Proration SubscriptionItemProration `json:"proration,omitempty"`
}

SubscriptionItemChangeResult What `PATCH /v1/subscriptions/{id}/items/{itemID}` did: the item after the change, when the change takes effect, and how the rest of the period was settled.

type SubscriptionItemProration

type SubscriptionItemProration struct {
	// AmountCents Gross amount, tax included, in the currency's minor unit (cents
	// for USD): the invoice total (`invoice`), or the whole credit for
	// unused time (`credit` and `adjustment`).
	// `credited_to_balance_cents`, `reduced_open_invoices_cents` and
	// `held_on_draft_invoices_cents` say where the credit went.
	AmountCents int64 `json:"amount_cents"`

	// CreditedToBalanceCents The part of the credit added to the customer's balance, tax
	// included, in the currency's minor unit. On a paid invoice, all
	// of its part. On an open invoice paid partly with credits, the
	// part above what it still asks for: those credits go back to the
	// balance. A part on an invoice whose payment is still processing
	// counts here; if that payment fails, it reduces the invoice
	// instead. 0 when `type` is `invoice`.
	CreditedToBalanceCents int64 `json:"credited_to_balance_cents"`

	// HeldOnDraftInvoicesCents The part of the credit on draft invoices, tax included, in the
	// currency's minor unit. It is held until the draft is finalized,
	// then applied by how the invoice stands: if paid, to the
	// customer's balance; if still open, off what it asks for first,
	// as above. 0 when `type` is `invoice`.
	HeldOnDraftInvoicesCents int64 `json:"held_on_draft_invoices_cents"`

	// InvoiceId The proration invoice. Present when `type` is `invoice`.
	InvoiceId string `json:"invoice_id,omitempty"`

	// NewPlanId The plan the item is on after the change.
	NewPlanId string `json:"new_plan_id"`

	// OldPlanId The plan the item was on before the change. The same as `new_plan_id` for a quantity change.
	OldPlanId string `json:"old_plan_id"`

	// ProrationFactor Share of the full billing cycle that was left, from 0 to 1.
	ProrationFactor float64 `json:"proration_factor"`

	// ReducedOpenInvoicesCents The part of the credit taken off the amount due on open
	// invoices, tax included, in the currency's minor unit. 0 when
	// `type` is `invoice`.
	ReducedOpenInvoicesCents int64 `json:"reduced_open_invoices_cents"`

	// Type `invoice`: a proration invoice was created. `credit`: some of
	// the credit went to the customer's balance, or no invoice had
	// room for any of it (`amount_cents` is then 0). `adjustment`:
	// none of it went to the balance.
	Type SubscriptionItemProrationType `json:"type"`
}

SubscriptionItemProration What Hardcount did to settle the rest of the period for an item change.

type SubscriptionItemProrationType

type SubscriptionItemProrationType string

SubscriptionItemProrationType `invoice`: a proration invoice was created. `credit`: some of the credit went to the customer's balance, or no invoice had room for any of it (`amount_cents` is then 0). `adjustment`: none of it went to the balance.

const (
	SubscriptionItemProrationTypeAdjustment SubscriptionItemProrationType = "adjustment"
	SubscriptionItemProrationTypeCredit     SubscriptionItemProrationType = "credit"
	SubscriptionItemProrationTypeInvoice    SubscriptionItemProrationType = "invoice"
)

Defines values for SubscriptionItemProrationType.

func (SubscriptionItemProrationType) Valid

Valid indicates whether the value is a known member of the SubscriptionItemProrationType enum.

type SubscriptionItemThreshold

type SubscriptionItemThreshold struct {
	// SubscriptionItemId The item of this subscription the threshold watches.
	SubscriptionItemId string `json:"subscription_item_id"`

	// UsageGte Usage quantity threshold, as a decimal string.
	UsageGte string `json:"usage_gte"`
}

SubscriptionItemThreshold A usage threshold on one item: when the item's usage in the period reaches `usage_gte`, Hardcount invoices the usage so far.

type SubscriptionNewPeriodInvoice

type SubscriptionNewPeriodInvoice struct {
	// Currency The invoice's currency, uppercase (for example `USD`).
	Currency string `json:"currency"`

	// Id The invoice's ID (`hc_inv_…`).
	Id string `json:"id"`

	// InvoiceNumber The invoice's number, as printed on it.
	InvoiceNumber string `json:"invoice_number"`

	// Status `draft` when the invoice was not issued yet: collection is
	// paused, or its tax could not be calculated yet. Its total may
	// then change before it is finalized.
	Status SubscriptionNewPeriodInvoiceStatus `json:"status"`

	// TotalAmountCents The invoice total when the change created it, in the
	// currency's minor unit (cents for USD). On a `draft` whose tax
	// could not be calculated yet, it has no tax in it.
	TotalAmountCents int64 `json:"total_amount_cents"`
}

SubscriptionNewPeriodInvoice The invoice an immediate change to a plan with another billing interval created for the new period it starts.

type SubscriptionNewPeriodInvoiceStatus

type SubscriptionNewPeriodInvoiceStatus string

SubscriptionNewPeriodInvoiceStatus `draft` when the invoice was not issued yet: collection is paused, or its tax could not be calculated yet. Its total may then change before it is finalized.

const (
	SubscriptionNewPeriodInvoiceStatusDraft     SubscriptionNewPeriodInvoiceStatus = "draft"
	SubscriptionNewPeriodInvoiceStatusFinalized SubscriptionNewPeriodInvoiceStatus = "finalized"
)

Defines values for SubscriptionNewPeriodInvoiceStatus.

func (SubscriptionNewPeriodInvoiceStatus) Valid

Valid indicates whether the value is a known member of the SubscriptionNewPeriodInvoiceStatus enum.

type SubscriptionPauseCollection

type SubscriptionPauseCollection struct {
	// Behavior What happens to the invoices built during the pause. Only
	// `keep_as_draft`: they stay drafts, so they are not finalized,
	// charged or dunned.
	Behavior SubscriptionPauseCollectionBehavior `json:"behavior"`

	// ResumesAt When collection resumes. Absent when the pause lasts until it is
	// cleared. On a pause set by dunning, it is when Hardcount recorded the
	// payment of the invoice the pause was set for.
	ResumesAt time.Time `json:"resumes_at,omitempty"`

	// SetBy Who paused collection. `operator`: you, through the API or the
	// dashboard; the pause lasts until you resume it or until
	// `resumes_at`. `dunning`: a dunning policy's `pause` final action.
	// A dunning pause lifts by itself once the invoice whose dunning
	// set it is paid, even if another invoice is still owed. Periods
	// that ended during the pause keep their draft invoices.
	SetBy SubscriptionPauseCollectionSetBy `json:"set_by,omitempty"`
}

SubscriptionPauseCollection Present on a subscription while collection is paused. New invoices are still created, but stay drafts and are not charged. Absent when collection runs normally. A cancel leaves it in place: it still holds the subscription's unpaid invoices, and `DELETE /v1/subscriptions/{id}/pause-collection` releases them.

type SubscriptionPauseCollectionBehavior

type SubscriptionPauseCollectionBehavior string

SubscriptionPauseCollectionBehavior What happens to the invoices built during the pause. Only `keep_as_draft`: they stay drafts, so they are not finalized, charged or dunned.

const (
	SubscriptionPauseCollectionBehaviorKeepAsDraft SubscriptionPauseCollectionBehavior = "keep_as_draft"
)

Defines values for SubscriptionPauseCollectionBehavior.

func (SubscriptionPauseCollectionBehavior) Valid

Valid indicates whether the value is a known member of the SubscriptionPauseCollectionBehavior enum.

type SubscriptionPauseCollectionSetBy

type SubscriptionPauseCollectionSetBy string

SubscriptionPauseCollectionSetBy Who paused collection. `operator`: you, through the API or the dashboard; the pause lasts until you resume it or until `resumes_at`. `dunning`: a dunning policy's `pause` final action. A dunning pause lifts by itself once the invoice whose dunning set it is paid, even if another invoice is still owed. Periods that ended during the pause keep their draft invoices.

const (
	Dunning  SubscriptionPauseCollectionSetBy = "dunning"
	Operator SubscriptionPauseCollectionSetBy = "operator"
)

Defines values for SubscriptionPauseCollectionSetBy.

func (SubscriptionPauseCollectionSetBy) Valid

Valid indicates whether the value is a known member of the SubscriptionPauseCollectionSetBy enum.

type SubscriptionStatus

type SubscriptionStatus string

SubscriptionStatus Where the subscription is in its life.

  • `draft`: created with `status: draft`. It has no billing period and bills nothing until you activate it with `POST /v1/subscriptions/{id}/activate`.
  • `trialing`: in a free trial until `trial_end_at`. Usage in the trial is not billed. When the trial ends, Hardcount makes the subscription `active` and its first paid period starts. If a cancel is scheduled for the trial end, it becomes `canceled` instead, with no charge.
  • `active`: billing. Usage and base fees billed in arrears are invoiced when each period ends; a base fee billed in advance when its period starts.
  • `canceled`: ended at `canceled_at`. It bills nothing more, and no route makes it `active` again.

A paused collection is not a status: see `pause_collection`.

const (
	SubscriptionStatusActive   SubscriptionStatus = "active"
	SubscriptionStatusCanceled SubscriptionStatus = "canceled"
	SubscriptionStatusDraft    SubscriptionStatus = "draft"
	SubscriptionStatusTrialing SubscriptionStatus = "trialing"
)

Defines values for SubscriptionStatus.

func (SubscriptionStatus) Valid

func (e SubscriptionStatus) Valid() bool

Valid indicates whether the value is a known member of the SubscriptionStatus enum.

type SubscriptionTimelineEvent

type SubscriptionTimelineEvent struct {
	// ActorId The actor's ID (a user's, an API key's `hc_key_…` or a customer's), or `system`.
	ActorId string `json:"actor_id,omitempty"`

	// ActorName The actor's name: a user's email, an API key's name or a
	// customer's display name. Absent when it is not known.
	ActorName string `json:"actor_name,omitempty"`

	// ActorType Who acted, as the audit log records it: `user` (a dashboard
	// user), `api_key`, `customer`, or `system` (Hardcount itself).
	ActorType string `json:"actor_type,omitempty"`

	// Description The line's title, for example "Subscription canceled".
	Description string `json:"description"`

	// Detail The line's meta line as text, without the actor (see
	// `actor_name`) and without a date at its end, which is in
	// `detail_timestamp`. For example "Starter → Pro".
	Detail string `json:"detail,omitempty"`

	// DetailTimestamp The date the end of `detail` refers to, for the client to format, as in "Trial now ends" followed by this date.
	DetailTimestamp time.Time `json:"detail_timestamp,omitempty"`

	// Error The line's problem.
	Error string `json:"error,omitempty"`

	// EventType The audit action, e.g. `create`, `cancel`, `subscription.item_updated`.
	EventType string `json:"event_type"`

	// IsSimulated True when the action affected a subscription on a test clock.
	IsSimulated bool `json:"is_simulated,omitempty"`

	// Line One activity row, with every word written by the server: a title
	// with no values, the amount when the event moves money, asks for it
	// or cancels money owed, a problem line on failure and warning rows,
	// the meta line's parts and the actor, a tone, and the event's time on
	// the entity's calendar. `recorded_at` is the real-world time, set
	// only for an entity on a test clock. The invoice payment timeline and
	// dunning run events carry it.
	Line ActivityLine `json:"line"`

	// SimEffectiveAt The test clock's simulated time when the action took effect.
	SimEffectiveAt time.Time `json:"sim_effective_at,omitempty"`

	// Source Where the row comes from. Always `audit`, the audit log.
	Source SubscriptionTimelineEventSource `json:"source"`

	// Status The line's tone in older words, read by the dashboard's dot.
	Status SubscriptionTimelineEventStatus `json:"status"`

	// TestClockId The test clock `sim_effective_at` belongs to. Absent when the action was not on a test clock.
	TestClockId string `json:"test_clock_id,omitempty"`

	// Timestamp When the action was recorded (wall-clock time).
	Timestamp time.Time `json:"timestamp"`
}

SubscriptionTimelineEvent One row of a subscription's activity timeline (`GET /v1/subscriptions/{id}/timeline`), built from one audit log entry. `line` carries the row in its structured form; `description`, `detail`, `detail_timestamp`, `error` and `status` repeat its words for older clients.

type SubscriptionTimelineEventSource

type SubscriptionTimelineEventSource string

SubscriptionTimelineEventSource Where the row comes from. Always `audit`, the audit log.

const (
	Audit SubscriptionTimelineEventSource = "audit"
)

Defines values for SubscriptionTimelineEventSource.

func (SubscriptionTimelineEventSource) Valid

Valid indicates whether the value is a known member of the SubscriptionTimelineEventSource enum.

type SubscriptionTimelineEventStatus

type SubscriptionTimelineEventStatus string

SubscriptionTimelineEventStatus The line's tone in older words, read by the dashboard's dot.

const (
	SubscriptionTimelineEventStatusFailed    SubscriptionTimelineEventStatus = "failed"
	SubscriptionTimelineEventStatusNeutral   SubscriptionTimelineEventStatus = "neutral"
	SubscriptionTimelineEventStatusSucceeded SubscriptionTimelineEventStatus = "succeeded"
	SubscriptionTimelineEventStatusWarning   SubscriptionTimelineEventStatus = "warning"
)

Defines values for SubscriptionTimelineEventStatus.

func (SubscriptionTimelineEventStatus) Valid

Valid indicates whether the value is a known member of the SubscriptionTimelineEventStatus enum.

type SwitchSessionModeJSONBody added in v0.9.2

type SwitchSessionModeJSONBody struct {
	// Livemode True for live mode, false for test mode.
	Livemode bool `json:"livemode"`
}

SwitchSessionModeJSONBody defines parameters for SwitchSessionMode.

type SwitchSessionModeJSONRequestBody added in v0.9.2

type SwitchSessionModeJSONRequestBody SwitchSessionModeJSONBody

SwitchSessionModeJSONRequestBody defines body for SwitchSessionMode for application/json ContentType.

type Tenant

type Tenant struct {
	// CreatedAt When the account was created.
	CreatedAt time.Time `json:"created_at"`

	// Id The account's id (`hc_ten_…`). Other objects carry it as `tenant_id`.
	Id string `json:"id"`

	// Name The account's name, given at setup.
	Name string `json:"name"`

	// Status The account's state. Setup creates it `active`. Nothing in this
	// version sets `suspended` or `deleted`.
	Status TenantStatus `json:"status"`

	// UpdatedAt When the account record last changed.
	UpdatedAt time.Time `json:"updated_at"`
}

Tenant An account: one business that bills its customers with Hardcount. It has separate test and live data. `POST /v1/bootstrap` creates the first one.

type TenantSettings

type TenantSettings struct {
	// BrandColor Accent color on invoice PDFs, as `#rrggbb`. Stored in lower case.
	BrandColor string `json:"brand_color,omitempty"`

	// CompanyAddressLine1 First line of your business address, printed as the seller on invoices and credit notes.
	CompanyAddressLine1 string `json:"company_address_line1,omitempty"`

	// CompanyAddressLine2 Second line of your business address, such as a suite number.
	CompanyAddressLine2 string `json:"company_address_line2,omitempty"`

	// CompanyCity City of your business address.
	CompanyCity string `json:"company_city,omitempty"`

	// CompanyCountry ISO 3166 alpha-2 code, such as `US`. Empty is allowed.
	// Whitespace is trimmed and the code is upper-cased before it is
	// checked and stored.
	CompanyCountry string `json:"company_country,omitempty"`

	// CompanyEmail Your billing contact address, printed as the seller on invoices
	// and credit notes and shown on the hosted pages. One plain
	// address, such as `billing@example.com`, with no display name.
	CompanyEmail string `json:"company_email,omitempty"`

	// CompanyName Shown on invoices and as the sender name on emails. No line breaks.
	CompanyName string `json:"company_name,omitempty"`

	// CompanyPhone 7 to 20 characters of digits, spaces, `+`, `-`, `(` and `)`.
	CompanyPhone string `json:"company_phone,omitempty"`

	// CompanyPostalCode Postal code of your business address.
	CompanyPostalCode string `json:"company_postal_code,omitempty"`

	// CompanyState State, province or region of your business address.
	CompanyState string `json:"company_state,omitempty"`

	// CreatedAt When the account's settings were first stored. Zero time (`0001-01-01T00:00:00Z`) when none are stored yet, and the answer shows the defaults.
	CreatedAt time.Time `json:"created_at"`

	// CreditBalanceLowThresholdCents When a customer's credit in one currency drops below this
	// amount, in that currency's minor units, the `credit.balance_low`
	// webhook fires: 1000 means $10.00 of USD credit and €10.00 of EUR
	// credit. Send null to turn it off. Answers leave it out while it
	// is off.
	CreditBalanceLowThresholdCents int64 `json:"credit_balance_low_threshold_cents,omitempty"`

	// CreditNotePrefix Starts every credit note number, such as `CN-000001`. Stored in
	// upper case. A change applies to new credit notes only. Issued notes keep their
	// numbers. It must differ from `invoice_prefix`, or an invoice and
	// a credit note would get the same number.
	CreditNotePrefix string `json:"credit_note_prefix"`

	// DefaultCurrency ISO 4217 code, stored in upper case. Zero-decimal currencies (such as JPY) are not supported yet.
	DefaultCurrency string `json:"default_currency"`

	// DefaultProductTaxCode Stripe product tax code used when a plan has none, such as
	// `txcd_10103001`. Empty is allowed. Surrounding whitespace is
	// trimmed before the check. A save with `tax_provider: stripe_tax`
	// and no code stores `txcd_10103001` (SaaS, business use).
	DefaultProductTaxCode string `json:"default_product_tax_code,omitempty"`

	// InvoiceFooter Printed under the totals on invoice PDFs and on the hosted
	// invoice page. Each invoice keeps the footer it was issued with,
	// so a change applies to invoices issued after it. A draft shows
	// the current text.
	InvoiceFooter string `json:"invoice_footer,omitempty"`

	// InvoicePrefix Starts every invoice number, such as `HC-000001`. Stored in upper case.
	InvoicePrefix string `json:"invoice_prefix"`

	// LogoUrl Shown in emails and on the hosted invoice page. PDFs do not print it.
	LogoUrl string `json:"logo_url,omitempty"`

	// NetPaymentTerms Days until an invoice is due. 0 means due on issue.
	NetPaymentTerms int `json:"net_payment_terms"`

	// NextInvoiceSequence The number the next invoice in this mode (test or live) gets,
	// before the prefix: 43 means the next invoice is
	// `<invoice_prefix>-000043`. Test and live count separately, and
	// changing `invoice_prefix` keeps the count. Not a setting:
	// `PUT` refuses it as an unknown field (422).
	NextInvoiceSequence int `json:"next_invoice_sequence"`

	// SupportUrl Must start with `http://` or `https://`. Linked in emails and on
	// the hosted invoice page, and printed at the foot of invoice and
	// credit-note PDFs.
	SupportUrl string `json:"support_url,omitempty"`

	// TaxId Your own tax number (VAT, EIN, GSTIN), printed on invoices.
	TaxId string `json:"tax_id,omitempty"`

	// TaxInclusive Whether prices already include tax.
	TaxInclusive bool `json:"tax_inclusive"`

	// TaxName Label for the tax line, such as `VAT`.
	TaxName string `json:"tax_name,omitempty"`

	// TaxOnFailure What to do when the tax provider fails. `block`, the only value, holds the invoice until tax succeeds.
	TaxOnFailure TenantSettingsTaxOnFailure `json:"tax_on_failure,omitempty"`

	// TaxProvider `none` = no tax, `manual` = the flat `tax_rate`, `stripe_tax` = Stripe Tax.
	TaxProvider TenantSettingsTaxProvider `json:"tax_provider"`

	// TaxRate Percent, from 0 to 100 (18.5 = 18.5%), stored to 4 decimal
	// places. Used by the `manual` provider.
	TaxRate float32 `json:"tax_rate"`

	// TenantId The account these settings belong to. `PUT` refuses it (422).
	TenantId string `json:"tenant_id"`

	// Timezone IANA zone name, such as `America/New_York`. `Local` is rejected. All billing date math uses this zone.
	Timezone string `json:"timezone"`

	// UpdatedAt When the settings were last saved. Zero time (`0001-01-01T00:00:00Z`) when none are stored yet.
	UpdatedAt time.Time `json:"updated_at"`
}

TenantSettings defines model for TenantSettings.

type TenantSettingsInput

type TenantSettingsInput struct {
	// BrandColor Accent color on invoice PDFs, as `#rrggbb`. Stored in lower case.
	BrandColor string `json:"brand_color,omitempty"`

	// CompanyAddressLine1 First line of your business address, printed as the seller on invoices and credit notes.
	CompanyAddressLine1 string `json:"company_address_line1,omitempty"`

	// CompanyAddressLine2 Second line of your business address, such as a suite number.
	CompanyAddressLine2 string `json:"company_address_line2,omitempty"`

	// CompanyCity City of your business address.
	CompanyCity string `json:"company_city,omitempty"`

	// CompanyCountry ISO 3166 alpha-2 code, such as `US`. Empty is allowed.
	// Whitespace is trimmed and the code is upper-cased before it is
	// checked and stored.
	CompanyCountry string `json:"company_country,omitempty"`

	// CompanyEmail Your billing contact address, printed as the seller on invoices
	// and credit notes and shown on the hosted pages. One plain
	// address, such as `billing@example.com`, with no display name.
	CompanyEmail string `json:"company_email,omitempty"`

	// CompanyName Shown on invoices and as the sender name on emails. No line breaks.
	CompanyName string `json:"company_name,omitempty"`

	// CompanyPhone 7 to 20 characters of digits, spaces, `+`, `-`, `(` and `)`.
	CompanyPhone string `json:"company_phone,omitempty"`

	// CompanyPostalCode Postal code of your business address.
	CompanyPostalCode string `json:"company_postal_code,omitempty"`

	// CompanyState State, province or region of your business address.
	CompanyState string `json:"company_state,omitempty"`

	// CreditBalanceLowThresholdCents When a customer's credit in one currency drops below this
	// amount, in that currency's minor units, the `credit.balance_low`
	// webhook fires: 1000 means $10.00 of USD credit and €10.00 of EUR
	// credit. Send null to turn it off. Answers leave it out while it
	// is off.
	CreditBalanceLowThresholdCents int64 `json:"credit_balance_low_threshold_cents,omitempty"`

	// CreditNotePrefix Starts every credit note number, such as `CN-000001`. Stored in
	// upper case. A change applies to new credit notes only. Issued notes keep their
	// numbers. It must differ from `invoice_prefix`, or an invoice and
	// a credit note would get the same number.
	CreditNotePrefix string `json:"credit_note_prefix,omitempty"`

	// DefaultCurrency ISO 4217 code, stored in upper case. Zero-decimal currencies (such as JPY) are not supported yet.
	DefaultCurrency string `json:"default_currency,omitempty"`

	// DefaultProductTaxCode Stripe product tax code used when a plan has none, such as
	// `txcd_10103001`. Empty is allowed. Surrounding whitespace is
	// trimmed before the check. A save with `tax_provider: stripe_tax`
	// and no code stores `txcd_10103001` (SaaS, business use).
	DefaultProductTaxCode string `json:"default_product_tax_code,omitempty"`

	// InvoiceFooter Printed under the totals on invoice PDFs and on the hosted
	// invoice page. Each invoice keeps the footer it was issued with,
	// so a change applies to invoices issued after it. A draft shows
	// the current text.
	InvoiceFooter string `json:"invoice_footer,omitempty"`

	// InvoicePrefix Starts every invoice number, such as `HC-000001`. Stored in upper case.
	InvoicePrefix string `json:"invoice_prefix,omitempty"`

	// LogoUrl Shown in emails and on the hosted invoice page. PDFs do not print it.
	LogoUrl string `json:"logo_url,omitempty"`

	// NetPaymentTerms Days until an invoice is due. 0 means due on issue.
	NetPaymentTerms int `json:"net_payment_terms,omitempty"`

	// SupportUrl Must start with `http://` or `https://`. Linked in emails and on
	// the hosted invoice page, and printed at the foot of invoice and
	// credit-note PDFs.
	SupportUrl string `json:"support_url,omitempty"`

	// TaxId Your own tax number (VAT, EIN, GSTIN), printed on invoices.
	TaxId string `json:"tax_id,omitempty"`

	// TaxInclusive Whether prices already include tax.
	TaxInclusive bool `json:"tax_inclusive,omitempty"`

	// TaxName Label for the tax line, such as `VAT`.
	TaxName string `json:"tax_name,omitempty"`

	// TaxOnFailure What to do when the tax provider fails. `block`, the only value, holds the invoice until tax succeeds.
	TaxOnFailure TenantSettingsInputTaxOnFailure `json:"tax_on_failure,omitempty"`

	// TaxProvider `none` = no tax, `manual` = the flat `tax_rate`, `stripe_tax` = Stripe Tax.
	TaxProvider TenantSettingsInputTaxProvider `json:"tax_provider,omitempty"`

	// TaxRate Percent, from 0 to 100 (18.5 = 18.5%), stored to 4 decimal
	// places. Used by the `manual` provider.
	TaxRate float32 `json:"tax_rate,omitempty"`

	// Timezone IANA zone name, such as `America/New_York`. `Local` is rejected. All billing date math uses this zone.
	Timezone string `json:"timezone,omitempty"`
}

TenantSettingsInput The account's billing settings, as `PUT /v1/settings` takes them. Every field is optional. Fields you leave out keep their stored value. Settings are shared by test and live mode. The length limits count bytes, not characters: an accented letter counts as two.

type TenantSettingsInputTaxOnFailure

type TenantSettingsInputTaxOnFailure string

TenantSettingsInputTaxOnFailure What to do when the tax provider fails. `block`, the only value, holds the invoice until tax succeeds.

const (
	TenantSettingsInputTaxOnFailureBlock TenantSettingsInputTaxOnFailure = "block"
)

Defines values for TenantSettingsInputTaxOnFailure.

func (TenantSettingsInputTaxOnFailure) Valid

Valid indicates whether the value is a known member of the TenantSettingsInputTaxOnFailure enum.

type TenantSettingsInputTaxProvider

type TenantSettingsInputTaxProvider string

TenantSettingsInputTaxProvider `none` = no tax, `manual` = the flat `tax_rate`, `stripe_tax` = Stripe Tax.

const (
	TenantSettingsInputTaxProviderManual    TenantSettingsInputTaxProvider = "manual"
	TenantSettingsInputTaxProviderNone      TenantSettingsInputTaxProvider = "none"
	TenantSettingsInputTaxProviderStripeTax TenantSettingsInputTaxProvider = "stripe_tax"
)

Defines values for TenantSettingsInputTaxProvider.

func (TenantSettingsInputTaxProvider) Valid

Valid indicates whether the value is a known member of the TenantSettingsInputTaxProvider enum.

type TenantSettingsTaxOnFailure

type TenantSettingsTaxOnFailure string

TenantSettingsTaxOnFailure What to do when the tax provider fails. `block`, the only value, holds the invoice until tax succeeds.

const (
	TenantSettingsTaxOnFailureBlock TenantSettingsTaxOnFailure = "block"
)

Defines values for TenantSettingsTaxOnFailure.

func (TenantSettingsTaxOnFailure) Valid

func (e TenantSettingsTaxOnFailure) Valid() bool

Valid indicates whether the value is a known member of the TenantSettingsTaxOnFailure enum.

type TenantSettingsTaxProvider

type TenantSettingsTaxProvider string

TenantSettingsTaxProvider `none` = no tax, `manual` = the flat `tax_rate`, `stripe_tax` = Stripe Tax.

const (
	TenantSettingsTaxProviderManual    TenantSettingsTaxProvider = "manual"
	TenantSettingsTaxProviderNone      TenantSettingsTaxProvider = "none"
	TenantSettingsTaxProviderStripeTax TenantSettingsTaxProvider = "stripe_tax"
)

Defines values for TenantSettingsTaxProvider.

func (TenantSettingsTaxProvider) Valid

func (e TenantSettingsTaxProvider) Valid() bool

Valid indicates whether the value is a known member of the TenantSettingsTaxProvider enum.

type TenantStatus

type TenantStatus string

TenantStatus The account's state. Setup creates it `active`. Nothing in this version sets `suspended` or `deleted`.

const (
	TenantStatusActive    TenantStatus = "active"
	TenantStatusDeleted   TenantStatus = "deleted"
	TenantStatusSuspended TenantStatus = "suspended"
)

Defines values for TenantStatus.

func (TenantStatus) Valid

func (e TenantStatus) Valid() bool

Valid indicates whether the value is a known member of the TenantStatus enum.

type TestClock

type TestClock struct {
	// CreatedAt When the clock was created, in real time.
	CreatedAt time.Time `json:"created_at"`

	// FrozenTime The clock's current time.
	FrozenTime time.Time `json:"frozen_time"`

	// Id The clock's ID (`hc_tclk_…`).
	Id string `json:"id"`

	// LastAdvanceSummary What the latest advance did: the time span it covered and how many
	// of each billing step it ran. Absent until the clock is first
	// advanced.
	LastAdvanceSummary TestClockAdvanceSummary `json:"last_advance_summary,omitempty"`

	// LastFailureReason Why the last advance failed, for a clock in `internal_failure`.
	// Cleared when you retry the advance, and by the next advance
	// that succeeds. Absent when there is none.
	LastFailureReason string `json:"last_failure_reason,omitempty"`

	// Name Your name for the clock. Empty when you gave none.
	Name string `json:"name"`

	// Status `ready`: it can be advanced. `advancing`: billing is catching up
	// to the new time. `internal_failure`: the last advance
	// failed partway; resume it with `POST /v1/test-clocks/{id}/retry-advance`.
	Status TestClockStatus `json:"status"`

	// TenantId The account the clock belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the clock last changed, in real time.
	UpdatedAt time.Time `json:"updated_at"`
}

TestClock A clock for test mode. Customers and subscriptions attached to it are billed on its time, not the real time. Returned by the `/v1/test-clocks` routes.

type TestClockAdvanceSummary

type TestClockAdvanceSummary struct {
	// AdvancedFrom The clock's time before the advance. After a retried advance it
	// equals `advanced_to`. When the server restarted during the
	// advance and resumed it, it is `0001-01-01T00:00:00Z`.
	AdvancedFrom time.Time `json:"advanced_from"`

	// AdvancedTo The clock's time after the advance.
	AdvancedTo time.Time `json:"advanced_to"`

	// ChargesRetried Invoices waiting to be charged that the advance tried to collect.
	ChargesRetried int `json:"charges_retried"`

	// ClawbacksIssued Credit notes for unused time that were waiting for their invoice
	// to settle, issued now.
	ClawbacksIssued int `json:"clawbacks_issued"`

	// CreditsExpired Credit grants that expired in the span.
	CreditsExpired int `json:"credits_expired"`

	// DunningAdvanced Dunning runs that took a step.
	DunningAdvanced int `json:"dunning_advanced"`

	// HadErrors True when a step failed, which leaves the clock in
	// `internal_failure`. The steps after a failed one still ran, so
	// each count is what its step did.
	HadErrors bool `json:"had_errors"`

	// InvoicesGenerated Period invoices the advance created.
	InvoicesGenerated int `json:"invoices_generated"`

	// PausesResumed Collection pauses whose `resumes_at` passed in the span and that were lifted.
	PausesResumed int `json:"pauses_resumed"`

	// TaxRetried Invoices waiting for tax whose tax calculation was tried again.
	TaxRetried int `json:"tax_retried"`

	// ThresholdsFired Billing-threshold invoices issued.
	ThresholdsFired int `json:"thresholds_fired"`

	// TrialsActivated Subscriptions whose trial ended by the clock's new time: those
	// that became `active`, and those a cancel scheduled for the trial
	// end canceled with no charge.
	TrialsActivated int `json:"trials_activated"`
}

TestClockAdvanceSummary What the latest advance did: the time span it covered and how many of each billing step it ran. Absent until the clock is first advanced.

type TestClockStatus

type TestClockStatus string

TestClockStatus `ready`: it can be advanced. `advancing`: billing is catching up to the new time. `internal_failure`: the last advance failed partway; resume it with `POST /v1/test-clocks/{id}/retry-advance`.

const (
	TestClockStatusAdvancing       TestClockStatus = "advancing"
	TestClockStatusInternalFailure TestClockStatus = "internal_failure"
	TestClockStatusReady           TestClockStatus = "ready"
)

Defines values for TestClockStatus.

func (TestClockStatus) Valid

func (e TestClockStatus) Valid() bool

Valid indicates whether the value is a known member of the TestClockStatus enum.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type Unauthorized added in v0.9.2

type Unauthorized = Error

Unauthorized The body of an error answer. `error.type` is the broad class, `error.code` is the exact reason for your code to branch on, and `error.message` is a sentence for a person. Quote `error.request_id` when you ask for help.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) AcceptInvitation added in v0.9.2

func (_ Unimplemented) AcceptInvitation(w http.ResponseWriter, r *http.Request)

Accept a team invitation (POST /v1/auth/accept-invite)

func (Unimplemented) ActivateSubscription added in v0.9.2

func (_ Unimplemented) ActivateSubscription(w http.ResponseWriter, r *http.Request, id string, params ActivateSubscriptionParams)

Activate a draft subscription (POST /v1/subscriptions/{id}/activate)

func (Unimplemented) AddInvoiceLineItem

func (_ Unimplemented) AddInvoiceLineItem(w http.ResponseWriter, r *http.Request, id string, params AddInvoiceLineItemParams)

Add a line item to a draft invoice (POST /v1/invoices/{id}/line-items)

func (Unimplemented) AddPlanPrice

func (_ Unimplemented) AddPlanPrice(w http.ResponseWriter, r *http.Request, id string, params AddPlanPriceParams)

Add a price to a plan (POST /v1/plans/{id}/prices)

func (Unimplemented) AddSubscriptionItem

func (_ Unimplemented) AddSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, params AddSubscriptionItemParams)

Add an item to a subscription (POST /v1/subscriptions/{id}/items)

func (Unimplemented) AdjustCredits

func (_ Unimplemented) AdjustCredits(w http.ResponseWriter, r *http.Request, params AdjustCreditsParams)

Add or remove credit (POST /v1/credits/adjust)

func (Unimplemented) AdvanceTestClock added in v0.9.2

func (_ Unimplemented) AdvanceTestClock(w http.ResponseWriter, r *http.Request, id string, params AdvanceTestClockParams)

Advance a test clock (POST /v1/test-clocks/{id}/advance)

func (Unimplemented) AggregateUsageEvents

func (_ Unimplemented) AggregateUsageEvents(w http.ResponseWriter, r *http.Request, params AggregateUsageEventsParams)

Get usage totals (GET /v1/usage-events/aggregate)

func (Unimplemented) AttachStripeRefundToCreditNote added in v0.9.2

func (_ Unimplemented) AttachStripeRefundToCreditNote(w http.ResponseWriter, r *http.Request, id string, params AttachStripeRefundToCreditNoteParams)

Attach a refund made in Stripe to a credit note (POST /v1/credit-notes/{id}/attach-stripe-refund)

func (Unimplemented) BackfillUsageEvent

func (_ Unimplemented) BackfillUsageEvent(w http.ResponseWriter, r *http.Request)

Backfill a past usage event (POST /v1/usage-events/backfill)

func (Unimplemented) Bootstrap

func (_ Unimplemented) Bootstrap(w http.ResponseWriter, r *http.Request)

Set up a new installation (POST /v1/bootstrap)

func (Unimplemented) CancelSubscription

func (_ Unimplemented) CancelSubscription(w http.ResponseWriter, r *http.Request, id string, params CancelSubscriptionParams)

Cancel a subscription now (POST /v1/subscriptions/{id}/cancel)

func (Unimplemented) CancelSubscriptionItemPendingChange

func (_ Unimplemented) CancelSubscriptionItemPendingChange(w http.ResponseWriter, r *http.Request, id string, itemID string)

Cancel a scheduled plan change (DELETE /v1/subscriptions/{id}/items/{itemID}/pending-change)

func (Unimplemented) CheckPasswordResetToken

func (_ Unimplemented) CheckPasswordResetToken(w http.ResponseWriter, r *http.Request, params CheckPasswordResetTokenParams)

Check a password reset token (GET /v1/auth/password-reset/check)

func (Unimplemented) ClearSubscriptionBillingThresholds

func (_ Unimplemented) ClearSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request, id string)

Clear billing thresholds (DELETE /v1/subscriptions/{id}/billing-thresholds)

func (Unimplemented) ClearSubscriptionScheduledCancel

func (_ Unimplemented) ClearSubscriptionScheduledCancel(w http.ResponseWriter, r *http.Request, id string)

Clear a scheduled cancel (DELETE /v1/subscriptions/{id}/scheduled-cancel)

func (Unimplemented) CollectInvoicePayment

func (_ Unimplemented) CollectInvoicePayment(w http.ResponseWriter, r *http.Request, id string, params CollectInvoicePaymentParams)

Charge a finalized invoice now (POST /v1/invoices/{id}/collect)

func (Unimplemented) ConfirmPasswordReset added in v0.9.2

func (_ Unimplemented) ConfirmPasswordReset(w http.ResponseWriter, r *http.Request)

Set a new password using a reset token (POST /v1/auth/password-reset/confirm)

func (Unimplemented) ConnectStripe

func (_ Unimplemented) ConnectStripe(w http.ResponseWriter, r *http.Request, params ConnectStripeParams)

Connect a Stripe account (POST /v1/settings/stripe)

func (Unimplemented) CreateApiKey

func (_ Unimplemented) CreateApiKey(w http.ResponseWriter, r *http.Request, params CreateApiKeyParams)

Create an API key (POST /v1/api-keys)

func (Unimplemented) CreateCreditNote added in v0.9.2

func (_ Unimplemented) CreateCreditNote(w http.ResponseWriter, r *http.Request, params CreateCreditNoteParams)

Create a credit note (POST /v1/credit-notes)

func (Unimplemented) CreateCustomer added in v0.9.2

func (_ Unimplemented) CreateCustomer(w http.ResponseWriter, r *http.Request, params CreateCustomerParams)

Create a customer (POST /v1/customers)

func (Unimplemented) CreateCustomerPaymentSetupSession

func (_ Unimplemented) CreateCustomerPaymentSetupSession(w http.ResponseWriter, r *http.Request, customerId string, params CreateCustomerPaymentSetupSessionParams)

Create a link for the customer to add a payment method (POST /v1/customers/{customer_id}/payment-methods/setup-session)

func (Unimplemented) CreateDunningPolicy

func (_ Unimplemented) CreateDunningPolicy(w http.ResponseWriter, r *http.Request, params CreateDunningPolicyParams)

Create a dunning policy (POST /v1/dunning/policies)

func (Unimplemented) CreateHostedInvoiceCheckout

func (_ Unimplemented) CreateHostedInvoiceCheckout(w http.ResponseWriter, r *http.Request, token string)

Start paying the invoice in Stripe Checkout (POST /v1/public/invoices/{token}/checkout)

func (Unimplemented) CreateInvoice

func (_ Unimplemented) CreateInvoice(w http.ResponseWriter, r *http.Request, params CreateInvoiceParams)

Create a draft invoice (POST /v1/invoices)

func (Unimplemented) CreateInvoicePreview added in v0.9.2

func (_ Unimplemented) CreateInvoicePreview(w http.ResponseWriter, r *http.Request, params CreateInvoicePreviewParams)

Preview a customer's next invoice (POST /v1/invoices/create_preview)

func (Unimplemented) CreateMeter added in v0.9.2

func (_ Unimplemented) CreateMeter(w http.ResponseWriter, r *http.Request, params CreateMeterParams)

Create a meter (POST /v1/meters)

func (Unimplemented) CreatePlan added in v0.9.2

func (_ Unimplemented) CreatePlan(w http.ResponseWriter, r *http.Request, params CreatePlanParams)

Create a plan (POST /v1/plans)

func (Unimplemented) CreatePriceOverride

func (_ Unimplemented) CreatePriceOverride(w http.ResponseWriter, r *http.Request, params CreatePriceOverrideParams)

Create a customer price override (POST /v1/price-overrides)

func (Unimplemented) CreatePublicPaymentUpdateCheckout

func (_ Unimplemented) CreatePublicPaymentUpdateCheckout(w http.ResponseWriter, r *http.Request, token string)

Start adding a card in Stripe Checkout (POST /v1/public/payment-updates/{token}/checkout)

func (Unimplemented) CreateSubscription added in v0.9.2

func (_ Unimplemented) CreateSubscription(w http.ResponseWriter, r *http.Request, params CreateSubscriptionParams)

Create a subscription (POST /v1/subscriptions)

func (Unimplemented) CreateTestClock added in v0.9.2

func (_ Unimplemented) CreateTestClock(w http.ResponseWriter, r *http.Request, params CreateTestClockParams)

Create a test clock (POST /v1/test-clocks)

func (Unimplemented) CreateUsageEvent added in v0.9.2

func (_ Unimplemented) CreateUsageEvent(w http.ResponseWriter, r *http.Request)

Send a usage event (POST /v1/usage-events)

func (Unimplemented) CreateUsageEventBatch added in v0.9.2

func (_ Unimplemented) CreateUsageEventBatch(w http.ResponseWriter, r *http.Request)

Send a batch of usage events (POST /v1/usage-events/batch)

func (Unimplemented) CreateWebhookEndpoint added in v0.9.2

func (_ Unimplemented) CreateWebhookEndpoint(w http.ResponseWriter, r *http.Request, params CreateWebhookEndpointParams)

Create a webhook endpoint (POST /v1/webhook-endpoints/endpoints)

func (Unimplemented) DeleteDunningPolicy

func (_ Unimplemented) DeleteDunningPolicy(w http.ResponseWriter, r *http.Request, id string)

Delete a dunning policy (DELETE /v1/dunning/policies/{id})

func (Unimplemented) DeletePriceOverride

func (_ Unimplemented) DeletePriceOverride(w http.ResponseWriter, r *http.Request, id string)

End a customer price override (DELETE /v1/price-overrides/{id})

func (Unimplemented) DeleteProviderCost added in v0.9.2

func (_ Unimplemented) DeleteProviderCost(w http.ResponseWriter, r *http.Request, id string)

Delete a provider cost rate (DELETE /v1/provider-costs/{id})

func (Unimplemented) DeleteTestClock added in v0.9.2

func (_ Unimplemented) DeleteTestClock(w http.ResponseWriter, r *http.Request, id string)

Delete a test clock and its simulated data (DELETE /v1/test-clocks/{id})

func (Unimplemented) DeleteWebhookEndpoint added in v0.9.2

func (_ Unimplemented) DeleteWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string)

Delete a webhook endpoint (DELETE /v1/webhook-endpoints/endpoints/{id})

func (Unimplemented) DetachCustomerPaymentMethod

func (_ Unimplemented) DetachCustomerPaymentMethod(w http.ResponseWriter, r *http.Request, customerId string, pmid string)

Detach a payment method (DELETE /v1/customers/{customer_id}/payment-methods/{pmID})

func (Unimplemented) DiscardHeldUsage

func (_ Unimplemented) DiscardHeldUsage(w http.ResponseWriter, r *http.Request)

Discard held usage (POST /v1/usage-events/held/discard)

func (Unimplemented) DisconnectStripe

func (_ Unimplemented) DisconnectStripe(w http.ResponseWriter, r *http.Request, mode DisconnectStripeParamsMode)

Disconnect Stripe for one mode (DELETE /v1/settings/stripe/{mode})

func (Unimplemented) DismissInvoiceStripeRefund added in v0.9.2

func (_ Unimplemented) DismissInvoiceStripeRefund(w http.ResponseWriter, r *http.Request, id string, stripeRefundId string, params DismissInvoiceStripeRefundParams)

Dismiss a refund made in Stripe (POST /v1/invoices/{id}/stripe-refunds/{stripe_refund_id}/dismiss)

func (Unimplemented) EndSubscriptionTrial

func (_ Unimplemented) EndSubscriptionTrial(w http.ResponseWriter, r *http.Request, id string, params EndSubscriptionTrialParams)

End a trial now (POST /v1/subscriptions/{id}/end-trial)

func (Unimplemented) ExportAuditLogCsv

func (_ Unimplemented) ExportAuditLogCsv(w http.ResponseWriter, r *http.Request, params ExportAuditLogCsvParams)

Export the audit log as CSV (GET /v1/exports/audit-log.csv)

func (Unimplemented) ExportCustomersCsv

func (_ Unimplemented) ExportCustomersCsv(w http.ResponseWriter, r *http.Request, params ExportCustomersCsvParams)

Export customers as CSV (GET /v1/exports/customers.csv)

func (Unimplemented) ExportInvoicesCsv

func (_ Unimplemented) ExportInvoicesCsv(w http.ResponseWriter, r *http.Request, params ExportInvoicesCsvParams)

Export invoices as CSV (GET /v1/exports/invoices.csv)

func (Unimplemented) ExportSubscriptionsCsv

func (_ Unimplemented) ExportSubscriptionsCsv(w http.ResponseWriter, r *http.Request, params ExportSubscriptionsCsvParams)

Export subscriptions as CSV (GET /v1/exports/subscriptions.csv)

func (Unimplemented) ExportUsageEventsCsv

func (_ Unimplemented) ExportUsageEventsCsv(w http.ResponseWriter, r *http.Request, params ExportUsageEventsCsvParams)

Export usage events as CSV (GET /v1/exports/usage-events.csv)

func (Unimplemented) ExtendSubscriptionTrial

func (_ Unimplemented) ExtendSubscriptionTrial(w http.ResponseWriter, r *http.Request, id string, params ExtendSubscriptionTrialParams)

Extend a trial (POST /v1/subscriptions/{id}/extend-trial)

func (Unimplemented) FinalizeInvoice added in v0.9.2

func (_ Unimplemented) FinalizeInvoice(w http.ResponseWriter, r *http.Request, id string, params FinalizeInvoiceParams)

Finalize a draft invoice (POST /v1/invoices/{id}/finalize)

func (Unimplemented) GetAnalyticsMrrMovement

func (_ Unimplemented) GetAnalyticsMrrMovement(w http.ResponseWriter, r *http.Request, params GetAnalyticsMrrMovementParams)

Get MRR movement over time (GET /v1/analytics/mrr-movement)

func (Unimplemented) GetAnalyticsOverview

func (_ Unimplemented) GetAnalyticsOverview(w http.ResponseWriter, r *http.Request, params GetAnalyticsOverviewParams)

Get headline billing metrics (GET /v1/analytics/overview)

func (Unimplemented) GetAnalyticsRevenueChart

func (_ Unimplemented) GetAnalyticsRevenueChart(w http.ResponseWriter, r *http.Request, params GetAnalyticsRevenueChartParams)

Get revenue over time (GET /v1/analytics/revenue-chart)

func (Unimplemented) GetAnalyticsUsage

func (_ Unimplemented) GetAnalyticsUsage(w http.ResponseWriter, r *http.Request, params GetAnalyticsUsageParams)

Get usage over time (GET /v1/analytics/usage)

func (Unimplemented) GetAuditLogFilters

func (_ Unimplemented) GetAuditLogFilters(w http.ResponseWriter, r *http.Request)

List audit log filter values (GET /v1/audit-log/filters)

func (Unimplemented) GetCreditBalance added in v0.9.2

func (_ Unimplemented) GetCreditBalance(w http.ResponseWriter, r *http.Request, customerId string)

Get a customer's credit balance (GET /v1/credits/balance/{customer_id})

func (Unimplemented) GetCreditGrants added in v0.9.2

func (_ Unimplemented) GetCreditGrants(w http.ResponseWriter, r *http.Request, customerId string, params GetCreditGrantsParams)

List a customer's credit grants (GET /v1/credits/grants/{customer_id})

func (Unimplemented) GetCreditNote

func (_ Unimplemented) GetCreditNote(w http.ResponseWriter, r *http.Request, id string)

Get a credit note (GET /v1/credit-notes/{id})

func (Unimplemented) GetCreditNotePdf

func (_ Unimplemented) GetCreditNotePdf(w http.ResponseWriter, r *http.Request, id string)

Download credit note PDF (GET /v1/credit-notes/{id}/pdf)

func (Unimplemented) GetCreditNoteStats

func (_ Unimplemented) GetCreditNoteStats(w http.ResponseWriter, r *http.Request)

Get credit note totals (GET /v1/credit-notes/stats)

func (Unimplemented) GetCustomer

func (_ Unimplemented) GetCustomer(w http.ResponseWriter, r *http.Request, id string)

Get a customer (GET /v1/customers/{id})

func (Unimplemented) GetCustomerBillingProfile

func (_ Unimplemented) GetCustomerBillingProfile(w http.ResponseWriter, r *http.Request, id string)

Get the customer's billing profile (GET /v1/customers/{id}/billing-profile)

func (Unimplemented) GetCustomerMargin added in v0.9.2

func (_ Unimplemented) GetCustomerMargin(w http.ResponseWriter, r *http.Request, id string, params GetCustomerMarginParams)

Get a customer's margin report (GET /v1/customers/{id}/margin)

func (Unimplemented) GetCustomerOverview

func (_ Unimplemented) GetCustomerOverview(w http.ResponseWriter, r *http.Request, customerId string)

Get a customer overview (GET /v1/customers/{customer_id}/overview)

func (Unimplemented) GetCustomerUsage

func (_ Unimplemented) GetCustomerUsage(w http.ResponseWriter, r *http.Request, id string, params GetCustomerUsageParams)

Get the customer's usage and cost for a period (GET /v1/customers/{id}/usage)

func (Unimplemented) GetDunningPolicy

func (_ Unimplemented) GetDunningPolicy(w http.ResponseWriter, r *http.Request, id string)

Get a dunning policy (GET /v1/dunning/policies/{id})

func (Unimplemented) GetDunningRun

func (_ Unimplemented) GetDunningRun(w http.ResponseWriter, r *http.Request, id string)

Get a dunning run with its events (GET /v1/dunning/runs/{id})

func (Unimplemented) GetDunningStats

func (_ Unimplemented) GetDunningStats(w http.ResponseWriter, r *http.Request)

Get dunning totals (GET /v1/dunning/stats)

func (Unimplemented) GetEmailSettings

func (_ Unimplemented) GetEmailSettings(w http.ResponseWriter, r *http.Request)

Get the email setup status (GET /v1/settings/email)

func (Unimplemented) GetHealth

func (_ Unimplemented) GetHealth(w http.ResponseWriter, r *http.Request)

Check that the server is up (GET /health)

func (Unimplemented) GetHealthReady

func (_ Unimplemented) GetHealthReady(w http.ResponseWriter, r *http.Request)

Check that the server can take requests (GET /health/ready)

func (Unimplemented) GetHostedInvoice

func (_ Unimplemented) GetHostedInvoice(w http.ResponseWriter, r *http.Request, token string)

Data behind the hosted invoice page (GET /v1/public/invoices/{token})

func (Unimplemented) GetHostedInvoicePdf

func (_ Unimplemented) GetHostedInvoicePdf(w http.ResponseWriter, r *http.Request, token string)

Download the hosted invoice PDF (GET /v1/public/invoices/{token}/pdf)

func (Unimplemented) GetInvitation added in v0.9.2

func (_ Unimplemented) GetInvitation(w http.ResponseWriter, r *http.Request, token string)

Preview a team invitation (GET /v1/auth/invite/{token})

func (Unimplemented) GetInvoice

func (_ Unimplemented) GetInvoice(w http.ResponseWriter, r *http.Request, id string)

Get an invoice with its line items (GET /v1/invoices/{id})

func (Unimplemented) GetInvoicePaymentTimeline

func (_ Unimplemented) GetInvoicePaymentTimeline(w http.ResponseWriter, r *http.Request, id string)

Get the invoice activity timeline (GET /v1/invoices/{id}/payment-timeline)

func (Unimplemented) GetInvoicePdf added in v0.9.2

func (_ Unimplemented) GetInvoicePdf(w http.ResponseWriter, r *http.Request, id string)

Download an invoice PDF (GET /v1/invoices/{id}/pdf)

func (Unimplemented) GetLiveCreditBalance added in v0.9.2

func (_ Unimplemented) GetLiveCreditBalance(w http.ResponseWriter, r *http.Request, customerId string)

Get a customer's live credit balance (GET /v1/credits/balance/{customer_id}/live)

func (Unimplemented) GetMeter

func (_ Unimplemented) GetMeter(w http.ResponseWriter, r *http.Request, id string)

Get a meter (GET /v1/meters/{id})

func (Unimplemented) GetMetrics

func (_ Unimplemented) GetMetrics(w http.ResponseWriter, r *http.Request)

Get Prometheus metrics (GET /metrics)

func (Unimplemented) GetPlan

func (_ Unimplemented) GetPlan(w http.ResponseWriter, r *http.Request, id string)

Get a plan (GET /v1/plans/{id})

func (Unimplemented) GetPublicCostDashboard added in v0.9.2

func (_ Unimplemented) GetPublicCostDashboard(w http.ResponseWriter, r *http.Request, token string)

Get a customer's public cost dashboard (GET /v1/public/cost-dashboard/{token})

func (Unimplemented) GetPublicPaymentUpdate

func (_ Unimplemented) GetPublicPaymentUpdate(w http.ResponseWriter, r *http.Request, token string)

Get what the payment-update page shows (GET /v1/public/payment-updates/{token})

func (Unimplemented) GetRecipe

func (_ Unimplemented) GetRecipe(w http.ResponseWriter, r *http.Request, key string)

Get a recipe (GET /v1/recipes/{key})

func (Unimplemented) GetSubscription

func (_ Unimplemented) GetSubscription(w http.ResponseWriter, r *http.Request, id string)

Get a subscription (GET /v1/subscriptions/{id})

func (Unimplemented) GetSubscriptionTimeline

func (_ Unimplemented) GetSubscriptionTimeline(w http.ResponseWriter, r *http.Request, id string)

Get a subscription's activity timeline (GET /v1/subscriptions/{id}/timeline)

func (Unimplemented) GetTenantSettings

func (_ Unimplemented) GetTenantSettings(w http.ResponseWriter, r *http.Request)

Get account settings (GET /v1/settings)

func (Unimplemented) GetTestClock added in v0.9.2

func (_ Unimplemented) GetTestClock(w http.ResponseWriter, r *http.Request, id string)

Get a test clock (GET /v1/test-clocks/{id})

func (Unimplemented) GetWebhookEndpoint

func (_ Unimplemented) GetWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string)

Get a webhook endpoint (GET /v1/webhook-endpoints/endpoints/{id})

func (Unimplemented) GetWebhookEndpointStats

func (_ Unimplemented) GetWebhookEndpointStats(w http.ResponseWriter, r *http.Request, params GetWebhookEndpointStatsParams)

Get delivery counts per webhook endpoint (GET /v1/webhook-endpoints/endpoints/stats)

func (Unimplemented) GetWhoami added in v0.9.2

func (_ Unimplemented) GetWhoami(w http.ResponseWriter, r *http.Request)

Get the account and mode of the current credential (GET /v1/whoami)

func (Unimplemented) GrantCredits added in v0.9.2

func (_ Unimplemented) GrantCredits(w http.ResponseWriter, r *http.Request, params GrantCreditsParams)

Grant credit to a customer (POST /v1/credits/grant)

func (Unimplemented) IngestLitellmSpend

func (_ Unimplemented) IngestLitellmSpend(w http.ResponseWriter, r *http.Request)

Receive LiteLLM spend logs (POST /v1/integrations/litellm/spend)

func (Unimplemented) InstantiateRecipe

func (_ Unimplemented) InstantiateRecipe(w http.ResponseWriter, r *http.Request, key string, params InstantiateRecipeParams)

Install a recipe (POST /v1/recipes/{key}/instantiate)

func (Unimplemented) InviteMember

func (_ Unimplemented) InviteMember(w http.ResponseWriter, r *http.Request, params InviteMemberParams)

Invite a teammate by email (POST /v1/members/invite)

func (Unimplemented) IssueCreditNote

func (_ Unimplemented) IssueCreditNote(w http.ResponseWriter, r *http.Request, id string, params IssueCreditNoteParams)

Issue a draft credit note (POST /v1/credit-notes/{id}/issue)

func (Unimplemented) ListApiKeys

func (_ Unimplemented) ListApiKeys(w http.ResponseWriter, r *http.Request, params ListApiKeysParams)

List API keys (GET /v1/api-keys)

func (Unimplemented) ListAuditLog

func (_ Unimplemented) ListAuditLog(w http.ResponseWriter, r *http.Request, params ListAuditLogParams)

List audit log entries (GET /v1/audit-log)

func (Unimplemented) ListCreditBalances

func (_ Unimplemented) ListCreditBalances(w http.ResponseWriter, r *http.Request, params ListCreditBalancesParams)

List credit balances (GET /v1/credits/balances)

func (Unimplemented) ListCreditLedgerEntries

func (_ Unimplemented) ListCreditLedgerEntries(w http.ResponseWriter, r *http.Request, customerId string, params ListCreditLedgerEntriesParams)

List a customer's credit ledger (GET /v1/credits/ledger/{customer_id})

func (Unimplemented) ListCreditNotes

func (_ Unimplemented) ListCreditNotes(w http.ResponseWriter, r *http.Request, params ListCreditNotesParams)

List credit notes (GET /v1/credit-notes)

func (Unimplemented) ListCustomerPaymentMethods

func (_ Unimplemented) ListCustomerPaymentMethods(w http.ResponseWriter, r *http.Request, customerId string, params ListCustomerPaymentMethodsParams)

List the customer's payment methods (GET /v1/customers/{customer_id}/payment-methods)

func (Unimplemented) ListCustomerSentEmails

func (_ Unimplemented) ListCustomerSentEmails(w http.ResponseWriter, r *http.Request, id string, params ListCustomerSentEmailsParams)

List emails sent to the customer (GET /v1/customers/{id}/sent-emails)

func (Unimplemented) ListCustomers added in v0.9.2

func (_ Unimplemented) ListCustomers(w http.ResponseWriter, r *http.Request, params ListCustomersParams)

List customers (GET /v1/customers)

func (Unimplemented) ListDunningPolicies

func (_ Unimplemented) ListDunningPolicies(w http.ResponseWriter, r *http.Request, params ListDunningPoliciesParams)

List dunning policies (GET /v1/dunning/policies)

func (Unimplemented) ListDunningRuns

func (_ Unimplemented) ListDunningRuns(w http.ResponseWriter, r *http.Request, params ListDunningRunsParams)

List dunning runs (GET /v1/dunning/runs)

func (Unimplemented) ListHeldUsage

func (_ Unimplemented) ListHeldUsage(w http.ResponseWriter, r *http.Request)

List held usage (GET /v1/usage-events/held)

func (Unimplemented) ListInvoiceDisputes

func (_ Unimplemented) ListInvoiceDisputes(w http.ResponseWriter, r *http.Request, id string, params ListInvoiceDisputesParams)

List the card disputes on an invoice (GET /v1/invoices/{id}/disputes)

func (Unimplemented) ListInvoiceStripeRefunds added in v0.9.2

func (_ Unimplemented) ListInvoiceStripeRefunds(w http.ResponseWriter, r *http.Request, id string, params ListInvoiceStripeRefundsParams)

List the refunds made in Stripe on an invoice (GET /v1/invoices/{id}/stripe-refunds)

func (Unimplemented) ListInvoices added in v0.9.2

func (_ Unimplemented) ListInvoices(w http.ResponseWriter, r *http.Request, params ListInvoicesParams)

List invoices (GET /v1/invoices)

func (Unimplemented) ListMembers

func (_ Unimplemented) ListMembers(w http.ResponseWriter, r *http.Request)

List team members and invitations (GET /v1/members)

func (Unimplemented) ListMeters added in v0.9.2

func (_ Unimplemented) ListMeters(w http.ResponseWriter, r *http.Request, params ListMetersParams)

List meters (GET /v1/meters)

func (Unimplemented) ListPlanPrices

func (_ Unimplemented) ListPlanPrices(w http.ResponseWriter, r *http.Request, id string, params ListPlanPricesParams)

List a plan's prices (GET /v1/plans/{id}/prices)

func (Unimplemented) ListPlans added in v0.9.2

func (_ Unimplemented) ListPlans(w http.ResponseWriter, r *http.Request, params ListPlansParams)

List plans (GET /v1/plans)

func (Unimplemented) ListPriceOverrides

func (_ Unimplemented) ListPriceOverrides(w http.ResponseWriter, r *http.Request, params ListPriceOverridesParams)

List active price overrides (GET /v1/price-overrides)

func (Unimplemented) ListProviderCosts added in v0.9.2

func (_ Unimplemented) ListProviderCosts(w http.ResponseWriter, r *http.Request, params ListProviderCostsParams)

List provider cost rates (GET /v1/provider-costs)

func (Unimplemented) ListRecipeInstances

func (_ Unimplemented) ListRecipeInstances(w http.ResponseWriter, r *http.Request, params ListRecipeInstancesParams)

List installed recipes (GET /v1/recipes/instances)

func (Unimplemented) ListRecipes

func (_ Unimplemented) ListRecipes(w http.ResponseWriter, r *http.Request, params ListRecipesParams)

List recipes (GET /v1/recipes)

func (Unimplemented) ListStripeConnections

func (_ Unimplemented) ListStripeConnections(w http.ResponseWriter, r *http.Request)

List Stripe connections (GET /v1/settings/stripe)

func (Unimplemented) ListSubscriptions added in v0.9.2

func (_ Unimplemented) ListSubscriptions(w http.ResponseWriter, r *http.Request, params ListSubscriptionsParams)

List subscriptions (GET /v1/subscriptions)

func (Unimplemented) ListTestClockCustomers

func (_ Unimplemented) ListTestClockCustomers(w http.ResponseWriter, r *http.Request, id string, params ListTestClockCustomersParams)

List customers attached to a test clock (GET /v1/test-clocks/{id}/customers)

func (Unimplemented) ListTestClockSubscriptions added in v0.9.2

func (_ Unimplemented) ListTestClockSubscriptions(w http.ResponseWriter, r *http.Request, id string, params ListTestClockSubscriptionsParams)

List a test clock's subscriptions (GET /v1/test-clocks/{id}/subscriptions)

func (Unimplemented) ListTestClocks added in v0.9.2

func (_ Unimplemented) ListTestClocks(w http.ResponseWriter, r *http.Request, params ListTestClocksParams)

List test clocks (GET /v1/test-clocks)

func (Unimplemented) ListUsageEvents added in v0.9.2

func (_ Unimplemented) ListUsageEvents(w http.ResponseWriter, r *http.Request, params ListUsageEventsParams)

List usage events (GET /v1/usage-events)

func (Unimplemented) ListWebhookEndpointDeliveries

func (_ Unimplemented) ListWebhookEndpointDeliveries(w http.ResponseWriter, r *http.Request, id string, params ListWebhookEndpointDeliveriesParams)

List an endpoint's deliveries (GET /v1/webhook-endpoints/endpoints/{id}/deliveries)

func (Unimplemented) ListWebhookEndpoints added in v0.9.2

func (_ Unimplemented) ListWebhookEndpoints(w http.ResponseWriter, r *http.Request, params ListWebhookEndpointsParams)

List webhook endpoints (GET /v1/webhook-endpoints/endpoints)

func (Unimplemented) ListWebhookEventDeliveries

func (_ Unimplemented) ListWebhookEventDeliveries(w http.ResponseWriter, r *http.Request, id string)

List all deliveries of an event and its replays (GET /v1/webhook_events/{id}/deliveries)

func (Unimplemented) ListWebhookEvents added in v0.9.2

func (_ Unimplemented) ListWebhookEvents(w http.ResponseWriter, r *http.Request, params ListWebhookEventsParams)

List webhook events (GET /v1/webhook-endpoints/events)

func (Unimplemented) Login added in v0.9.2

func (_ Unimplemented) Login(w http.ResponseWriter, r *http.Request)

Sign in to the dashboard with email and password (POST /v1/auth/login)

func (Unimplemented) Logout added in v0.9.2

func (_ Unimplemented) Logout(w http.ResponseWriter, r *http.Request)

Sign out of the dashboard (POST /v1/auth/logout)

func (Unimplemented) MarkInvoiceUncollectible

func (_ Unimplemented) MarkInvoiceUncollectible(w http.ResponseWriter, r *http.Request, id string, params MarkInvoiceUncollectibleParams)

Write off an invoice as uncollectible (POST /v1/invoices/{id}/mark-uncollectible)

func (Unimplemented) PauseSubscriptionCollection

func (_ Unimplemented) PauseSubscriptionCollection(w http.ResponseWriter, r *http.Request, id string, params PauseSubscriptionCollectionParams)

Pause collection (PUT /v1/subscriptions/{id}/pause-collection)

func (Unimplemented) PreviewRecipe

func (_ Unimplemented) PreviewRecipe(w http.ResponseWriter, r *http.Request, key string, params PreviewRecipeParams)

Preview a recipe (POST /v1/recipes/{key}/preview)

func (Unimplemented) ReceivePostmarkWebhook

func (_ Unimplemented) ReceivePostmarkWebhook(w http.ResponseWriter, r *http.Request)

Receive a Postmark delivery webhook (POST /v1/webhooks/postmark)

func (Unimplemented) ReceiveStripeWebhook

func (_ Unimplemented) ReceiveStripeWebhook(w http.ResponseWriter, r *http.Request, endpointId string, params ReceiveStripeWebhookParams)

Receive a Stripe webhook (POST /v1/webhooks/stripe/{endpoint_id})

func (Unimplemented) RecordInvoicePayment

func (_ Unimplemented) RecordInvoicePayment(w http.ResponseWriter, r *http.Request, id string, params RecordInvoicePaymentParams)

Record a payment made outside Stripe (POST /v1/invoices/{id}/record-payment)

func (Unimplemented) RefundInvoice

func (_ Unimplemented) RefundInvoice(w http.ResponseWriter, r *http.Request, id string, params RefundInvoiceParams)

Refund a paid invoice (POST /v1/invoices/{id}/refund)

func (Unimplemented) ReleaseHeldUsage

func (_ Unimplemented) ReleaseHeldUsage(w http.ResponseWriter, r *http.Request)

Release held usage (POST /v1/usage-events/held/release)

func (Unimplemented) RemoveMember

func (_ Unimplemented) RemoveMember(w http.ResponseWriter, r *http.Request, userID string)

Remove a member from the account (DELETE /v1/members/{userID})

func (Unimplemented) RemovePlanPrice

func (_ Unimplemented) RemovePlanPrice(w http.ResponseWriter, r *http.Request, id string, priceId string)

Remove a price from a plan (DELETE /v1/plans/{id}/prices/{price_id})

func (Unimplemented) RemoveSubscriptionItem

func (_ Unimplemented) RemoveSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, itemID string)

Remove a subscription item (DELETE /v1/subscriptions/{id}/items/{itemID})

func (Unimplemented) ReplayWebhookDelivery

func (_ Unimplemented) ReplayWebhookDelivery(w http.ResponseWriter, r *http.Request, id string, deliveryID string, params ReplayWebhookDeliveryParams)

Resend one delivery to its endpoint (POST /v1/webhook-endpoints/endpoints/{id}/deliveries/{deliveryID}/replay)

func (Unimplemented) ReplayWebhookEvent

func (_ Unimplemented) ReplayWebhookEvent(w http.ResponseWriter, r *http.Request, id string, params ReplayWebhookEventParams)

Replay an event to all matching endpoints (POST /v1/webhook_events/{id}/replay)

func (Unimplemented) RequestPasswordReset added in v0.9.2

func (_ Unimplemented) RequestPasswordReset(w http.ResponseWriter, r *http.Request)

Request a password reset link (POST /v1/auth/password-reset/request)

func (_ Unimplemented) ResendInvoiceSetupLink(w http.ResponseWriter, r *http.Request, id string, params ResendInvoiceSetupLinkParams)

Resend the payment-method setup link (POST /v1/invoices/{id}/resend-setup-link)

func (Unimplemented) ResolveDunningRun

func (_ Unimplemented) ResolveDunningRun(w http.ResponseWriter, r *http.Request, id string, params ResolveDunningRunParams)

Resolve a dunning run (POST /v1/dunning/runs/{id}/resolve)

func (Unimplemented) ResumeSubscriptionCollection

func (_ Unimplemented) ResumeSubscriptionCollection(w http.ResponseWriter, r *http.Request, id string)

Resume collection (DELETE /v1/subscriptions/{id}/pause-collection)

func (Unimplemented) RetryCreditNoteRefund

func (_ Unimplemented) RetryCreditNoteRefund(w http.ResponseWriter, r *http.Request, id string, params RetryCreditNoteRefundParams)

Retry a failed credit-note refund (POST /v1/credit-notes/{id}/retry-refund)

func (Unimplemented) RetryInvoiceTax added in v0.9.2

func (_ Unimplemented) RetryInvoiceTax(w http.ResponseWriter, r *http.Request, id string, params RetryInvoiceTaxParams)

Retry tax calculation on a draft invoice (POST /v1/invoices/{id}/retry-tax)

func (Unimplemented) RetrySubscriptionBilling added in v0.9.2

func (_ Unimplemented) RetrySubscriptionBilling(w http.ResponseWriter, r *http.Request, id string, params RetrySubscriptionBillingParams)

Retry a subscription's failed billing (POST /v1/subscriptions/{id}/retry-billing)

func (Unimplemented) RetryTestClockAdvance added in v0.9.2

func (_ Unimplemented) RetryTestClockAdvance(w http.ResponseWriter, r *http.Request, id string, params RetryTestClockAdvanceParams)

Retry a failed test clock advance (POST /v1/test-clocks/{id}/retry-advance)

func (Unimplemented) RevokeApiKey

func (_ Unimplemented) RevokeApiKey(w http.ResponseWriter, r *http.Request, id string)

Revoke an API key (DELETE /v1/api-keys/{id})

func (Unimplemented) RevokeMemberInvitation

func (_ Unimplemented) RevokeMemberInvitation(w http.ResponseWriter, r *http.Request, id string)

Revoke an invitation (DELETE /v1/members/invitations/{id})

func (Unimplemented) RotateApiKey

func (_ Unimplemented) RotateApiKey(w http.ResponseWriter, r *http.Request, id string, params RotateApiKeyParams)

Rotate an API key (POST /v1/api-keys/{id}/rotate)

func (Unimplemented) RotateCustomerCostDashboardToken added in v0.9.2

func (_ Unimplemented) RotateCustomerCostDashboardToken(w http.ResponseWriter, r *http.Request, id string, params RotateCustomerCostDashboardTokenParams)

Rotate the customer's public cost-dashboard link (POST /v1/customers/{id}/rotate-cost-dashboard-token)

func (Unimplemented) RotateInvoicePublicToken

func (_ Unimplemented) RotateInvoicePublicToken(w http.ResponseWriter, r *http.Request, id string, params RotateInvoicePublicTokenParams)

Replace the hosted invoice link (POST /v1/invoices/{id}/rotate-public-token)

func (Unimplemented) RotateWebhookEndpointSecret added in v0.9.2

func (_ Unimplemented) RotateWebhookEndpointSecret(w http.ResponseWriter, r *http.Request, id string, params RotateWebhookEndpointSecretParams)

Rotate a webhook endpoint's signing secret (POST /v1/webhook-endpoints/endpoints/{id}/rotate-secret)

func (Unimplemented) RunBilling added in v0.9.2

func (_ Unimplemented) RunBilling(w http.ResponseWriter, r *http.Request, params RunBillingParams)

Run billing now (POST /v1/billing/run)

func (Unimplemented) ScheduleSubscriptionCancel

func (_ Unimplemented) ScheduleSubscriptionCancel(w http.ResponseWriter, r *http.Request, id string, params ScheduleSubscriptionCancelParams)

Schedule a cancel (POST /v1/subscriptions/{id}/schedule-cancel)

func (Unimplemented) SendCreditNote added in v0.9.2

func (_ Unimplemented) SendCreditNote(w http.ResponseWriter, r *http.Request, id string, params SendCreditNoteParams)

Email a credit note to the customer (POST /v1/credit-notes/{id}/send)

func (Unimplemented) SendCustomerPaymentSetupEmail

func (_ Unimplemented) SendCustomerPaymentSetupEmail(w http.ResponseWriter, r *http.Request, customerId string, params SendCustomerPaymentSetupEmailParams)

Email the customer a link to add a payment method (POST /v1/customers/{customer_id}/payment-methods/send-setup-email)

func (Unimplemented) SendInvoice added in v0.9.2

func (_ Unimplemented) SendInvoice(w http.ResponseWriter, r *http.Request, id string, params SendInvoiceParams)

Email an invoice to the customer (POST /v1/invoices/{id}/send)

func (Unimplemented) SendTestEmail

func (_ Unimplemented) SendTestEmail(w http.ResponseWriter, r *http.Request, params SendTestEmailParams)

Send a test email (POST /v1/settings/email/test)

func (Unimplemented) SetCustomerDefaultPaymentMethod

func (_ Unimplemented) SetCustomerDefaultPaymentMethod(w http.ResponseWriter, r *http.Request, customerId string, pmid string, params SetCustomerDefaultPaymentMethodParams)

Make a payment method the default (POST /v1/customers/{customer_id}/payment-methods/{pmID}/default)

func (Unimplemented) SetDefaultDunningPolicy

func (_ Unimplemented) SetDefaultDunningPolicy(w http.ResponseWriter, r *http.Request, id string, params SetDefaultDunningPolicyParams)

Make a dunning policy the default (POST /v1/dunning/policies/{id}/set-default)

func (Unimplemented) SetStripeWebhookSecret

Set the Stripe webhook signing secret (PATCH /v1/settings/stripe/{mode}/webhook)

func (Unimplemented) SetSubscriptionBillingThresholds

func (_ Unimplemented) SetSubscriptionBillingThresholds(w http.ResponseWriter, r *http.Request, id string, params SetSubscriptionBillingThresholdsParams)

Set billing thresholds (PUT /v1/subscriptions/{id}/billing-thresholds)

func (Unimplemented) StreamWebhookEvents

func (_ Unimplemented) StreamWebhookEvents(w http.ResponseWriter, r *http.Request)

Stream webhook events as they happen (GET /v1/webhook_events/stream)

func (Unimplemented) SwitchSessionMode added in v0.9.2

func (_ Unimplemented) SwitchSessionMode(w http.ResponseWriter, r *http.Request)

Switch the dashboard session between test and live mode (POST /v1/auth/mode)

func (Unimplemented) UpdateCustomer

func (_ Unimplemented) UpdateCustomer(w http.ResponseWriter, r *http.Request, id string, params UpdateCustomerParams)

Update a customer (PATCH /v1/customers/{id})

func (Unimplemented) UpdateDunningPolicy

func (_ Unimplemented) UpdateDunningPolicy(w http.ResponseWriter, r *http.Request, id string, params UpdateDunningPolicyParams)

Replace a dunning policy's settings (PATCH /v1/dunning/policies/{id})

func (Unimplemented) UpdateMeter added in v0.9.2

func (_ Unimplemented) UpdateMeter(w http.ResponseWriter, r *http.Request, id string, params UpdateMeterParams)

Update a meter (PATCH /v1/meters/{id})

func (Unimplemented) UpdatePlan

func (_ Unimplemented) UpdatePlan(w http.ResponseWriter, r *http.Request, id string, params UpdatePlanParams)

Update a plan (PATCH /v1/plans/{id})

func (Unimplemented) UpdatePlanPrice

func (_ Unimplemented) UpdatePlanPrice(w http.ResponseWriter, r *http.Request, id string, priceId string, params UpdatePlanPriceParams)

Change a price's rate (PATCH /v1/plans/{id}/prices/{price_id})

func (Unimplemented) UpdateSubscriptionItem

func (_ Unimplemented) UpdateSubscriptionItem(w http.ResponseWriter, r *http.Request, id string, itemID string, params UpdateSubscriptionItemParams)

Change a subscription item (PATCH /v1/subscriptions/{id}/items/{itemID})

func (Unimplemented) UpdateTenantSettings

func (_ Unimplemented) UpdateTenantSettings(w http.ResponseWriter, r *http.Request, params UpdateTenantSettingsParams)

Update account settings (PUT /v1/settings)

func (Unimplemented) UpdateWebhookEndpoint added in v0.9.2

func (_ Unimplemented) UpdateWebhookEndpoint(w http.ResponseWriter, r *http.Request, id string, params UpdateWebhookEndpointParams)

Update a webhook endpoint (PATCH /v1/webhook-endpoints/endpoints/{id})

func (Unimplemented) UpsertCustomerBillingProfile

func (_ Unimplemented) UpsertCustomerBillingProfile(w http.ResponseWriter, r *http.Request, id string, params UpsertCustomerBillingProfileParams)

Create or replace the customer's billing profile (PUT /v1/customers/{id}/billing-profile)

func (Unimplemented) UpsertProviderCost added in v0.9.2

func (_ Unimplemented) UpsertProviderCost(w http.ResponseWriter, r *http.Request, params UpsertProviderCostParams)

Create or update a provider cost rate (PUT /v1/provider-costs)

func (Unimplemented) VoidCreditNote

func (_ Unimplemented) VoidCreditNote(w http.ResponseWriter, r *http.Request, id string, params VoidCreditNoteParams)

Void a draft credit note (POST /v1/credit-notes/{id}/void)

func (Unimplemented) VoidInvoice

func (_ Unimplemented) VoidInvoice(w http.ResponseWriter, r *http.Request, id string, params VoidInvoiceParams)

Void an invoice (POST /v1/invoices/{id}/void)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateCustomerJSONBody

type UpdateCustomerJSONBody struct {
	// AdditionalEmails The new CC list, which replaces the whole list. `[]`
	// clears it. Left out keeps the current list. More than 10
	// after deduplication is refused with 422.
	AdditionalEmails []string `json:"additional_emails,omitempty"`

	// DisplayName The new name. Spaces at the ends are trimmed. Empty or
	// left out keeps the current name. Unlike create, the
	// update does not check its length.
	DisplayName string `json:"display_name,omitempty"`

	// DunningPolicyId Policy ID, or `""` to use the account's default policy.
	DunningPolicyId string `json:"dunning_policy_id,omitempty"`

	// Email The new primary email, checked as on create. Empty or left
	// out keeps the current email.
	Email string `json:"email,omitempty"`

	// Status `archived` blocks new subscriptions for the customer.
	// `active` lifts that.
	Status UpdateCustomerJSONBodyStatus `json:"status,omitempty"`
}

UpdateCustomerJSONBody defines parameters for UpdateCustomer.

type UpdateCustomerJSONBodyStatus

type UpdateCustomerJSONBodyStatus string

UpdateCustomerJSONBodyStatus defines parameters for UpdateCustomer.

const (
	UpdateCustomerJSONBodyStatusActive   UpdateCustomerJSONBodyStatus = "active"
	UpdateCustomerJSONBodyStatusArchived UpdateCustomerJSONBodyStatus = "archived"
)

Defines values for UpdateCustomerJSONBodyStatus.

func (UpdateCustomerJSONBodyStatus) Valid

Valid indicates whether the value is a known member of the UpdateCustomerJSONBodyStatus enum.

type UpdateCustomerJSONRequestBody

type UpdateCustomerJSONRequestBody UpdateCustomerJSONBody

UpdateCustomerJSONRequestBody defines body for UpdateCustomer for application/json ContentType.

type UpdateCustomerParams

type UpdateCustomerParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateCustomerParams defines parameters for UpdateCustomer.

type UpdateDunningPolicyJSONRequestBody

type UpdateDunningPolicyJSONRequestBody = DunningPolicyInput

UpdateDunningPolicyJSONRequestBody defines body for UpdateDunningPolicy for application/json ContentType.

type UpdateDunningPolicyParams

type UpdateDunningPolicyParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateDunningPolicyParams defines parameters for UpdateDunningPolicy.

type UpdateMeterJSONBody added in v0.9.2

type UpdateMeterJSONBody struct {
	// Aggregation The new aggregation. Refused once the meter has a usage event.
	Aggregation UpdateMeterJSONBodyAggregation `json:"aggregation,omitempty"`

	// Name The new display name, at most 255 bytes (UTF-8) after
	// spaces at the ends are trimmed. It cannot be empty.
	Name string `json:"name,omitempty"`

	// Unit The new unit. Empty sets it to `unit`.
	Unit string `json:"unit,omitempty"`
}

UpdateMeterJSONBody defines parameters for UpdateMeter.

type UpdateMeterJSONBodyAggregation added in v0.9.2

type UpdateMeterJSONBodyAggregation string

UpdateMeterJSONBodyAggregation defines parameters for UpdateMeter.

Defines values for UpdateMeterJSONBodyAggregation.

func (UpdateMeterJSONBodyAggregation) Valid added in v0.9.2

Valid indicates whether the value is a known member of the UpdateMeterJSONBodyAggregation enum.

type UpdateMeterJSONRequestBody added in v0.9.2

type UpdateMeterJSONRequestBody UpdateMeterJSONBody

UpdateMeterJSONRequestBody defines body for UpdateMeter for application/json ContentType.

type UpdateMeterParams added in v0.9.2

type UpdateMeterParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateMeterParams defines parameters for UpdateMeter.

type UpdatePlanJSONBody

type UpdatePlanJSONBody struct {
	// BaseAmountCents 0 or more. Omit to keep the current base fee.
	BaseAmountCents int64 `json:"base_amount_cents,omitempty"`

	// BaseBillTiming When the base fee is billed. Omit to keep the current
	// timing. Refused once a subscription has used the plan.
	BaseBillTiming UpdatePlanJSONBodyBaseBillTiming `json:"base_bill_timing,omitempty"`

	// Description Whitespace is trimmed. Omit to keep the current
	// description; an empty string clears it.
	Description string `json:"description,omitempty"`

	// Name Whitespace is trimmed. Empty or omitted keeps the current
	// name. Unlike create, the update does not check its
	// length.
	Name string `json:"name,omitempty"`

	// Status `archived` stops new subscriptions and plan changes onto
	// the plan. `active` brings it back.
	Status UpdatePlanJSONBodyStatus `json:"status,omitempty"`

	// TaxCode A Stripe product tax code, `txcd_` and 8 digits. Omit to
	// keep the current code; an empty string clears it. See
	// `tax_code` on Plan for which invoice lines carry it.
	TaxCode string `json:"tax_code,omitempty"`
}

UpdatePlanJSONBody defines parameters for UpdatePlan.

type UpdatePlanJSONBodyBaseBillTiming

type UpdatePlanJSONBodyBaseBillTiming string

UpdatePlanJSONBodyBaseBillTiming defines parameters for UpdatePlan.

const (
	InAdvance UpdatePlanJSONBodyBaseBillTiming = "in_advance"
	InArrears UpdatePlanJSONBodyBaseBillTiming = "in_arrears"
)

Defines values for UpdatePlanJSONBodyBaseBillTiming.

func (UpdatePlanJSONBodyBaseBillTiming) Valid

Valid indicates whether the value is a known member of the UpdatePlanJSONBodyBaseBillTiming enum.

type UpdatePlanJSONBodyStatus

type UpdatePlanJSONBodyStatus string

UpdatePlanJSONBodyStatus defines parameters for UpdatePlan.

const (
	Active   UpdatePlanJSONBodyStatus = "active"
	Archived UpdatePlanJSONBodyStatus = "archived"
)

Defines values for UpdatePlanJSONBodyStatus.

func (UpdatePlanJSONBodyStatus) Valid

func (e UpdatePlanJSONBodyStatus) Valid() bool

Valid indicates whether the value is a known member of the UpdatePlanJSONBodyStatus enum.

type UpdatePlanJSONRequestBody

type UpdatePlanJSONRequestBody UpdatePlanJSONBody

UpdatePlanJSONRequestBody defines body for UpdatePlan for application/json ContentType.

type UpdatePlanParams

type UpdatePlanParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdatePlanParams defines parameters for UpdatePlan.

type UpdatePlanPriceJSONRequestBody

type UpdatePlanPriceJSONRequestBody = PriceShape

UpdatePlanPriceJSONRequestBody defines body for UpdatePlanPrice for application/json ContentType.

type UpdatePlanPriceParams

type UpdatePlanPriceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdatePlanPriceParams defines parameters for UpdatePlanPrice.

type UpdateSubscriptionItemJSONBody

type UpdateSubscriptionItemJSONBody struct {
	// Immediate Apply a plan change now instead of at the end of the period. Ignored for quantity changes.
	Immediate bool `json:"immediate,omitempty"`

	// NewPlanId The plan to move the item to. Must differ from the current one and use the same base-fee billing timing (in advance or in arrears).
	NewPlanId string `json:"new_plan_id,omitempty"`

	// Quantity The new quantity. Must differ from the current one.
	Quantity int64 `json:"quantity,omitempty"`
}

UpdateSubscriptionItemJSONBody defines parameters for UpdateSubscriptionItem.

type UpdateSubscriptionItemJSONRequestBody

type UpdateSubscriptionItemJSONRequestBody UpdateSubscriptionItemJSONBody

UpdateSubscriptionItemJSONRequestBody defines body for UpdateSubscriptionItem for application/json ContentType.

type UpdateSubscriptionItemParams

type UpdateSubscriptionItemParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateSubscriptionItemParams defines parameters for UpdateSubscriptionItem.

type UpdateTenantSettingsJSONRequestBody

type UpdateTenantSettingsJSONRequestBody = TenantSettingsInput

UpdateTenantSettingsJSONRequestBody defines body for UpdateTenantSettings for application/json ContentType.

type UpdateTenantSettingsParams

type UpdateTenantSettingsParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateTenantSettingsParams defines parameters for UpdateTenantSettings.

type UpdateWebhookEndpointJSONBody added in v0.9.2

type UpdateWebhookEndpointJSONBody struct {
	// Active False pauses the endpoint; true resumes it.
	Active bool `json:"active,omitempty"`

	// Description A new note. An empty string clears it.
	Description string `json:"description,omitempty"`

	// Events A new list of event types, replacing the old one. `[]` means every event.
	Events []string `json:"events,omitempty"`

	// Url A new URL, checked as on create. It cannot be empty.
	Url string `json:"url,omitempty"`
}

UpdateWebhookEndpointJSONBody defines parameters for UpdateWebhookEndpoint.

type UpdateWebhookEndpointJSONRequestBody added in v0.9.2

type UpdateWebhookEndpointJSONRequestBody UpdateWebhookEndpointJSONBody

UpdateWebhookEndpointJSONRequestBody defines body for UpdateWebhookEndpoint for application/json ContentType.

type UpdateWebhookEndpointParams added in v0.9.2

type UpdateWebhookEndpointParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpdateWebhookEndpointParams defines parameters for UpdateWebhookEndpoint.

type UpsertCustomerBillingProfileJSONRequestBody

type UpsertCustomerBillingProfileJSONRequestBody = CustomerBillingProfileInput

UpsertCustomerBillingProfileJSONRequestBody defines body for UpsertCustomerBillingProfile for application/json ContentType.

type UpsertCustomerBillingProfileParams

type UpsertCustomerBillingProfileParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpsertCustomerBillingProfileParams defines parameters for UpsertCustomerBillingProfile.

type UpsertProviderCostJSONBody added in v0.9.2

type UpsertProviderCostJSONBody struct {
	// Currency Rates are in USD only, the currency LiteLLM reports cost
	// in. Any other value is 422.
	Currency UpsertProviderCostJSONBodyCurrency `json:"currency,omitempty"`

	// Model The model, such as `claude-sonnet-4.5`, or a raw model
	// snapshot id. An event's `model_raw` label is matched
	// first, then its `model` label.
	Model string `json:"model"`

	// Provider The provider, such as `anthropic`. Stored in lower case;
	// it must equal the `provider` label of the usage events it
	// costs.
	Provider string `json:"provider"`

	// TokenType The kind of token, such as `input`, `output` or
	// `cache_read`. Stored in lower case; it must equal the
	// `token_type` label of the usage events it costs.
	TokenType string `json:"token_type"`

	// UnitCostCents US cents per token, as a decimal string (e.g. "0.0003" = $3.00 per 1,000,000 tokens). 0 or more, under 10^10, at most 12 decimal places (trailing zeros do not count), and at most 100 characters. A JSON number is also read.
	UnitCostCents string `json:"unit_cost_cents"`
}

UpsertProviderCostJSONBody defines parameters for UpsertProviderCost.

type UpsertProviderCostJSONBodyCurrency added in v0.9.2

type UpsertProviderCostJSONBodyCurrency string

UpsertProviderCostJSONBodyCurrency defines parameters for UpsertProviderCost.

const (
	UpsertProviderCostJSONBodyCurrencyUSD UpsertProviderCostJSONBodyCurrency = "USD"
)

Defines values for UpsertProviderCostJSONBodyCurrency.

func (UpsertProviderCostJSONBodyCurrency) Valid added in v0.9.2

Valid indicates whether the value is a known member of the UpsertProviderCostJSONBodyCurrency enum.

type UpsertProviderCostJSONRequestBody added in v0.9.2

type UpsertProviderCostJSONRequestBody UpsertProviderCostJSONBody

UpsertProviderCostJSONRequestBody defines body for UpsertProviderCost for application/json ContentType.

type UpsertProviderCostParams added in v0.9.2

type UpsertProviderCostParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

UpsertProviderCostParams defines parameters for UpsertProviderCost.

type UsageAggregate

type UsageAggregate struct {
	// ActiveCustomers Distinct customers among the matching events.
	ActiveCustomers int `json:"active_customers"`

	// ActiveMeters Distinct meters among the matching events.
	ActiveMeters int `json:"active_meters"`

	// ByMeter One row per meter, largest total first.
	ByMeter []struct {
		// Aggregation The meter's aggregation (`sum`, `count`, `max`, `last`),
		// which every price of the meter bills under. Empty when
		// unknown.
		Aggregation string `json:"aggregation"`

		// Customers Distinct customers with events on this meter.
		Customers int `json:"customers"`

		// Daily One entry per calendar day (in `tz`) with events, oldest first.
		Daily []struct {
			// Date The calendar day, `YYYY-MM-DD`, in `tz`.
			Date openapi_types.Date `json:"date"`

			// Value The day's usage under the meter's aggregation.
			Value string `json:"value"`
		} `json:"daily"`

		// Events Number of matching events on this meter.
		Events int `json:"events"`

		// MeterId The meter (`hc_mtr_…`).
		MeterId string `json:"meter_id"`

		// Peak Highest single reported quantity, as a decimal string.
		Peak string `json:"peak"`

		// Total Plain sum of reported quantities, as a decimal string.
		Total string `json:"total"`

		// Value Usage under the meter's aggregation, as a decimal string.
		// `max` and `last` take each customer's peak or latest
		// reading in the window and add them across customers.
		// Billing applies them per billing period.
		Value string `json:"value"`
	} `json:"by_meter"`

	// TotalEvents Number of matching events.
	TotalEvents int `json:"total_events"`

	// TotalUnits Sum of all matching quantities across meters, as a decimal
	// string. It adds different units and ignores each meter's
	// aggregation; use `by_meter[].value` instead.
	TotalUnits string `json:"total_units"`
}

UsageAggregate Totals over every usage event that matches the filters of `GET /v1/usage-events/aggregate`, with one row per meter.

type UsageBillingStatus

type UsageBillingStatus string

UsageBillingStatus What Hardcount found when the event arrived. It checked the event against the customer's subscriptions, the plans and prices in force, and the invoices already built at that moment. Sent only on the answer that wrote the event; the event is stored all the same.

A status that is present was true at that moment:

  • `after_close`: the event's time is already invoiced. A spend-threshold invoice counts only once it is paid. Bill the event with a one-off invoice if it should be charged.
  • `not_on_plan`: a billing period not invoiced yet holds the event's time, but its plan has no price for this meter.
  • `outside_subscription`: no active or trialing subscription of the customer bills the event's time. For example, it has none, or the time is before one starts, in a free trial, or after one ends or its scheduled cancel.
  • `no_price`: the plan that bills the event's time prices this meter, but no price of that plan takes the event's `dimensions`. A price takes an event whose dimensions include all of its `dimension_match`, compared as strings: the number `1` is not the string `"1"`.

No `billing_status` means Hardcount found no reason then. It is not a promise that the event will be billed. Hardcount checks only the customer's current billing periods: time after a period end whose invoice is not built yet is not checked, nor is time after a trial's end before Hardcount ends the trial. A later change can change the outcome either way: a subscription created, activated or changed, a trial extended, a scheduled cancel undone, or a price added. The invoice is the final answer.

Two cases can make a present status wrong: a price change whose save began before a billing period started and finished after the request read the prices, and a subscription change saved while the request is in flight. Absent on a replay and on a read.

const (
	AfterClose          UsageBillingStatus = "after_close"
	NoPrice             UsageBillingStatus = "no_price"
	NotOnPlan           UsageBillingStatus = "not_on_plan"
	OutsideSubscription UsageBillingStatus = "outside_subscription"
)

Defines values for UsageBillingStatus.

func (UsageBillingStatus) Valid

func (e UsageBillingStatus) Valid() bool

Valid indicates whether the value is a known member of the UsageBillingStatus enum.

type UsageEvent

type UsageEvent struct {
	// BillingStatus What Hardcount found when the event arrived. It checked the event
	// against the customer's subscriptions, the plans and prices in force,
	// and the invoices already built at that moment. Sent only on the
	// answer that wrote the event; the event is stored all the same.
	//
	// A status that is present was true at that moment:
	//
	// - `after_close`: the event's time is already invoiced. A
	//   spend-threshold invoice counts only once it is paid. Bill the
	//   event with a one-off invoice if it should be charged.
	// - `not_on_plan`: a billing period not invoiced yet holds the event's
	//   time, but its plan has no price for this meter.
	// - `outside_subscription`: no active or trialing subscription of the
	//   customer bills the event's time. For example, it has none, or the
	//   time is before one starts, in a free trial, or after one ends or
	//   its scheduled cancel.
	// - `no_price`: the plan that bills the event's time prices this
	//   meter, but no price of that plan takes the event's `dimensions`.
	//   A price takes an event whose dimensions include all of its
	//   `dimension_match`, compared as strings: the number `1` is not the
	//   string `"1"`.
	//
	// No `billing_status` means Hardcount found no reason then. It is not a
	// promise that the event will be billed. Hardcount checks only the
	// customer's current billing periods: time after a period end whose
	// invoice is not built yet is not checked, nor is time after a trial's
	// end before Hardcount ends the trial. A later change can change the
	// outcome either way: a subscription created, activated or changed, a
	// trial extended, a scheduled cancel undone, or a price added. The
	// invoice is the final answer.
	//
	// Two cases can make a present status wrong: a price change whose
	// save began before a billing period started and finished after the
	// request read the prices, and a subscription change saved while the
	// request is in flight. Absent on a replay and on a read.
	BillingStatus UsageBillingStatus `json:"billing_status,omitempty"`

	// CustomerId The customer the event was recorded for (`hc_cus_…`): the
	// customer whose `external_id` you sent as
	// `external_customer_id`.
	CustomerId string `json:"customer_id"`

	// Dimensions The dimension values sent with the event. Absent when none were sent.
	Dimensions map[string]interface{} `json:"dimensions,omitempty"`

	// Id The event's ID (`hc_evt_…`).
	Id string `json:"id"`

	// IdempotencyKey The key the event was sent with. Hardcount keeps one event per
	// key in each account and mode (live or test), with no expiry: an
	// event sent later with the same key is not stored again, however
	// long after. Absent on an event stored without a key.
	IdempotencyKey string `json:"idempotency_key,omitempty"`

	// MeterId The meter the event counts toward (`hc_mtr_…`): the meter whose
	// `event_name` you sent.
	MeterId string `json:"meter_id"`

	// Origin How the event arrived. `api`: `POST /v1/usage-events`, the batch
	// route or the LiteLLM integration. `backfill`:
	// `POST /v1/usage-events/backfill`, or released held usage.
	// Absent on the rows of `GET /v1/usage-events`, which does not
	// return it.
	Origin UsageEventOrigin `json:"origin,omitempty"`

	// ProviderCostCents What serving this event cost you at your provider, in US cents as
	// a decimal string (e.g. "0.45"), set when the event arrived: from
	// your provider cost rates, or the cost LiteLLM reported for the
	// call (see `provider_cost_source`). Absent when no rate matched
	// or the cost was too large to store, and when the source is
	// `not_applicable`.
	ProviderCostCents string `json:"provider_cost_cents,omitempty"`

	// ProviderCostSource Where `provider_cost_cents` came from: `table` (your provider
	// cost rates), `observed` (the cost LiteLLM reported for the
	// call), or `not_applicable`: the event lacks a `provider` or
	// `token_type` dimension, or has neither `model` nor `model_raw`,
	// so no rate can apply. Absent when the event has those
	// dimensions but no rate matched.
	ProviderCostSource UsageEventProviderCostSource `json:"provider_cost_source,omitempty"`

	// Quantity Exact quantity as a decimal string (e.g. "1.5").
	Quantity string `json:"quantity"`

	// TenantId The account the event belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// Timestamp When the usage happened. It decides which billing period the
	// event counts toward. An event sent without `timestamp` is
	// stamped with the time Hardcount received it, or, for a customer
	// on a test clock, with the clock's time. A live event may be at
	// most 5 minutes ahead of that time. There is no limit on how far
	// back it goes, but an event in a period whose invoice is already
	// built is stored and not billed (see `billing_status`).
	Timestamp time.Time `json:"timestamp"`
}

UsageEvent One usage event: a quantity of one meter's usage, for one customer, at one time. Returned by `POST /v1/usage-events` and `POST /v1/usage-events/backfill`, and listed by `GET /v1/usage-events`. An event counts toward the billing period its `timestamp` falls in.

type UsageEventBatchEventResult

type UsageEventBatchEventResult struct {
	// BillingStatus What Hardcount found when the event arrived. It checked the event
	// against the customer's subscriptions, the plans and prices in force,
	// and the invoices already built at that moment. Sent only on the
	// answer that wrote the event; the event is stored all the same.
	//
	// A status that is present was true at that moment:
	//
	// - `after_close`: the event's time is already invoiced. A
	//   spend-threshold invoice counts only once it is paid. Bill the
	//   event with a one-off invoice if it should be charged.
	// - `not_on_plan`: a billing period not invoiced yet holds the event's
	//   time, but its plan has no price for this meter.
	// - `outside_subscription`: no active or trialing subscription of the
	//   customer bills the event's time. For example, it has none, or the
	//   time is before one starts, in a free trial, or after one ends or
	//   its scheduled cancel.
	// - `no_price`: the plan that bills the event's time prices this
	//   meter, but no price of that plan takes the event's `dimensions`.
	//   A price takes an event whose dimensions include all of its
	//   `dimension_match`, compared as strings: the number `1` is not the
	//   string `"1"`.
	//
	// No `billing_status` means Hardcount found no reason then. It is not a
	// promise that the event will be billed. Hardcount checks only the
	// customer's current billing periods: time after a period end whose
	// invoice is not built yet is not checked, nor is time after a trial's
	// end before Hardcount ends the trial. A later change can change the
	// outcome either way: a subscription created, activated or changed, a
	// trial extended, a scheduled cancel undone, or a price added. The
	// invoice is the final answer.
	//
	// Two cases can make a present status wrong: a price change whose
	// save began before a billing period started and finished after the
	// request read the prices, and a subscription change saved while the
	// request is in flight. Absent on a replay and on a read.
	BillingStatus UsageBillingStatus `json:"billing_status,omitempty"`

	// Status `ingested`: the batch wrote the event. `deduplicated`: an event
	// with its `idempotency_key` was already stored, earlier or in
	// this batch, so it was not stored again.
	Status UsageEventBatchEventResultStatus `json:"status"`
}

UsageEventBatchEventResult What the batch did with one of its events.

type UsageEventBatchEventResultStatus

type UsageEventBatchEventResultStatus string

UsageEventBatchEventResultStatus `ingested`: the batch wrote the event. `deduplicated`: an event with its `idempotency_key` was already stored, earlier or in this batch, so it was not stored again.

const (
	Deduplicated UsageEventBatchEventResultStatus = "deduplicated"
	Ingested     UsageEventBatchEventResultStatus = "ingested"
)

Defines values for UsageEventBatchEventResultStatus.

func (UsageEventBatchEventResultStatus) Valid

Valid indicates whether the value is a known member of the UsageEventBatchEventResultStatus enum.

type UsageEventBatchResult

type UsageEventBatchResult struct {
	// AfterClose Of `ingested`, the events answered `billing_status` `after_close`.
	AfterClose int `json:"after_close"`

	// Deduplicated Idempotency replays — already ingested, counted as success.
	Deduplicated int `json:"deduplicated"`

	// Ingested Newly written events.
	Ingested int `json:"ingested"`

	// NoPrice Of `ingested`, the events answered `billing_status` `no_price`.
	NoPrice int `json:"no_price"`

	// NotOnPlan Of `ingested`, the events answered `billing_status` `not_on_plan`.
	NotOnPlan int `json:"not_on_plan"`

	// OutsideSubscription Of `ingested`, the events answered `billing_status` `outside_subscription`.
	OutsideSubscription int `json:"outside_subscription"`

	// Results One entry per event, in the order sent: `results[i]` is the
	// request's event `i`.
	Results []UsageEventBatchEventResult `json:"results"`

	// Total Events in the request.
	Total int `json:"total"`
}

UsageEventBatchResult What `POST /v1/usage-events/batch` wrote: how many events were new, how many were already stored, and one result per event in the order sent.

type UsageEventOrigin

type UsageEventOrigin string

UsageEventOrigin How the event arrived. `api`: `POST /v1/usage-events`, the batch route or the LiteLLM integration. `backfill`: `POST /v1/usage-events/backfill`, or released held usage. Absent on the rows of `GET /v1/usage-events`, which does not return it.

const (
	Api      UsageEventOrigin = "api"
	Backfill UsageEventOrigin = "backfill"
)

Defines values for UsageEventOrigin.

func (UsageEventOrigin) Valid

func (e UsageEventOrigin) Valid() bool

Valid indicates whether the value is a known member of the UsageEventOrigin enum.

type UsageEventProviderCostSource

type UsageEventProviderCostSource string

UsageEventProviderCostSource Where `provider_cost_cents` came from: `table` (your provider cost rates), `observed` (the cost LiteLLM reported for the call), or `not_applicable`: the event lacks a `provider` or `token_type` dimension, or has neither `model` nor `model_raw`, so no rate can apply. Absent when the event has those dimensions but no rate matched.

const (
	NotApplicable UsageEventProviderCostSource = "not_applicable"
	Observed      UsageEventProviderCostSource = "observed"
	Table         UsageEventProviderCostSource = "table"
)

Defines values for UsageEventProviderCostSource.

func (UsageEventProviderCostSource) Valid

Valid indicates whether the value is a known member of the UsageEventProviderCostSource enum.

type VoidCreditNoteParams

type VoidCreditNoteParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

VoidCreditNoteParams defines parameters for VoidCreditNote.

type VoidInvoiceParams

type VoidInvoiceParams struct {
	// IdempotencyKey Makes the call safe to retry. Send a unique value (a UUID works) and
	// the same value on every retry. Keys are kept per account and mode.
	// For 24 hours, a repeat with the same key, method, path and body gets
	// the first response again, byte for byte, with an
	// `Idempotent-Replayed: true` header, instead of running again. A
	// first answer of 409 or 422 is not kept, so a retry with the same
	// key runs again. A repeat sent while the first request is still
	// running waits up to 5 seconds for its answer; if there is none by
	// then, it gets 409 with code `conflict_idempotency`. The same key
	// with a different method, path or body is a 422 with code
	// `idempotency_error`. The other error cases are in
	// [Idempotency](https://gethardcount.com/docs/api/idempotency/). The usage routes do
	// not take it: each usage event carries its own `idempotency_key`.
	IdempotencyKey IdempotencyKey `json:"Idempotency-Key,omitempty"`
}

VoidInvoiceParams defines parameters for VoidInvoice.

type WebhookDeliveryReplayResult

type WebhookDeliveryReplayResult struct {
	// DeliveryId The new delivery to this endpoint.
	DeliveryId string `json:"delivery_id"`

	// EventId The new event created by the replay.
	EventId string `json:"event_id"`

	// ReplayOf The original event.
	ReplayOf string `json:"replay_of"`

	// Status Always `queued`. The send happens in the background.
	Status WebhookDeliveryReplayResultStatus `json:"status"`
}

WebhookDeliveryReplayResult What `POST /v1/webhook-endpoints/endpoints/{id}/deliveries/{deliveryID}/replay` returns.

type WebhookDeliveryReplayResultStatus

type WebhookDeliveryReplayResultStatus string

WebhookDeliveryReplayResultStatus Always `queued`. The send happens in the background.

const (
	WebhookDeliveryReplayResultStatusQueued WebhookDeliveryReplayResultStatus = "queued"
)

Defines values for WebhookDeliveryReplayResultStatus.

func (WebhookDeliveryReplayResultStatus) Valid

Valid indicates whether the value is a known member of the WebhookDeliveryReplayResultStatus enum.

type WebhookEndpoint

type WebhookEndpoint struct {
	// Active False while the endpoint is paused. A paused endpoint gets no
	// new events, its pending retries end as `failed`, and its
	// deliveries cannot be resent.
	Active bool `json:"active"`

	// CreatedAt When the endpoint was created.
	CreatedAt time.Time `json:"created_at"`

	// Description Your note about the endpoint. Absent when empty.
	Description string `json:"description,omitempty"`

	// Events The event types the endpoint gets. `*` means every event, and a
	// prefix such as `invoice.*` means every event whose type starts
	// with `invoice.`.
	Events []string `json:"events"`

	// Id The endpoint's id (`hc_whe_…`).
	Id string `json:"id"`

	// Livemode The mode the endpoint gets events from, true for live. It is the caller's mode when the endpoint is created.
	Livemode bool `json:"livemode"`

	// SecondarySecretExpiresAt When the previous secret stops signing deliveries, 72 hours
	// after the rotation. It stays in the answer after that time.
	// Absent if the secret was never rotated.
	SecondarySecretExpiresAt time.Time `json:"secondary_secret_expires_at,omitempty"`

	// SecondarySecretLast4 Last 4 characters of the previous signing secret, after a
	// rotation. Absent if the secret was never rotated.
	SecondarySecretLast4 string `json:"secondary_secret_last4,omitempty"`

	// SecretLast4 Last 4 characters of the current signing secret.
	SecretLast4 string `json:"secret_last4"`

	// TenantId The account the endpoint belongs to.
	TenantId string `json:"tenant_id,omitempty"`

	// UpdatedAt When the endpoint last changed.
	UpdatedAt time.Time `json:"updated_at"`

	// Url Where Hardcount POSTs each event. It must be `https://` on a
	// public address. Outside production (`APP_ENV` is not
	// `production`), a `localhost` or loopback URL works too, over
	// `http://` or `https://`. Each delivery checks the address again,
	// so a host that later points to a private address is not called.
	Url string `json:"url"`
}

WebhookEndpoint A URL that Hardcount sends webhook events to, for one mode. Its signing secret is never returned here: only creating the endpoint and rotating its secret show it, once.

type WebhookEndpointCreated

type WebhookEndpointCreated struct {
	// Endpoint A URL that Hardcount sends webhook events to, for one mode. Its
	// signing secret is never returned here: only creating the endpoint
	// and rotating its secret show it, once.
	Endpoint WebhookEndpoint `json:"endpoint"`

	// Secret The signing secret (`whsec_…`). Store it now; Hardcount does not show it again.
	Secret string `json:"secret"`
}

WebhookEndpointCreated A new webhook endpoint and its signing secret. The secret is shown only here.

type WebhookEndpointDelivery

type WebhookEndpointDelivery struct {
	// AttemptCount Attempts made so far, at most 6.
	AttemptCount int `json:"attempt_count"`

	// CompletedAt When the delivery succeeded or failed for good. null while pending.
	CompletedAt time.Time `json:"completed_at"`

	// CreatedAt When the delivery was queued.
	CreatedAt time.Time `json:"created_at"`

	// Error Why an attempt failed, such as `HTTP 500`, a connection error,
	// `endpoint disabled` or `endpoint deleted`. Empty when no attempt
	// failed. A delivery that succeeded on a retry keeps the earlier
	// failure's text.
	Error string `json:"error"`

	// EventId The event this delivery sent. For a replay, the replay's own id; the message itself carried the original event's `id`.
	EventId string `json:"event_id"`

	// EventType The event's type, such as `invoice.finalized`.
	EventType string `json:"event_type"`

	// Id The delivery's id (`hc_whd_…`).
	Id string `json:"id"`

	// IsReplay The delivery came from a replay.
	IsReplay bool `json:"is_replay"`

	// NextRetryAt While pending, when the next attempt is due. While an attempt is
	// running, it is when a retry takes over if that attempt never
	// finishes. null once the delivery is finished.
	NextRetryAt time.Time `json:"next_retry_at"`

	// ReplayOfEventId The original event, when `is_replay` is true. Absent otherwise.
	ReplayOfEventId string `json:"replay_of_event_id,omitempty"`

	// ResponseBody Up to the first 1 KB of the receiver's latest answer.
	ResponseBody string `json:"response_body"`

	// Status `pending` while an attempt is running or due, `succeeded` after
	// a 2xx answer, `failed` once no attempt is left or the endpoint
	// was paused or deleted.
	Status WebhookEndpointDeliveryStatus `json:"status"`

	// StatusCode HTTP status from the receiver's latest answer. 0 when no attempt got an answer.
	StatusCode int `json:"status_code"`
}

WebhookEndpointDelivery One delivery of one event to one endpoint, with the result of its latest attempt. A failed attempt is tried again after about 1 minute, 5 minutes, 30 minutes, 2 hours and 24 hours. After the sixth failed attempt the delivery is `failed`. A redirect counts as a failure.

type WebhookEndpointDeliveryStatus

type WebhookEndpointDeliveryStatus string

WebhookEndpointDeliveryStatus `pending` while an attempt is running or due, `succeeded` after a 2xx answer, `failed` once no attempt is left or the endpoint was paused or deleted.

const (
	WebhookEndpointDeliveryStatusFailed    WebhookEndpointDeliveryStatus = "failed"
	WebhookEndpointDeliveryStatusPending   WebhookEndpointDeliveryStatus = "pending"
	WebhookEndpointDeliveryStatusSucceeded WebhookEndpointDeliveryStatus = "succeeded"
)

Defines values for WebhookEndpointDeliveryStatus.

func (WebhookEndpointDeliveryStatus) Valid

Valid indicates whether the value is a known member of the WebhookEndpointDeliveryStatus enum.

type WebhookEndpointStats

type WebhookEndpointStats struct {
	// EndpointId The endpoint's id. It can name a deleted endpoint.
	EndpointId string `json:"endpoint_id"`

	// Failed Deliveries that failed for good.
	Failed int `json:"failed"`

	// Succeeded Deliveries that got a 2xx answer.
	Succeeded int `json:"succeeded"`

	// SuccessRate Percent (0-100) of finished deliveries that succeeded. Pending deliveries are not counted. 0 when none finished.
	SuccessRate float32 `json:"success_rate"`

	// TotalDeliveries All deliveries, including pending ones.
	TotalDeliveries int `json:"total_deliveries"`
}

WebhookEndpointStats All-time delivery counts for one endpoint in the caller's mode, from `GET /v1/webhook-endpoints/endpoints/stats`.

type WebhookEvent

type WebhookEvent struct {
	// CreatedAt When the event was created.
	CreatedAt time.Time `json:"created_at"`

	// EventType What happened, such as `invoice.finalized`. [Webhook events](https://gethardcount.com/docs/api/webhook-events/) lists every type.
	EventType string `json:"event_type"`

	// Id The event's id (`hc_whevt_…`). A replay has its own id but is sent with the original event's `id` and `created_at`.
	Id string `json:"id"`

	// Livemode The mode the event happened in. Only endpoints of the same mode get it.
	Livemode bool `json:"livemode"`

	// Payload The event's data: the resource the event is about, under the
	// resource's name (`invoice`, `subscription`, `customer`,
	// `payment_method`, `dunning_run` or `credit_balance`), as the
	// API returns it, and the few keys the event adds beside it.
	// [Webhook events](https://gethardcount.com/docs/api/webhook-events/) lists what each
	// event carries;
	// `payment.dispute_opened` and `payment.dispute_closed` carry a
	// `DisputeWebhookEventData`; `payment.refunded_in_stripe` carries a
	// `StripeRefundWebhookEventData`.
	Payload map[string]interface{} `json:"payload"`

	// ReplayOfEventId Set on a replay. The original event it copies; a replay of a
	// replay points to that same original. Absent on an original
	// event.
	ReplayOfEventId string `json:"replay_of_event_id,omitempty"`

	// TenantId The account the event belongs to.
	TenantId string `json:"tenant_id,omitempty"`
}

WebhookEvent One outbound webhook event, as Hardcount created it. `GET /v1/webhook-endpoints/events` lists them. Each delivery POSTs `{"id", "event_type", "created_at", "data"}` to the endpoint, where `data` is this event's `payload`.

type WebhookEventDeliveryAttempt

type WebhookEventDeliveryAttempt struct {
	// AttemptNo Position in the timeline, starting at 1. It is not the number of attempts.
	AttemptNo int `json:"attempt_no"`

	// AttemptedAt When the delivery was queued.
	AttemptedAt time.Time `json:"attempted_at"`

	// CompletedAt When the delivery succeeded or failed for good. null while pending.
	CompletedAt time.Time `json:"completed_at"`

	// EndpointDescription The endpoint's description, or empty.
	EndpointDescription string `json:"endpoint_description"`

	// EndpointId The endpoint the delivery went to.
	EndpointId string `json:"endpoint_id"`

	// EndpointUrl The endpoint's URL. It is kept after the endpoint is deleted.
	EndpointUrl string `json:"endpoint_url"`

	// Error Why an attempt failed, such as `HTTP 500` or a connection error. Empty when no attempt failed.
	Error string `json:"error"`

	// EventId The event this delivery belongs to. When `is_replay` is true, the replay's own id; the message it sent carries the original event's `id` (`root_event_id`).
	EventId string `json:"event_id"`

	// Id The delivery's id (`hc_whd_…`).
	Id string `json:"id"`

	// IsReplay True when the row belongs to a replay of the event.
	IsReplay bool `json:"is_replay"`

	// NextRetryAt While pending, when the next attempt is due. While an attempt is
	// running, it is when a retry takes over if that attempt never
	// finishes. null once the delivery is finished.
	NextRetryAt time.Time `json:"next_retry_at"`

	// ReplayEventId The replay's event id when `is_replay` is true; otherwise empty.
	ReplayEventId string `json:"replay_event_id"`

	// RequestPayloadSha256 SHA-256, in hex, of the event's data. Two rows with the same
	// value sent the same data.
	RequestPayloadSha256 string `json:"request_payload_sha256"`

	// ResponseBody Up to the first 1 KB of the receiver's latest answer.
	ResponseBody string `json:"response_body"`

	// Status `pending` while an attempt is running or due, `succeeded` after a 2xx answer, `failed` once the delivery failed for good.
	Status WebhookEventDeliveryAttemptStatus `json:"status"`

	// StatusCode HTTP status from the receiver's latest answer. 0 when no attempt got an answer.
	StatusCode int `json:"status_code"`
}

WebhookEventDeliveryAttempt One row of an event's delivery timeline, from `GET /v1/webhook_events/{id}/deliveries`. Each row is one endpoint's delivery of the event or of one of its replays, with the result of its latest attempt.

type WebhookEventDeliveryAttemptStatus

type WebhookEventDeliveryAttemptStatus string

WebhookEventDeliveryAttemptStatus `pending` while an attempt is running or due, `succeeded` after a 2xx answer, `failed` once the delivery failed for good.

const (
	WebhookEventDeliveryAttemptStatusFailed    WebhookEventDeliveryAttemptStatus = "failed"
	WebhookEventDeliveryAttemptStatusPending   WebhookEventDeliveryAttemptStatus = "pending"
	WebhookEventDeliveryAttemptStatusSucceeded WebhookEventDeliveryAttemptStatus = "succeeded"
)

Defines values for WebhookEventDeliveryAttemptStatus.

func (WebhookEventDeliveryAttemptStatus) Valid

Valid indicates whether the value is a known member of the WebhookEventDeliveryAttemptStatus enum.

type WebhookReplayResult

type WebhookReplayResult struct {
	// EventId The new event created by the replay.
	EventId string `json:"event_id"`

	// ReplayOf The original event.
	ReplayOf string `json:"replay_of"`

	// Status `queued` when at least one endpoint will get the replay.
	// `no_matching_endpoints` when no active endpoint in this mode
	// subscribes to the event's type; the replay event is still
	// created.
	Status WebhookReplayResultStatus `json:"status"`
}

WebhookReplayResult What `POST /v1/webhook_events/{id}/replay` returns.

type WebhookReplayResultStatus

type WebhookReplayResultStatus string

WebhookReplayResultStatus `queued` when at least one endpoint will get the replay. `no_matching_endpoints` when no active endpoint in this mode subscribes to the event's type; the replay event is still created.

const (
	WebhookReplayResultStatusNoMatchingEndpoints WebhookReplayResultStatus = "no_matching_endpoints"
	WebhookReplayResultStatusQueued              WebhookReplayResultStatus = "queued"
)

Defines values for WebhookReplayResultStatus.

func (WebhookReplayResultStatus) Valid

func (e WebhookReplayResultStatus) Valid() bool

Valid indicates whether the value is a known member of the WebhookReplayResultStatus enum.

type WebhookSecretRotation

type WebhookSecretRotation struct {
	// SecondaryValidUntil Until this time, 72 hours after the rotation, each delivery is
	// signed with the old secret too, so your receiver can switch
	// without rejecting events.
	SecondaryValidUntil time.Time `json:"secondary_valid_until,omitempty"`

	// Secret The new signing secret (`whsec_…`). Store it now; Hardcount does not show it again.
	Secret string `json:"secret"`
}

WebhookSecretRotation The endpoint's new signing secret. It is shown only here.

type WebhookStreamFrame

type WebhookStreamFrame struct {
	// CreatedAt When the event was created.
	CreatedAt time.Time `json:"created_at"`

	// CustomerId The customer the event is about: the `customer_id` of the
	// resource in `data` (its `id` for a `customer.*` event), or empty.
	// For an event queued before `data` held the resource, its
	// `data.customer_id`.
	CustomerId string `json:"customer_id"`

	// EventId The event's id. For a replay, the replay's own id.
	EventId string `json:"event_id"`

	// EventType The event's type, such as `invoice.finalized`.
	EventType string `json:"event_type"`

	// LastAttemptAt When the delivery result this frame reports happened. null in the first batch and in a new event's first frame.
	LastAttemptAt time.Time `json:"last_attempt_at"`

	// Livemode The event's mode. Live frames are not filtered by mode, so check it.
	Livemode bool `json:"livemode"`

	// ReplayOfEventId The original event, when this frame is about a replay. null otherwise.
	ReplayOfEventId string `json:"replay_of_event_id"`

	// Status Delivery state. Live frames send `pending` (a new event or
	// replay), `succeeded` (one delivery got a 2xx answer) or `failed`
	// (one delivery failed for good). Frames in the first batch send
	// the event's roll-up over all its deliveries: `pending`, `failed`,
	// `delivered` (every delivery succeeded) or `no_endpoints`.
	Status string `json:"status"`
}

WebhookStreamFrame The JSON in each `data:` line of `/v1/webhook_events/stream`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL