orb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

README

Orb Go API Library

Go Reference

The Orb Go library provides convenient access to the Orb REST API from applications written in Go.

Installation

import (
	"github.com/orbcorp/orb-go" // imported as orb
)

Or to pin the version:

go get -u 'github.com/orbcorp/orb-go@v0.1.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"
	"github.com/orbcorp/orb-go"
	"github.com/orbcorp/orb-go/option"
)

func main() {
	client := orb.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("ORB_API_KEY")
	)
	customer, err := client.Customers.New(context.TODO(), orb.CustomerNewParams{
		Email: orb.F("example-customer@withorb.com"),
		Name:  orb.F("My Customer"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", customer)
}

Request Fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: orb.F("hello"),

	// Explicitly send `"description": null`
	Description: orb.Null[string](),

	Point: orb.F(orb.Point{
		X: orb.Int(0),
		Y: orb.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: orb.Raw[int64](0.01), // sends a float
	}),
}
Response Objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := orb.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Customers.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The full list of request options is here.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Coupons.ListAutoPaging(context.TODO(), orb.CouponListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	coupon := iter.Current()
	fmt.Printf("%+v\n", coupon)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Coupons.List(context.TODO(), orb.CouponListParams{})
for page != nil {
	for _, coupon := range page.Data {
		fmt.Printf("%+v\n", coupon)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *orb.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Customers.New(context.TODO(), orb.CustomerNewParams{
	Email: orb.F("example-customer@withorb.com"),
	Name:  orb.F("My Customer"),
})
if err != nil {
	var apierr *orb.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/customers": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Customers.New(
	ctx,
	orb.CustomerNewParams{
		Email: orb.F("example-customer@withorb.com"),
		Name:  orb.F("My Customer"),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := orb.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Customers.New(
	context.TODO(),
	orb.CustomerNewParams{
		Email: orb.F("example-customer@withorb.com"),
		Name:  orb.F("My Customer"),
	},
	option.WithMaxRetries(5),
)
Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := orb.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic Versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explciitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Client

type Client struct {
	Options          []option.RequestOption
	TopLevel         *TopLevelService
	Coupons          *CouponService
	CreditNotes      *CreditNoteService
	Customers        *CustomerService
	Events           *EventService
	InvoiceLineItems *InvoiceLineItemService
	Invoices         *InvoiceService
	Items            *ItemService
	Metrics          *MetricService
	Plans            *PlanService
	Prices           *PriceService
	Subscriptions    *SubscriptionService
}

Client creates a struct with services and top level methods that help with interacting with the orb API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (ORB_API_KEY). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

type Coupon

type Coupon struct {
	// Also referred to as coupon_id in this documentation.
	ID string `json:"id,required"`
	// An archived coupon can no longer be redeemed. Active coupons will have a value
	// of null for `archived_at`; this field will be non-null for archived coupons.
	ArchivedAt time.Time   `json:"archived_at,required,nullable" format:"date-time"`
	Discount   interface{} `json:"discount,required"`
	// This allows for a coupon's discount to apply for a limited time (determined in
	// months); a `null` value here means "unlimited time".
	DurationInMonths int64 `json:"duration_in_months,required,nullable"`
	// The maximum number of redemptions allowed for this coupon before it is
	// exhausted; `null` here means "unlimited".
	MaxRedemptions int64 `json:"max_redemptions,required,nullable"`
	// This string can be used to redeem this coupon for a given subscription.
	RedemptionCode string `json:"redemption_code,required"`
	// The number of times this coupon has been redeemed.
	TimesRedeemed int64 `json:"times_redeemed,required"`
	JSON          couponJSON
}

A coupon represents a reusable discount configuration, and have an attached redemption code that can be issued to your end users. Coupons are most often used in self-serve signup or upgrade flows in your checkout experience or billing portal.

To redeem a coupon, pass the `redemption_code` property in the [create subscription](create-subscription.api.mdx) or [schedule plan change](schedule-plan-change.api.mdx) request.

func (*Coupon) UnmarshalJSON

func (r *Coupon) UnmarshalJSON(data []byte) (err error)

type CouponListParams

type CouponListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
	// Filter to coupons matching this redemption code.
	RedemptionCode param.Field[string] `query:"redemption_code"`
	// Show archived coupons as well (by default, this endpoint only returns active
	// coupons).
	ShowArchived param.Field[bool] `query:"show_archived"`
}

func (CouponListParams) URLQuery

func (r CouponListParams) URLQuery() (v url.Values)

URLQuery serializes CouponListParams's query parameters as `url.Values`.

type CouponNewParams

type CouponNewParams struct {
	Discount param.Field[interface{}] `json:"discount,required"`
	// This string can be used to redeem this coupon for a given subscription.
	RedemptionCode param.Field[string] `json:"redemption_code,required"`
	// This allows for a coupon's discount to apply for a limited time (determined in
	// months); a `null` value here means "unlimited time".
	DurationInMonths param.Field[int64] `json:"duration_in_months"`
	// The maximum number of redemptions allowed for this coupon before it is
	// exhausted;`null` here means "unlimited".
	MaxRedemptions param.Field[int64] `json:"max_redemptions"`
}

func (CouponNewParams) MarshalJSON

func (r CouponNewParams) MarshalJSON() (data []byte, err error)

type CouponService

type CouponService struct {
	Options       []option.RequestOption
	Subscriptions *CouponSubscriptionService
}

CouponService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCouponService method instead.

func NewCouponService

func NewCouponService(opts ...option.RequestOption) (r *CouponService)

NewCouponService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CouponService) Archive

func (r *CouponService) Archive(ctx context.Context, couponID string, opts ...option.RequestOption) (res *Coupon, err error)

This endpoint allows a coupon to be archived. Archived coupons can no longer be redeemed, and will be hidden from lists of active coupons. Additionally, once a coupon is archived, its redemption code can be reused for a different coupon.

func (*CouponService) Fetch

func (r *CouponService) Fetch(ctx context.Context, couponID string, opts ...option.RequestOption) (res *Coupon, err error)

This endpoint retrieves a coupon by its ID. To fetch coupons by their redemption code, use the [List coupons](list-coupons) endpoint with the redemption_code parameter.

func (*CouponService) List

func (r *CouponService) List(ctx context.Context, query CouponListParams, opts ...option.RequestOption) (res *shared.Page[Coupon], err error)

This endpoint returns a list of all coupons for an account in a list format.

The list of coupons is ordered starting from the most recently created coupon. The response also includes `pagination_metadata`, which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the Pagination-metadata schema.

func (*CouponService) ListAutoPaging

func (r *CouponService) ListAutoPaging(ctx context.Context, query CouponListParams, opts ...option.RequestOption) *shared.PageAutoPager[Coupon]

This endpoint returns a list of all coupons for an account in a list format.

The list of coupons is ordered starting from the most recently created coupon. The response also includes `pagination_metadata`, which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the Pagination-metadata schema.

func (*CouponService) New

func (r *CouponService) New(ctx context.Context, body CouponNewParams, opts ...option.RequestOption) (res *Coupon, err error)

This endpoint allows the creation of coupons, which can then be redeemed at subscription creation or plan change.

type CouponSubscriptionListParams

type CouponSubscriptionListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (CouponSubscriptionListParams) URLQuery

func (r CouponSubscriptionListParams) URLQuery() (v url.Values)

URLQuery serializes CouponSubscriptionListParams's query parameters as `url.Values`.

type CouponSubscriptionService

type CouponSubscriptionService struct {
	Options []option.RequestOption
}

CouponSubscriptionService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCouponSubscriptionService method instead.

func NewCouponSubscriptionService

func NewCouponSubscriptionService(opts ...option.RequestOption) (r *CouponSubscriptionService)

NewCouponSubscriptionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CouponSubscriptionService) List

This endpoint returns a list of all subscriptions that have redeemed a given coupon as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see Subscription(../guides/concepts#subscription).

func (*CouponSubscriptionService) ListAutoPaging

This endpoint returns a list of all subscriptions that have redeemed a given coupon as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see Subscription(../guides/concepts#subscription).

type CreditNote

type CreditNote struct {
	// The Orb id of this credit note.
	ID string `json:"id,required"`
	// The creation time of the resource in Orb.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The unique identifier for credit notes.
	CreditNoteNumber string `json:"credit_note_number,required"`
	// A URL to a PDF of the credit note.
	CreditNotePdf string             `json:"credit_note_pdf,required,nullable"`
	Customer      CreditNoteCustomer `json:"customer,required"`
	// Any discounts applied on the original invoice.
	Discounts []interface{} `json:"discounts,required"`
	// The id of the invoice resource that this credit note is applied to.
	InvoiceID string `json:"invoice_id,required"`
	// All of the line items associated with this credit note.
	LineItems []CreditNoteLineItem `json:"line_items,required"`
	// The maximum amount applied on the original invoice
	MaximumAmountAdjustment interface{} `json:"maximum_amount_adjustment,required,nullable"`
	// An optional memo supplied on the credit note.
	Memo string `json:"memo,required,nullable"`
	// Any credited amount from the applied minimum on the invoice.
	MinimumAmountRefunded string           `json:"minimum_amount_refunded,required,nullable"`
	Reason                CreditNoteReason `json:"reason,required"`
	// The total prior to any creditable invoice-level discounts or minimums.
	Subtotal string `json:"subtotal,required"`
	// The total including creditable invoice-level discounts or minimums, and tax.
	Total string         `json:"total,required"`
	Type  CreditNoteType `json:"type,required"`
	// The time at which the credit note was voided in Orb, if applicable.
	VoidedAt time.Time `json:"voided_at,required,nullable" format:"date-time"`
	JSON     creditNoteJSON
}

The [Credit Note](/guides/invoicing/credit-notes) resource represents a credit that has been applied to a particular invoice.

func (*CreditNote) UnmarshalJSON

func (r *CreditNote) UnmarshalJSON(data []byte) (err error)

type CreditNoteCustomer

type CreditNoteCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               creditNoteCustomerJSON
}

func (*CreditNoteCustomer) UnmarshalJSON

func (r *CreditNoteCustomer) UnmarshalJSON(data []byte) (err error)

type CreditNoteLineItem

type CreditNoteLineItem struct {
	// The Orb id of this resource.
	ID string `json:"id,required"`
	// The amount of the line item, including any line item minimums and discounts.
	Amount string `json:"amount,required"`
	// Any line items discounts from the invoice's line item.
	Discounts []interface{} `json:"discounts,required"`
	// The name of the corresponding invoice line item.
	Name string `json:"name,required"`
	// An optional quantity credited.
	Quantity float64 `json:"quantity,required,nullable"`
	// Any sub line items that may be credited.
	SubLineItems []CreditNoteLineItemsSubLineItem `json:"sub_line_items,required"`
	// The amount of the line item, excluding any line item minimums and discounts.
	Subtotal string `json:"subtotal,required"`
	// Any tax amounts applied onto the line item.
	TaxAmounts []interface{} `json:"tax_amounts,required"`
	JSON       creditNoteLineItemJSON
}

func (*CreditNoteLineItem) UnmarshalJSON

func (r *CreditNoteLineItem) UnmarshalJSON(data []byte) (err error)

type CreditNoteLineItemsSubLineItem

type CreditNoteLineItemsSubLineItem struct {
	Amount   string  `json:"amount,required"`
	Name     string  `json:"name,required"`
	Quantity float64 `json:"quantity,required,nullable"`
	JSON     creditNoteLineItemsSubLineItemJSON
}

func (*CreditNoteLineItemsSubLineItem) UnmarshalJSON

func (r *CreditNoteLineItemsSubLineItem) UnmarshalJSON(data []byte) (err error)

type CreditNoteListParams

type CreditNoteListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (CreditNoteListParams) URLQuery

func (r CreditNoteListParams) URLQuery() (v url.Values)

URLQuery serializes CreditNoteListParams's query parameters as `url.Values`.

type CreditNoteReason

type CreditNoteReason string
const (
	CreditNoteReasonDuplicate             CreditNoteReason = "Duplicate"
	CreditNoteReasonFraudulent            CreditNoteReason = "Fraudulent"
	CreditNoteReasonOrderChange           CreditNoteReason = "Order change"
	CreditNoteReasonProductUnsatisfactory CreditNoteReason = "Product unsatisfactory"
)

type CreditNoteService

type CreditNoteService struct {
	Options []option.RequestOption
}

CreditNoteService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCreditNoteService method instead.

func NewCreditNoteService

func NewCreditNoteService(opts ...option.RequestOption) (r *CreditNoteService)

NewCreditNoteService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CreditNoteService) Fetch

func (r *CreditNoteService) Fetch(ctx context.Context, creditNoteID string, opts ...option.RequestOption) (res *CreditNote, err error)

This endpoint is used to fetch a single [`Credit Note`](../guides/invoicing/credit-notes) given an identifier.

func (*CreditNoteService) List

Get a paginated list of CreditNotes. Users can also filter by customer_id, subscription_id, or external_customer_id. The credit notes will be returned in reverse chronological order by `creation_time`.

func (*CreditNoteService) ListAutoPaging

Get a paginated list of CreditNotes. Users can also filter by customer_id, subscription_id, or external_customer_id. The credit notes will be returned in reverse chronological order by `creation_time`.

type CreditNoteType

type CreditNoteType string
const (
	CreditNoteTypeRefund     CreditNoteType = "refund"
	CreditNoteTypeAdjustment CreditNoteType = "adjustment"
)

type Customer

type Customer struct {
	ID               string   `json:"id,required"`
	AdditionalEmails []string `json:"additional_emails,required"`
	AutoCollection   bool     `json:"auto_collection,required"`
	// The customer's current balance in their currency.
	Balance        string                 `json:"balance,required"`
	BillingAddress CustomerBillingAddress `json:"billing_address,required,nullable"`
	CreatedAt      time.Time              `json:"created_at,required" format:"date-time"`
	Currency       string                 `json:"currency,required,nullable"`
	// A valid customer email, to be used for notifications. When Orb triggers payment
	// through a payment gateway, this email will be used for any automatically issued
	// receipts.
	Email         string `json:"email,required"`
	EmailDelivery bool   `json:"email_delivery,required"`
	// An optional user-defined ID for this customer resource, used throughout the
	// system as an alias for this Customer. Use this field to identify a customer by
	// an existing identifier in your system.
	ExternalCustomerID string            `json:"external_customer_id,required,nullable"`
	Metadata           map[string]string `json:"metadata,required"`
	// The full name of the customer
	Name string `json:"name,required"`
	// This is used for creating charges or invoices in an external system via Orb.
	// When not in test mode, the connection must first be configured in the Orb
	// webapp.
	PaymentProvider CustomerPaymentProvider `json:"payment_provider,required,nullable"`
	// The ID of this customer in an external payments solution, such as Stripe. This
	// is used for creating charges or invoices in the external system via Orb.
	PaymentProviderID string                  `json:"payment_provider_id,required,nullable"`
	PortalURL         string                  `json:"portal_url,required,nullable"`
	ShippingAddress   CustomerShippingAddress `json:"shipping_address,required,nullable"`
	TaxID             CustomerTaxID           `json:"tax_id,required,nullable"`
	// A timezone identifier from the IANA timezone database, such as
	// "America/Los_Angeles". This "defaults to your account's timezone if not set.
	// This cannot be changed after customer creation.
	Timezone                    string                              `json:"timezone,required"`
	AccountingSyncConfiguration CustomerAccountingSyncConfiguration `json:"accounting_sync_configuration,nullable"`
	ReportingConfiguration      CustomerReportingConfiguration      `json:"reporting_configuration,nullable"`
	JSON                        customerJSON
}

A customer is a buyer of your products, and the other party to the billing relationship.

In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an `external_customer_id` with your own identifier. See [Customer ID Aliases](../guides/events-and-metrics/customer-aliases) for further information about how these aliases work in Orb.

In addition to having an identifier in your system, a customer may exist in a payment provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.

A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) for information on what this timezone parameter influences within Orb.

func (*Customer) UnmarshalJSON

func (r *Customer) UnmarshalJSON(data []byte) (err error)

type CustomerAccountingSyncConfiguration

type CustomerAccountingSyncConfiguration struct {
	AccountingProviders []CustomerAccountingSyncConfigurationAccountingProvider `json:"accounting_providers,required"`
	Excluded            bool                                                    `json:"excluded,required"`
	JSON                customerAccountingSyncConfigurationJSON
}

func (*CustomerAccountingSyncConfiguration) UnmarshalJSON

func (r *CustomerAccountingSyncConfiguration) UnmarshalJSON(data []byte) (err error)

type CustomerAccountingSyncConfigurationAccountingProvider

type CustomerAccountingSyncConfigurationAccountingProvider struct {
	ExternalProviderID string                                                             `json:"external_provider_id,required,nullable"`
	ProviderType       CustomerAccountingSyncConfigurationAccountingProvidersProviderType `json:"provider_type,required"`
	JSON               customerAccountingSyncConfigurationAccountingProviderJSON
}

func (*CustomerAccountingSyncConfigurationAccountingProvider) UnmarshalJSON

func (r *CustomerAccountingSyncConfigurationAccountingProvider) UnmarshalJSON(data []byte) (err error)

type CustomerAccountingSyncConfigurationAccountingProvidersProviderType

type CustomerAccountingSyncConfigurationAccountingProvidersProviderType string
const (
	CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeQuickbooks CustomerAccountingSyncConfigurationAccountingProvidersProviderType = "quickbooks"
	CustomerAccountingSyncConfigurationAccountingProvidersProviderTypeNetsuite   CustomerAccountingSyncConfigurationAccountingProvidersProviderType = "netsuite"
)

type CustomerBalanceTransactionListParams

type CustomerBalanceTransactionListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit            param.Field[int64]     `query:"limit"`
	OperationTimeGt  param.Field[time.Time] `query:"operation_time[gt]" format:"date-time"`
	OperationTimeGte param.Field[time.Time] `query:"operation_time[gte]" format:"date-time"`
	OperationTimeLt  param.Field[time.Time] `query:"operation_time[lt]" format:"date-time"`
	OperationTimeLte param.Field[time.Time] `query:"operation_time[lte]" format:"date-time"`
}

func (CustomerBalanceTransactionListParams) URLQuery

URLQuery serializes CustomerBalanceTransactionListParams's query parameters as `url.Values`.

type CustomerBalanceTransactionListResponse

type CustomerBalanceTransactionListResponse struct {
	// A unique id for this transaction.
	ID     string                                       `json:"id,required"`
	Action CustomerBalanceTransactionListResponseAction `json:"action,required"`
	// The value of the amount changed in the transaction.
	Amount string `json:"amount,required"`
	// The creation time of this transaction.
	CreatedAt  time.Time                                        `json:"created_at,required" format:"date-time"`
	CreditNote CustomerBalanceTransactionListResponseCreditNote `json:"credit_note,required,nullable"`
	// An optional description provided for manual customer balance adjustments.
	Description string `json:"description,required,nullable"`
	// The new value of the customer's balance prior to the transaction, in the
	// customer's currency.
	EndingBalance string                                        `json:"ending_balance,required"`
	Invoice       CustomerBalanceTransactionListResponseInvoice `json:"invoice,required,nullable"`
	// The original value of the customer's balance prior to the transaction, in the
	// customer's currency.
	StartingBalance string                                     `json:"starting_balance,required"`
	Type            CustomerBalanceTransactionListResponseType `json:"type,required"`
	JSON            customerBalanceTransactionListResponseJSON
}

func (*CustomerBalanceTransactionListResponse) UnmarshalJSON

func (r *CustomerBalanceTransactionListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionListResponseAction

type CustomerBalanceTransactionListResponseAction string
const (
	CustomerBalanceTransactionListResponseActionAppliedToInvoice CustomerBalanceTransactionListResponseAction = "applied_to_invoice"
	CustomerBalanceTransactionListResponseActionProratedRefund   CustomerBalanceTransactionListResponseAction = "prorated_refund"
	CustomerBalanceTransactionListResponseActionManualAdjustment CustomerBalanceTransactionListResponseAction = "manual_adjustment"
)

type CustomerBalanceTransactionListResponseCreditNote

type CustomerBalanceTransactionListResponseCreditNote struct {
	// The id of the Credit note
	ID   string `json:"id,required"`
	JSON customerBalanceTransactionListResponseCreditNoteJSON
}

func (*CustomerBalanceTransactionListResponseCreditNote) UnmarshalJSON

func (r *CustomerBalanceTransactionListResponseCreditNote) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionListResponseInvoice

type CustomerBalanceTransactionListResponseInvoice struct {
	// The Invoice id
	ID   string `json:"id,required"`
	JSON customerBalanceTransactionListResponseInvoiceJSON
}

func (*CustomerBalanceTransactionListResponseInvoice) UnmarshalJSON

func (r *CustomerBalanceTransactionListResponseInvoice) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionListResponseType

type CustomerBalanceTransactionListResponseType string
const (
	CustomerBalanceTransactionListResponseTypeIncrement CustomerBalanceTransactionListResponseType = "increment"
	CustomerBalanceTransactionListResponseTypeDecrement CustomerBalanceTransactionListResponseType = "decrement"
)

type CustomerBalanceTransactionNewParams

type CustomerBalanceTransactionNewParams struct {
	Amount param.Field[string]                                  `json:"amount,required"`
	Type   param.Field[CustomerBalanceTransactionNewParamsType] `json:"type,required"`
	// An optional description that can be specified around this entry.
	Description param.Field[string] `json:"description"`
}

func (CustomerBalanceTransactionNewParams) MarshalJSON

func (r CustomerBalanceTransactionNewParams) MarshalJSON() (data []byte, err error)

type CustomerBalanceTransactionNewParamsType

type CustomerBalanceTransactionNewParamsType string
const (
	CustomerBalanceTransactionNewParamsTypeIncrement CustomerBalanceTransactionNewParamsType = "increment"
	CustomerBalanceTransactionNewParamsTypeDecrement CustomerBalanceTransactionNewParamsType = "decrement"
)

type CustomerBalanceTransactionNewResponse

type CustomerBalanceTransactionNewResponse struct {
	// A unique id for this transaction.
	ID     string                                      `json:"id,required"`
	Action CustomerBalanceTransactionNewResponseAction `json:"action,required"`
	// The value of the amount changed in the transaction.
	Amount string `json:"amount,required"`
	// The creation time of this transaction.
	CreatedAt  time.Time                                       `json:"created_at,required" format:"date-time"`
	CreditNote CustomerBalanceTransactionNewResponseCreditNote `json:"credit_note,required,nullable"`
	// An optional description provided for manual customer balance adjustments.
	Description string `json:"description,required,nullable"`
	// The new value of the customer's balance prior to the transaction, in the
	// customer's currency.
	EndingBalance string                                       `json:"ending_balance,required"`
	Invoice       CustomerBalanceTransactionNewResponseInvoice `json:"invoice,required,nullable"`
	// The original value of the customer's balance prior to the transaction, in the
	// customer's currency.
	StartingBalance string                                    `json:"starting_balance,required"`
	Type            CustomerBalanceTransactionNewResponseType `json:"type,required"`
	JSON            customerBalanceTransactionNewResponseJSON
}

func (*CustomerBalanceTransactionNewResponse) UnmarshalJSON

func (r *CustomerBalanceTransactionNewResponse) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionNewResponseAction

type CustomerBalanceTransactionNewResponseAction string
const (
	CustomerBalanceTransactionNewResponseActionAppliedToInvoice CustomerBalanceTransactionNewResponseAction = "applied_to_invoice"
	CustomerBalanceTransactionNewResponseActionProratedRefund   CustomerBalanceTransactionNewResponseAction = "prorated_refund"
	CustomerBalanceTransactionNewResponseActionManualAdjustment CustomerBalanceTransactionNewResponseAction = "manual_adjustment"
)

type CustomerBalanceTransactionNewResponseCreditNote

type CustomerBalanceTransactionNewResponseCreditNote struct {
	// The id of the Credit note
	ID   string `json:"id,required"`
	JSON customerBalanceTransactionNewResponseCreditNoteJSON
}

func (*CustomerBalanceTransactionNewResponseCreditNote) UnmarshalJSON

func (r *CustomerBalanceTransactionNewResponseCreditNote) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionNewResponseInvoice

type CustomerBalanceTransactionNewResponseInvoice struct {
	// The Invoice id
	ID   string `json:"id,required"`
	JSON customerBalanceTransactionNewResponseInvoiceJSON
}

func (*CustomerBalanceTransactionNewResponseInvoice) UnmarshalJSON

func (r *CustomerBalanceTransactionNewResponseInvoice) UnmarshalJSON(data []byte) (err error)

type CustomerBalanceTransactionNewResponseType

type CustomerBalanceTransactionNewResponseType string
const (
	CustomerBalanceTransactionNewResponseTypeIncrement CustomerBalanceTransactionNewResponseType = "increment"
	CustomerBalanceTransactionNewResponseTypeDecrement CustomerBalanceTransactionNewResponseType = "decrement"
)

type CustomerBalanceTransactionService

type CustomerBalanceTransactionService struct {
	Options []option.RequestOption
}

CustomerBalanceTransactionService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerBalanceTransactionService method instead.

func NewCustomerBalanceTransactionService

func NewCustomerBalanceTransactionService(opts ...option.RequestOption) (r *CustomerBalanceTransactionService)

NewCustomerBalanceTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerBalanceTransactionService) List

## The customer balance

The customer balance is an amount in the customer's currency, which Orb automatically applies to subsequent invoices. This balance can be adjusted manually via Orb's webapp on the customer details page. You can use this balance to provide a fixed mid-period credit to the customer. Commonly, this is done due to system downtime/SLA violation, or an adhoc adjustment discussed with the customer.

If the balance is a positive value at the time of invoicing, it represents that the customer has credit that should be used to offset the amount due on the next issued invoice. In this case, Orb will automatically reduce the next invoice by the balance amount, and roll over any remaining balance if the invoice is fully discounted.

If the balance is a negative value at the time of invoicing, Orb will increase the invoice's amount due with a positive adjustment, and reset the balance to 0.

This endpoint retrieves all customer balance transactions in reverse chronological order for a single customer, providing a complete audit trail of all adjustments and invoice applications.

## Eligibility

The customer balance can only be applied to invoices or adjusted manually if invoices are not synced to a separate invoicing provider. If a payment gateway such as Stripe is used, the balance will be applied to the invoice before forwarding payment to the gateway.

func (*CustomerBalanceTransactionService) ListAutoPaging

## The customer balance

The customer balance is an amount in the customer's currency, which Orb automatically applies to subsequent invoices. This balance can be adjusted manually via Orb's webapp on the customer details page. You can use this balance to provide a fixed mid-period credit to the customer. Commonly, this is done due to system downtime/SLA violation, or an adhoc adjustment discussed with the customer.

If the balance is a positive value at the time of invoicing, it represents that the customer has credit that should be used to offset the amount due on the next issued invoice. In this case, Orb will automatically reduce the next invoice by the balance amount, and roll over any remaining balance if the invoice is fully discounted.

If the balance is a negative value at the time of invoicing, Orb will increase the invoice's amount due with a positive adjustment, and reset the balance to 0.

This endpoint retrieves all customer balance transactions in reverse chronological order for a single customer, providing a complete audit trail of all adjustments and invoice applications.

## Eligibility

The customer balance can only be applied to invoices or adjusted manually if invoices are not synced to a separate invoicing provider. If a payment gateway such as Stripe is used, the balance will be applied to the invoice before forwarding payment to the gateway.

func (*CustomerBalanceTransactionService) New

Creates an immutable balance transaction that updates the customer's balance and returns back the newly created transaction.

type CustomerBillingAddress

type CustomerBillingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       customerBillingAddressJSON
}

func (*CustomerBillingAddress) UnmarshalJSON

func (r *CustomerBillingAddress) UnmarshalJSON(data []byte) (err error)

type CustomerCostListByExternalIDParams

type CustomerCostListByExternalIDParams struct {
	// Groups per-price costs by the key provided.
	GroupBy param.Field[string] `query:"group_by"`
	// Costs returned are exclusive of `timeframe_end`.
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// Costs returned are inclusive of `timeframe_start`.
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// Controls whether Orb returns cumulative costs since the start of the billing
	// period, or incremental day-by-day costs. If your customer has minimums or
	// discounts, it's strongly recommended that you use the default cumulative
	// behavior.
	ViewMode param.Field[CustomerCostListByExternalIDParamsViewMode] `query:"view_mode"`
}

func (CustomerCostListByExternalIDParams) URLQuery

URLQuery serializes CustomerCostListByExternalIDParams's query parameters as `url.Values`.

type CustomerCostListByExternalIDParamsViewMode

type CustomerCostListByExternalIDParamsViewMode string

Controls whether Orb returns cumulative costs since the start of the billing period, or incremental day-by-day costs. If your customer has minimums or discounts, it's strongly recommended that you use the default cumulative behavior.

const (
	CustomerCostListByExternalIDParamsViewModePeriodic   CustomerCostListByExternalIDParamsViewMode = "periodic"
	CustomerCostListByExternalIDParamsViewModeCumulative CustomerCostListByExternalIDParamsViewMode = "cumulative"
)

type CustomerCostListByExternalIDResponse

type CustomerCostListByExternalIDResponse struct {
	Data []CustomerCostListByExternalIDResponseData `json:"data,required"`
	JSON customerCostListByExternalIDResponseJSON
}

func (*CustomerCostListByExternalIDResponse) UnmarshalJSON

func (r *CustomerCostListByExternalIDResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCostListByExternalIDResponseData

type CustomerCostListByExternalIDResponseData struct {
	PerPriceCosts []CustomerCostListByExternalIDResponseDataPerPriceCost `json:"per_price_costs,required"`
	// Total costs for the timeframe, excluding any minimums and discounts.
	Subtotal       string    `json:"subtotal,required"`
	TimeframeEnd   time.Time `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time `json:"timeframe_start,required" format:"date-time"`
	// Total costs for the timeframe, including any minimums and discounts.
	Total string `json:"total,required"`
	JSON  customerCostListByExternalIDResponseDataJSON
}

func (*CustomerCostListByExternalIDResponseData) UnmarshalJSON

func (r *CustomerCostListByExternalIDResponseData) UnmarshalJSON(data []byte) (err error)

type CustomerCostListByExternalIDResponseDataPerPriceCost

type CustomerCostListByExternalIDResponseDataPerPriceCost struct {
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price Price `json:"price,required"`
	// Price's contributions for the timeframe, excluding any minimums and discounts.
	Subtotal string `json:"subtotal,required"`
	// Price's contributions for the timeframe, including minimums and discounts.
	Total string `json:"total,required"`
	// If a `group_by` attribute is passed in, array of costs per `grouping_key`,
	// `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
	PriceGroups []CustomerCostListByExternalIDResponseDataPerPriceCostsPriceGroup `json:"price_groups,nullable"`
	// The price's quantity for the timeframe
	Quantity float64 `json:"quantity,nullable"`
	JSON     customerCostListByExternalIDResponseDataPerPriceCostJSON
}

func (*CustomerCostListByExternalIDResponseDataPerPriceCost) UnmarshalJSON

func (r *CustomerCostListByExternalIDResponseDataPerPriceCost) UnmarshalJSON(data []byte) (err error)

type CustomerCostListByExternalIDResponseDataPerPriceCostsPriceGroup

type CustomerCostListByExternalIDResponseDataPerPriceCostsPriceGroup struct {
	// Grouping key to break down a single price's costs
	GroupingKey   string `json:"grouping_key,required"`
	GroupingValue string `json:"grouping_value,required,nullable"`
	// If the price is a matrix price, this is the second dimension key
	SecondaryGroupingKey   string `json:"secondary_grouping_key,required,nullable"`
	SecondaryGroupingValue string `json:"secondary_grouping_value,required,nullable"`
	// Total costs for this group for the timeframe. Note that this does not account
	// for any minimums or discounts.
	Total string `json:"total,required"`
	JSON  customerCostListByExternalIDResponseDataPerPriceCostsPriceGroupJSON
}

func (*CustomerCostListByExternalIDResponseDataPerPriceCostsPriceGroup) UnmarshalJSON

type CustomerCostListParams

type CustomerCostListParams struct {
	// Groups per-price costs by the key provided.
	GroupBy param.Field[string] `query:"group_by"`
	// Costs returned are exclusive of `timeframe_end`.
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// Costs returned are inclusive of `timeframe_start`.
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// Controls whether Orb returns cumulative costs since the start of the billing
	// period, or incremental day-by-day costs. If your customer has minimums or
	// discounts, it's strongly recommended that you use the default cumulative
	// behavior.
	ViewMode param.Field[CustomerCostListParamsViewMode] `query:"view_mode"`
}

func (CustomerCostListParams) URLQuery

func (r CustomerCostListParams) URLQuery() (v url.Values)

URLQuery serializes CustomerCostListParams's query parameters as `url.Values`.

type CustomerCostListParamsViewMode

type CustomerCostListParamsViewMode string

Controls whether Orb returns cumulative costs since the start of the billing period, or incremental day-by-day costs. If your customer has minimums or discounts, it's strongly recommended that you use the default cumulative behavior.

const (
	CustomerCostListParamsViewModePeriodic   CustomerCostListParamsViewMode = "periodic"
	CustomerCostListParamsViewModeCumulative CustomerCostListParamsViewMode = "cumulative"
)

type CustomerCostListResponse

type CustomerCostListResponse struct {
	Data []CustomerCostListResponseData `json:"data,required"`
	JSON customerCostListResponseJSON
}

func (*CustomerCostListResponse) UnmarshalJSON

func (r *CustomerCostListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCostListResponseData

type CustomerCostListResponseData struct {
	PerPriceCosts []CustomerCostListResponseDataPerPriceCost `json:"per_price_costs,required"`
	// Total costs for the timeframe, excluding any minimums and discounts.
	Subtotal       string    `json:"subtotal,required"`
	TimeframeEnd   time.Time `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time `json:"timeframe_start,required" format:"date-time"`
	// Total costs for the timeframe, including any minimums and discounts.
	Total string `json:"total,required"`
	JSON  customerCostListResponseDataJSON
}

func (*CustomerCostListResponseData) UnmarshalJSON

func (r *CustomerCostListResponseData) UnmarshalJSON(data []byte) (err error)

type CustomerCostListResponseDataPerPriceCost

type CustomerCostListResponseDataPerPriceCost struct {
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price Price `json:"price,required"`
	// Price's contributions for the timeframe, excluding any minimums and discounts.
	Subtotal string `json:"subtotal,required"`
	// Price's contributions for the timeframe, including minimums and discounts.
	Total string `json:"total,required"`
	// If a `group_by` attribute is passed in, array of costs per `grouping_key`,
	// `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
	PriceGroups []CustomerCostListResponseDataPerPriceCostsPriceGroup `json:"price_groups,nullable"`
	// The price's quantity for the timeframe
	Quantity float64 `json:"quantity,nullable"`
	JSON     customerCostListResponseDataPerPriceCostJSON
}

func (*CustomerCostListResponseDataPerPriceCost) UnmarshalJSON

func (r *CustomerCostListResponseDataPerPriceCost) UnmarshalJSON(data []byte) (err error)

type CustomerCostListResponseDataPerPriceCostsPriceGroup

type CustomerCostListResponseDataPerPriceCostsPriceGroup struct {
	// Grouping key to break down a single price's costs
	GroupingKey   string `json:"grouping_key,required"`
	GroupingValue string `json:"grouping_value,required,nullable"`
	// If the price is a matrix price, this is the second dimension key
	SecondaryGroupingKey   string `json:"secondary_grouping_key,required,nullable"`
	SecondaryGroupingValue string `json:"secondary_grouping_value,required,nullable"`
	// Total costs for this group for the timeframe. Note that this does not account
	// for any minimums or discounts.
	Total string `json:"total,required"`
	JSON  customerCostListResponseDataPerPriceCostsPriceGroupJSON
}

func (*CustomerCostListResponseDataPerPriceCostsPriceGroup) UnmarshalJSON

func (r *CustomerCostListResponseDataPerPriceCostsPriceGroup) UnmarshalJSON(data []byte) (err error)

type CustomerCostService

type CustomerCostService struct {
	Options []option.RequestOption
}

CustomerCostService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerCostService method instead.

func NewCustomerCostService

func NewCustomerCostService(opts ...option.RequestOption) (r *CustomerCostService)

NewCustomerCostService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerCostService) List

This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated by applying pricing information to the underlying usage (see the [subscription usage endpoint](fetch-subscription-usage.api.mdx) to fetch usage per metric, in usage units rather than a currency).

This endpoint can be leveraged for internal tooling and to provide a more transparent billing experience for your end users:

  1. Understand the cost breakdown per line item historically and in real-time for the current billing period.
  2. Provide customer visibility into how different services are contributing to the overall invoice with a per-day timeseries (as compared to the [upcoming invoice](fetch-upcoming-invoice) resource, which represents a snapshot for the current period).
  3. Assess how minimums and discounts affect your customers by teasing apart costs directly as a result of usage, as opposed to minimums and discounts at the plan and price level.
  4. Gain insight into key customer health metrics, such as the percent utilization of the minimum committed spend.

## Fetching subscriptions

By default, this endpoint fetches the currently active subscription for the customer, and returns cost information for the subscription's current billing period, broken down by each participating price. If there are no currently active subscriptions, this will instead default to the most recently active subscription or return an empty series if none are found. For example, if your plan charges for compute hours, job runs, and data syncs, then this endpoint would provide a daily breakdown of your customer's cost for each of those axes.

If timeframe bounds are specified, Orb fetches all subscriptions that were active in that timeframe. If two subscriptions overlap on a single day, costs from each price will be summed, and prices for both subscriptions will be included in the breakdown.

## Prepaid plans

For plans that include prices which deduct credits rather than accrue in-arrears charges in a billable currency, this endpoint will return the total deduction amount, in credits, for the specified timeframe.

## Cumulative subtotals and totals

Since the subtotal and total must factor in any billing-period level discounts and minimums, it's most meaningful to consider costs relative to the start of the subscription's billing period. As a result, by default this endpoint returns cumulative totals since the beginning of the billing period. In particular, the `timeframe_start` of a returned timeframe window is _always_ the beginning of the billing period and `timeframe_end` is incremented one day at a time to build the result.

A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days of the month. Here, we assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this price, and that the subscription's billing period bounds are aligned to the first of the month:

| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |

### Periodic values

When the query parameter `view_mode=periodic` is specified, Orb will return an incremental day-by-day view of costs. In this case, there will always be a one-day difference between `timeframe_start` and `timeframe_end` for the timeframes returned. This is a transform on top of the cumulative costs, calculated by taking the difference of each timeframe with the last. Note that in the above example, the `Total` value would be 0 for the second two data points, since the minimum commitment has not yet been hit and each day is not contributing anything to the total cost.

## Timeframe bounds

If no timeframe bounds are specified, the response will default to the current billing period for the customer's subscription. For subscriptions that have ended, this will be the billing period when they were last active. If the subscription starts or ends within the timeframe, the response will only include windows where the subscription is active.

As noted above, `timeframe_start` for a given cumulative datapoint is always the beginning of the billing period, and `timeframe_end` is incremented one day at a time to construct the response. When a timeframe is passed in that is not aligned to the current subscription's billing period, the response will contain cumulative totals from multiple billing periods.

Suppose the queried customer has a subscription aligned to the 15th of every month. If this endpoint is queried with the date range `2023-06-01` - `2023-07-01`, the first data point will represent about half a billing period's worth of costs, accounting for accruals from the start of the billing period and inclusive of the first day of the timeframe (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)

| datapoint index | timeframe_start | timeframe_end | | --------------- | --------------- | ------------- | | 0 | 2023-05-15 | 2023-06-02 | | 1 | 2023-05-15 | 2023-06-03 | | 2 | ... | ... | | 3 | 2023-05-15 | 2023-06-14 | | 4 | 2023-06-15 | 2023-06-16 | | 5 | 2023-06-15 | 2023-06-17 | | 6 | ... | ... | | 7 | 2023-06-15 | 2023-07-01 |

You can see this sliced timeframe visualized [here](https://i.imgur.com/TXhYgme.png).

## Grouping by custom attributes

In order to view costs grouped by a specific _attribute_ that each event is tagged with (i.e. `cluster`), you can additionally specify a `group_by` key. The `group_by` key denotes the event property on which to group.

When returning grouped costs, a separate `price_group` object in the `per_price_costs` array is returned for each value of the `group_by` key present in your events. The `subtotal` value of the `per_price_costs` object is the sum of each `price_group`'s total.

Orb expects events will contain values in the `properties` dictionary that correspond to the `group_by` key specified. By default, Orb will return a `null` group (i.e. events that match the metric but do not have the key set). Currently, it is only possible to view costs grouped by a single attribute at a time.

### Matrix prices

When a price uses matrix pricing, it's important to view costs grouped by those matrix dimensions. Orb will return `price_groups` with the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` and `secondary_grouping_value` available.

func (*CustomerCostService) ListByExternalID

func (r *CustomerCostService) ListByExternalID(ctx context.Context, externalCustomerID string, query CustomerCostListByExternalIDParams, opts ...option.RequestOption) (res *CustomerCostListByExternalIDResponse, err error)

This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated by applying pricing information to the underlying usage (see the [subscription usage endpoint](fetch-subscription-usage.api.mdx) to fetch usage per metric, in usage units rather than a currency).

This endpoint can be leveraged for internal tooling and to provide a more transparent billing experience for your end users:

  1. Understand the cost breakdown per line item historically and in real-time for the current billing period.
  2. Provide customer visibility into how different services are contributing to the overall invoice with a per-day timeseries (as compared to the [upcoming invoice](fetch-upcoming-invoice) resource, which represents a snapshot for the current period).
  3. Assess how minimums and discounts affect your customers by teasing apart costs directly as a result of usage, as opposed to minimums and discounts at the plan and price level.
  4. Gain insight into key customer health metrics, such as the percent utilization of the minimum committed spend.

## Fetching subscriptions

By default, this endpoint fetches the currently active subscription for the customer, and returns cost information for the subscription's current billing period, broken down by each participating price. If there are no currently active subscriptions, this will instead default to the most recently active subscription or return an empty series if none are found. For example, if your plan charges for compute hours, job runs, and data syncs, then this endpoint would provide a daily breakdown of your customer's cost for each of those axes.

If timeframe bounds are specified, Orb fetches all subscriptions that were active in that timeframe. If two subscriptions overlap on a single day, costs from each price will be summed, and prices for both subscriptions will be included in the breakdown.

## Prepaid plans

For plans that include prices which deduct credits rather than accrue in-arrears charges in a billable currency, this endpoint will return the total deduction amount, in credits, for the specified timeframe.

## Cumulative subtotals and totals

Since the subtotal and total must factor in any billing-period level discounts and minimums, it's most meaningful to consider costs relative to the start of the subscription's billing period. As a result, by default this endpoint returns cumulative totals since the beginning of the billing period. In particular, the `timeframe_start` of a returned timeframe window is _always_ the beginning of the billing period and `timeframe_end` is incremented one day at a time to build the result.

A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days of the month. Here, we assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this price, and that the subscription's billing period bounds are aligned to the first of the month:

| timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |

### Periodic values

When the query parameter `view_mode=periodic` is specified, Orb will return an incremental day-by-day view of costs. In this case, there will always be a one-day difference between `timeframe_start` and `timeframe_end` for the timeframes returned. This is a transform on top of the cumulative costs, calculated by taking the difference of each timeframe with the last. Note that in the above example, the `Total` value would be 0 for the second two data points, since the minimum commitment has not yet been hit and each day is not contributing anything to the total cost.

## Timeframe bounds

If no timeframe bounds are specified, the response will default to the current billing period for the customer's subscription. For subscriptions that have ended, this will be the billing period when they were last active. If the subscription starts or ends within the timeframe, the response will only include windows where the subscription is active.

As noted above, `timeframe_start` for a given cumulative datapoint is always the beginning of the billing period, and `timeframe_end` is incremented one day at a time to construct the response. When a timeframe is passed in that is not aligned to the current subscription's billing period, the response will contain cumulative totals from multiple billing periods.

Suppose the queried customer has a subscription aligned to the 15th of every month. If this endpoint is queried with the date range `2023-06-01` - `2023-07-01`, the first data point will represent about half a billing period's worth of costs, accounting for accruals from the start of the billing period and inclusive of the first day of the timeframe (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)

| datapoint index | timeframe_start | timeframe_end | | --------------- | --------------- | ------------- | | 0 | 2023-05-15 | 2023-06-02 | | 1 | 2023-05-15 | 2023-06-03 | | 2 | ... | ... | | 3 | 2023-05-15 | 2023-06-14 | | 4 | 2023-06-15 | 2023-06-16 | | 5 | 2023-06-15 | 2023-06-17 | | 6 | ... | ... | | 7 | 2023-06-15 | 2023-07-01 |

You can see this sliced timeframe visualized [here](https://i.imgur.com/TXhYgme.png).

## Grouping by custom attributes

In order to view costs grouped by a specific _attribute_ that each event is tagged with (i.e. `cluster`), you can additionally specify a `group_by` key. The `group_by` key denotes the event property on which to group.

When returning grouped costs, a separate `price_group` object in the `per_price_costs` array is returned for each value of the `group_by` key present in your events. The `subtotal` value of the `per_price_costs` object is the sum of each `price_group`'s total.

Orb expects events will contain values in the `properties` dictionary that correspond to the `group_by` key specified. By default, Orb will return a `null` group (i.e. events that match the metric but do not have the key set). Currently, it is only possible to view costs grouped by a single attribute at a time.

### Matrix prices

When a price uses matrix pricing, it's important to view costs grouped by those matrix dimensions. Orb will return `price_groups` with the `grouping_key` and `secondary_grouping_key` based on the matrix price definition, for each `grouping_value` and `secondary_grouping_value` available.

type CustomerCreditLedgerListByExternalIDParams

type CustomerCreditLedgerListByExternalIDParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	Currency     param.Field[string]    `query:"currency"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor      param.Field[string]                                                `query:"cursor"`
	EntryStatus param.Field[CustomerCreditLedgerListByExternalIDParamsEntryStatus] `query:"entry_status"`
	EntryType   param.Field[CustomerCreditLedgerListByExternalIDParamsEntryType]   `query:"entry_type"`
	// The number of items to fetch. Defaults to 20.
	Limit         param.Field[int64]  `query:"limit"`
	MinimumAmount param.Field[string] `query:"minimum_amount"`
}

func (CustomerCreditLedgerListByExternalIDParams) URLQuery

URLQuery serializes CustomerCreditLedgerListByExternalIDParams's query parameters as `url.Values`.

type CustomerCreditLedgerListByExternalIDParamsEntryStatus

type CustomerCreditLedgerListByExternalIDParamsEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDParamsEntryStatusCommitted CustomerCreditLedgerListByExternalIDParamsEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDParamsEntryStatusPending   CustomerCreditLedgerListByExternalIDParamsEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDParamsEntryType

type CustomerCreditLedgerListByExternalIDParamsEntryType string
const (
	CustomerCreditLedgerListByExternalIDParamsEntryTypeIncrement         CustomerCreditLedgerListByExternalIDParamsEntryType = "increment"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeDecrement         CustomerCreditLedgerListByExternalIDParamsEntryType = "decrement"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeExpirationChange  CustomerCreditLedgerListByExternalIDParamsEntryType = "expiration_change"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeCreditBlockExpiry CustomerCreditLedgerListByExternalIDParamsEntryType = "credit_block_expiry"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeVoid              CustomerCreditLedgerListByExternalIDParamsEntryType = "void"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeVoidInitiated     CustomerCreditLedgerListByExternalIDParamsEntryType = "void_initiated"
	CustomerCreditLedgerListByExternalIDParamsEntryTypeAmendment         CustomerCreditLedgerListByExternalIDParamsEntryType = "amendment"
)

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntry struct {
	ID                   string                                                                      `json:"id,required"`
	Amount               float64                                                                     `json:"amount,required"`
	CreatedAt            time.Time                                                                   `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                      `json:"description,required,nullable"`
	EndingBalance        float64                                                                     `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                       `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                           `json:"metadata,required"`
	StartingBalance      float64                                                                     `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryTypeAmendment CustomerCreditLedgerListByExternalIDResponseAmendmentLedgerEntryEntryType = "amendment"
)

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntry struct {
	ID                   string                                                                              `json:"id,required"`
	Amount               float64                                                                             `json:"amount,required"`
	CreatedAt            time.Time                                                                           `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                              `json:"description,required,nullable"`
	EndingBalance        float64                                                                             `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                               `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                                   `json:"metadata,required"`
	StartingBalance      float64                                                                             `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryTypeCreditBlockExpiry CustomerCreditLedgerListByExternalIDResponseCreditBlockExpiryLedgerEntryEntryType = "credit_block_expiry"
)

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntry struct {
	ID                   string                                                                      `json:"id,required"`
	Amount               float64                                                                     `json:"amount,required"`
	CreatedAt            time.Time                                                                   `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                      `json:"description,required,nullable"`
	EndingBalance        float64                                                                     `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                       `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                           `json:"metadata,required"`
	StartingBalance      float64                                                                     `json:"starting_balance,required"`
	EventID              string                                                                      `json:"event_id,nullable"`
	InvoiceID            string                                                                      `json:"invoice_id,nullable"`
	PriceID              string                                                                      `json:"price_id,nullable"`
	JSON                 customerCreditLedgerListByExternalIDResponseDecrementLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryTypeDecrement CustomerCreditLedgerListByExternalIDResponseDecrementLedgerEntryEntryType = "decrement"
)

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntry struct {
	ID                   string                                                                             `json:"id,required"`
	Amount               float64                                                                            `json:"amount,required"`
	CreatedAt            time.Time                                                                          `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                             `json:"description,required,nullable"`
	EndingBalance        float64                                                                            `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                              `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                                  `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                                          `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                            `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryTypeExpirationChange CustomerCreditLedgerListByExternalIDResponseExpirationChangeLedgerEntryEntryType = "expiration_change"
)

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntry struct {
	ID                   string                                                                      `json:"id,required"`
	Amount               float64                                                                     `json:"amount,required"`
	CreatedAt            time.Time                                                                   `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                      `json:"description,required,nullable"`
	EndingBalance        float64                                                                     `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                       `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                           `json:"metadata,required"`
	StartingBalance      float64                                                                     `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListByExternalIDResponseIncrementLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryTypeIncrement CustomerCreditLedgerListByExternalIDResponseIncrementLedgerEntryEntryType = "increment"
)

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntry struct {
	ID                   string                                                                          `json:"id,required"`
	Amount               float64                                                                         `json:"amount,required"`
	CreatedAt            time.Time                                                                       `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                          `json:"description,required,nullable"`
	EndingBalance        float64                                                                         `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                           `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                               `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                                       `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                         `json:"starting_balance,required"`
	VoidAmount           float64                                                                         `json:"void_amount,required"`
	VoidReason           string                                                                          `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryTypeVoidInitiated CustomerCreditLedgerListByExternalIDResponseVoidInitiatedLedgerEntryEntryType = "void_initiated"
)

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntry

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntry struct {
	ID                   string                                                                 `json:"id,required"`
	Amount               float64                                                                `json:"amount,required"`
	CreatedAt            time.Time                                                              `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                 `json:"description,required,nullable"`
	EndingBalance        float64                                                                `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                  `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                      `json:"metadata,required"`
	StartingBalance      float64                                                                `json:"starting_balance,required"`
	VoidAmount           float64                                                                `json:"void_amount,required"`
	VoidReason           string                                                                 `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerListByExternalIDResponseVoidLedgerEntryJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCreditBlock

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListByExternalIDResponseVoidLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCustomer

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListByExternalIDResponseVoidLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatus

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatusCommitted CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatusPending   CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryType

type CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryType string
const (
	CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryTypeVoid CustomerCreditLedgerListByExternalIDResponseVoidLedgerEntryEntryType = "void"
)

type CustomerCreditLedgerListParams

type CustomerCreditLedgerListParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	Currency     param.Field[string]    `query:"currency"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor      param.Field[string]                                    `query:"cursor"`
	EntryStatus param.Field[CustomerCreditLedgerListParamsEntryStatus] `query:"entry_status"`
	EntryType   param.Field[CustomerCreditLedgerListParamsEntryType]   `query:"entry_type"`
	// The number of items to fetch. Defaults to 20.
	Limit         param.Field[int64]  `query:"limit"`
	MinimumAmount param.Field[string] `query:"minimum_amount"`
}

func (CustomerCreditLedgerListParams) URLQuery

func (r CustomerCreditLedgerListParams) URLQuery() (v url.Values)

URLQuery serializes CustomerCreditLedgerListParams's query parameters as `url.Values`.

type CustomerCreditLedgerListParamsEntryStatus

type CustomerCreditLedgerListParamsEntryStatus string
const (
	CustomerCreditLedgerListParamsEntryStatusCommitted CustomerCreditLedgerListParamsEntryStatus = "committed"
	CustomerCreditLedgerListParamsEntryStatusPending   CustomerCreditLedgerListParamsEntryStatus = "pending"
)

type CustomerCreditLedgerListParamsEntryType

type CustomerCreditLedgerListParamsEntryType string
const (
	CustomerCreditLedgerListParamsEntryTypeIncrement         CustomerCreditLedgerListParamsEntryType = "increment"
	CustomerCreditLedgerListParamsEntryTypeDecrement         CustomerCreditLedgerListParamsEntryType = "decrement"
	CustomerCreditLedgerListParamsEntryTypeExpirationChange  CustomerCreditLedgerListParamsEntryType = "expiration_change"
	CustomerCreditLedgerListParamsEntryTypeCreditBlockExpiry CustomerCreditLedgerListParamsEntryType = "credit_block_expiry"
	CustomerCreditLedgerListParamsEntryTypeVoid              CustomerCreditLedgerListParamsEntryType = "void"
	CustomerCreditLedgerListParamsEntryTypeVoidInitiated     CustomerCreditLedgerListParamsEntryType = "void_initiated"
	CustomerCreditLedgerListParamsEntryTypeAmendment         CustomerCreditLedgerListParamsEntryType = "amendment"
)

type CustomerCreditLedgerListResponseAmendmentLedgerEntry

type CustomerCreditLedgerListResponseAmendmentLedgerEntry struct {
	ID                   string                                                          `json:"id,required"`
	Amount               float64                                                         `json:"amount,required"`
	CreatedAt            time.Time                                                       `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseAmendmentLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseAmendmentLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                          `json:"description,required,nullable"`
	EndingBalance        float64                                                         `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                           `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                               `json:"metadata,required"`
	StartingBalance      float64                                                         `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListResponseAmendmentLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseAmendmentLedgerEntry) UnmarshalJSON

func (r *CustomerCreditLedgerListResponseAmendmentLedgerEntry) UnmarshalJSON(data []byte) (err error)

type CustomerCreditLedgerListResponseAmendmentLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseAmendmentLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseAmendmentLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseAmendmentLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseAmendmentLedgerEntryCustomer

type CustomerCreditLedgerListResponseAmendmentLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseAmendmentLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseAmendmentLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryType

type CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryTypeAmendment CustomerCreditLedgerListResponseAmendmentLedgerEntryEntryType = "amendment"
)

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntry

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntry struct {
	ID                   string                                                                  `json:"id,required"`
	Amount               float64                                                                 `json:"amount,required"`
	CreatedAt            time.Time                                                               `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                  `json:"description,required,nullable"`
	EndingBalance        float64                                                                 `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                   `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                       `json:"metadata,required"`
	StartingBalance      float64                                                                 `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListResponseCreditBlockExpiryLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCustomer

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryType

type CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryTypeCreditBlockExpiry CustomerCreditLedgerListResponseCreditBlockExpiryLedgerEntryEntryType = "credit_block_expiry"
)

type CustomerCreditLedgerListResponseDecrementLedgerEntry

type CustomerCreditLedgerListResponseDecrementLedgerEntry struct {
	ID                   string                                                          `json:"id,required"`
	Amount               float64                                                         `json:"amount,required"`
	CreatedAt            time.Time                                                       `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseDecrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseDecrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                          `json:"description,required,nullable"`
	EndingBalance        float64                                                         `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseDecrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                           `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                               `json:"metadata,required"`
	StartingBalance      float64                                                         `json:"starting_balance,required"`
	EventID              string                                                          `json:"event_id,nullable"`
	InvoiceID            string                                                          `json:"invoice_id,nullable"`
	PriceID              string                                                          `json:"price_id,nullable"`
	JSON                 customerCreditLedgerListResponseDecrementLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseDecrementLedgerEntry) UnmarshalJSON

func (r *CustomerCreditLedgerListResponseDecrementLedgerEntry) UnmarshalJSON(data []byte) (err error)

type CustomerCreditLedgerListResponseDecrementLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseDecrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseDecrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseDecrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseDecrementLedgerEntryCustomer

type CustomerCreditLedgerListResponseDecrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseDecrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseDecrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseDecrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseDecrementLedgerEntryEntryType

type CustomerCreditLedgerListResponseDecrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseDecrementLedgerEntryEntryTypeDecrement CustomerCreditLedgerListResponseDecrementLedgerEntryEntryType = "decrement"
)

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntry

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntry struct {
	ID                   string                                                                 `json:"id,required"`
	Amount               float64                                                                `json:"amount,required"`
	CreatedAt            time.Time                                                              `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                 `json:"description,required,nullable"`
	EndingBalance        float64                                                                `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                  `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                      `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                              `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListResponseExpirationChangeLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseExpirationChangeLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseExpirationChangeLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCustomer

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseExpirationChangeLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseExpirationChangeLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryType

type CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryTypeExpirationChange CustomerCreditLedgerListResponseExpirationChangeLedgerEntryEntryType = "expiration_change"
)

type CustomerCreditLedgerListResponseIncrementLedgerEntry

type CustomerCreditLedgerListResponseIncrementLedgerEntry struct {
	ID                   string                                                          `json:"id,required"`
	Amount               float64                                                         `json:"amount,required"`
	CreatedAt            time.Time                                                       `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseIncrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseIncrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                          `json:"description,required,nullable"`
	EndingBalance        float64                                                         `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseIncrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                           `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                               `json:"metadata,required"`
	StartingBalance      float64                                                         `json:"starting_balance,required"`
	JSON                 customerCreditLedgerListResponseIncrementLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseIncrementLedgerEntry) UnmarshalJSON

func (r *CustomerCreditLedgerListResponseIncrementLedgerEntry) UnmarshalJSON(data []byte) (err error)

type CustomerCreditLedgerListResponseIncrementLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseIncrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseIncrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseIncrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseIncrementLedgerEntryCustomer

type CustomerCreditLedgerListResponseIncrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseIncrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseIncrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseIncrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseIncrementLedgerEntryEntryType

type CustomerCreditLedgerListResponseIncrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseIncrementLedgerEntryEntryTypeIncrement CustomerCreditLedgerListResponseIncrementLedgerEntryEntryType = "increment"
)

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntry

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntry struct {
	ID                   string                                                              `json:"id,required"`
	Amount               float64                                                             `json:"amount,required"`
	CreatedAt            time.Time                                                           `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                              `json:"description,required,nullable"`
	EndingBalance        float64                                                             `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                               `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                   `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                           `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                             `json:"starting_balance,required"`
	VoidAmount           float64                                                             `json:"void_amount,required"`
	VoidReason           string                                                              `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerListResponseVoidInitiatedLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseVoidInitiatedLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseVoidInitiatedLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCustomer

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseVoidInitiatedLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryType

type CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryTypeVoidInitiated CustomerCreditLedgerListResponseVoidInitiatedLedgerEntryEntryType = "void_initiated"
)

type CustomerCreditLedgerListResponseVoidLedgerEntry

type CustomerCreditLedgerListResponseVoidLedgerEntry struct {
	ID                   string                                                     `json:"id,required"`
	Amount               float64                                                    `json:"amount,required"`
	CreatedAt            time.Time                                                  `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerListResponseVoidLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerListResponseVoidLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                     `json:"description,required,nullable"`
	EndingBalance        float64                                                    `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerListResponseVoidLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                      `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                          `json:"metadata,required"`
	StartingBalance      float64                                                    `json:"starting_balance,required"`
	VoidAmount           float64                                                    `json:"void_amount,required"`
	VoidReason           string                                                     `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerListResponseVoidLedgerEntryJSON
}

func (*CustomerCreditLedgerListResponseVoidLedgerEntry) UnmarshalJSON

func (r *CustomerCreditLedgerListResponseVoidLedgerEntry) UnmarshalJSON(data []byte) (err error)

type CustomerCreditLedgerListResponseVoidLedgerEntryCreditBlock

type CustomerCreditLedgerListResponseVoidLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerListResponseVoidLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerListResponseVoidLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerListResponseVoidLedgerEntryCustomer

type CustomerCreditLedgerListResponseVoidLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerListResponseVoidLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerListResponseVoidLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatus

type CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatusCommitted CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatusPending   CustomerCreditLedgerListResponseVoidLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerListResponseVoidLedgerEntryEntryType

type CustomerCreditLedgerListResponseVoidLedgerEntryEntryType string
const (
	CustomerCreditLedgerListResponseVoidLedgerEntryEntryTypeVoid CustomerCreditLedgerListResponseVoidLedgerEntryEntryType = "void"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement or void operations.
	Amount param.Field[float64] `json:"amount,required"`
	// The ID of the block to reverse a decrement from.
	BlockID   param.Field[string]                                                                                           `json:"block_id,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams()

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParamsEntryTypeAmendment CustomerCreditLedgerNewEntryByExteralIDParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType = "amendment"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount    param.Field[float64]                                                                                          `json:"amount,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams()

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParamsEntryTypeDecrement CustomerCreditLedgerNewEntryByExteralIDParamsAddDecrementCreditLedgerEntryRequestParamsEntryType = "decrement"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParams struct {
	EntryType param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// A future date (specified in YYYY-MM-DD format) that identifies the origination
	// credit block to expire
	ExpiryDate param.Field[time.Time] `json:"expiry_date,required" format:"date"`
	// A future date (specified in YYYY-MM-DD format) used for expiration change,
	// denoting when credits transferred (as part of a partial block expiration) should
	// expire.
	TargetExpiryDate param.Field[time.Time] `json:"target_expiry_date,required" format:"date"`
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount param.Field[float64] `json:"amount"`
	// The ID of the block affected by an expiration_change, used to differentiate
	// between multiple blocks with the same `expiry_date`.
	BlockID param.Field[string] `json:"block_id"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams()

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryTypeExpirationChange CustomerCreditLedgerNewEntryByExteralIDParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType = "expiration_change"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount    param.Field[float64]                                                                                          `json:"amount,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// A future date (specified in YYYY-MM-DD format) that denotes when this credit
	// balance should become available for use.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A future date (specified in YYYY-MM-DD format) that denotes when this credit
	// balance should expire.
	ExpiryDate param.Field[time.Time] `json:"expiry_date" format:"date"`
	// Passing `invoice_settings` automatically generates an invoice for the newly
	// added credits. If `invoice_settings` is passed, you must specify
	// per_unit_cost_basis, as the calculation of the invoice total is done on that
	// basis.
	InvoiceSettings param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings] `json:"invoice_settings"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Can only be specified when entry_type=increment. How much, in USD, a customer
	// paid for a single credit in this block
	PerUnitCostBasis param.Field[string] `json:"per_unit_cost_basis"`
}

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams()

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsEntryTypeIncrement CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsEntryType = "increment"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings

type CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings struct {
	// Whether the credits purchase invoice should auto collect with the customer's
	// saved payment method.
	AutoCollection param.Field[bool] `json:"auto_collection,required"`
	// The net terms determines the difference between the invoice date and the issue
	// date for the invoice. If you intend the invoice to be due on issue, set this
	// to 0.
	NetTerms param.Field[int64] `json:"net_terms,required"`
	// An optional memo to display on the invoice.
	Memo param.Field[string] `json:"memo"`
}

Passing `invoice_settings` automatically generates an invoice for the newly added credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the calculation of the invoice total is done on that basis.

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount param.Field[float64] `json:"amount,required"`
	// The ID of the block to void.
	BlockID   param.Field[string]                                                                                      `json:"block_id,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Can only be specified when `entry_type=void`. The reason for the void.
	VoidReason param.Field[CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsVoidReason] `json:"void_reason"`
}

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryByExteralIDParams()

func (CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsEntryTypeVoid CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsEntryType = "void"
)

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsVoidReason

type CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsVoidReason string

Can only be specified when `entry_type=void`. The reason for the void.

const (
	CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsVoidReasonRefund CustomerCreditLedgerNewEntryByExteralIDParamsAddVoidCreditLedgerEntryRequestParamsVoidReason = "refund"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntry struct {
	ID                   string                                                                         `json:"id,required"`
	Amount               float64                                                                        `json:"amount,required"`
	CreatedAt            time.Time                                                                      `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                         `json:"description,required,nullable"`
	EndingBalance        float64                                                                        `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                          `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                              `json:"metadata,required"`
	StartingBalance      float64                                                                        `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryTypeAmendment CustomerCreditLedgerNewEntryByExteralIDResponseAmendmentLedgerEntryEntryType = "amendment"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntry struct {
	ID                   string                                                                                 `json:"id,required"`
	Amount               float64                                                                                `json:"amount,required"`
	CreatedAt            time.Time                                                                              `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                                 `json:"description,required,nullable"`
	EndingBalance        float64                                                                                `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                                  `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                                      `json:"metadata,required"`
	StartingBalance      float64                                                                                `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryTypeCreditBlockExpiry CustomerCreditLedgerNewEntryByExteralIDResponseCreditBlockExpiryLedgerEntryEntryType = "credit_block_expiry"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntry struct {
	ID                   string                                                                         `json:"id,required"`
	Amount               float64                                                                        `json:"amount,required"`
	CreatedAt            time.Time                                                                      `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                         `json:"description,required,nullable"`
	EndingBalance        float64                                                                        `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                          `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                              `json:"metadata,required"`
	StartingBalance      float64                                                                        `json:"starting_balance,required"`
	EventID              string                                                                         `json:"event_id,nullable"`
	InvoiceID            string                                                                         `json:"invoice_id,nullable"`
	PriceID              string                                                                         `json:"price_id,nullable"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryTypeDecrement CustomerCreditLedgerNewEntryByExteralIDResponseDecrementLedgerEntryEntryType = "decrement"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntry struct {
	ID                   string                                                                                `json:"id,required"`
	Amount               float64                                                                               `json:"amount,required"`
	CreatedAt            time.Time                                                                             `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                                `json:"description,required,nullable"`
	EndingBalance        float64                                                                               `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                                 `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                                     `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                                             `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                               `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryTypeExpirationChange CustomerCreditLedgerNewEntryByExteralIDResponseExpirationChangeLedgerEntryEntryType = "expiration_change"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntry struct {
	ID                   string                                                                         `json:"id,required"`
	Amount               float64                                                                        `json:"amount,required"`
	CreatedAt            time.Time                                                                      `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                         `json:"description,required,nullable"`
	EndingBalance        float64                                                                        `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                          `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                              `json:"metadata,required"`
	StartingBalance      float64                                                                        `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryTypeIncrement CustomerCreditLedgerNewEntryByExteralIDResponseIncrementLedgerEntryEntryType = "increment"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntry struct {
	ID                   string                                                                             `json:"id,required"`
	Amount               float64                                                                            `json:"amount,required"`
	CreatedAt            time.Time                                                                          `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                             `json:"description,required,nullable"`
	EndingBalance        float64                                                                            `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                              `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                                  `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                                          `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                            `json:"starting_balance,required"`
	VoidAmount           float64                                                                            `json:"void_amount,required"`
	VoidReason           string                                                                             `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryTypeVoidInitiated CustomerCreditLedgerNewEntryByExteralIDResponseVoidInitiatedLedgerEntryEntryType = "void_initiated"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntry

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntry struct {
	ID                   string                                                                    `json:"id,required"`
	Amount               float64                                                                   `json:"amount,required"`
	CreatedAt            time.Time                                                                 `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                    `json:"description,required,nullable"`
	EndingBalance        float64                                                                   `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                     `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                         `json:"metadata,required"`
	StartingBalance      float64                                                                   `json:"starting_balance,required"`
	VoidAmount           float64                                                                   `json:"void_amount,required"`
	VoidReason           string                                                                    `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCustomer

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryType

type CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryTypeVoid CustomerCreditLedgerNewEntryByExteralIDResponseVoidLedgerEntryEntryType = "void"
)

type CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement or void operations.
	Amount param.Field[float64] `json:"amount,required"`
	// The ID of the block to reverse a decrement from.
	BlockID   param.Field[string]                                                                                `json:"block_id,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams

func (CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams()

func (CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParamsEntryTypeAmendment CustomerCreditLedgerNewEntryParamsAddAmendmentCreditLedgerEntryRequestParamsEntryType = "amendment"
)

type CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount    param.Field[float64]                                                                               `json:"amount,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams

func (CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams()

func (CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParamsEntryTypeDecrement CustomerCreditLedgerNewEntryParamsAddDecrementCreditLedgerEntryRequestParamsEntryType = "decrement"
)

type CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParams struct {
	EntryType param.Field[CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// A future date (specified in YYYY-MM-DD format) that identifies the origination
	// credit block to expire
	ExpiryDate param.Field[time.Time] `json:"expiry_date,required" format:"date"`
	// A future date (specified in YYYY-MM-DD format) used for expiration change,
	// denoting when credits transferred (as part of a partial block expiration) should
	// expire.
	TargetExpiryDate param.Field[time.Time] `json:"target_expiry_date,required" format:"date"`
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount param.Field[float64] `json:"amount"`
	// The ID of the block affected by an expiration_change, used to differentiate
	// between multiple blocks with the same `expiry_date`.
	BlockID param.Field[string] `json:"block_id"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams

func (CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams()

func (CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryTypeExpirationChange CustomerCreditLedgerNewEntryParamsAddExpirationChangeCreditLedgerEntryRequestParamsEntryType = "expiration_change"
)

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount    param.Field[float64]                                                                               `json:"amount,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// A future date (specified in YYYY-MM-DD format) that denotes when this credit
	// balance should become available for use.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
	// A future date (specified in YYYY-MM-DD format) that denotes when this credit
	// balance should expire.
	ExpiryDate param.Field[time.Time] `json:"expiry_date" format:"date"`
	// Passing `invoice_settings` automatically generates an invoice for the newly
	// added credits. If `invoice_settings` is passed, you must specify
	// per_unit_cost_basis, as the calculation of the invoice total is done on that
	// basis.
	InvoiceSettings param.Field[CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings] `json:"invoice_settings"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Can only be specified when entry_type=increment. How much, in USD, a customer
	// paid for a single credit in this block
	PerUnitCostBasis param.Field[string] `json:"per_unit_cost_basis"`
}

func (CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams

func (CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams()

func (CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsEntryTypeIncrement CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsEntryType = "increment"
)

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings

type CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings struct {
	// Whether the credits purchase invoice should auto collect with the customer's
	// saved payment method.
	AutoCollection param.Field[bool] `json:"auto_collection,required"`
	// The net terms determines the difference between the invoice date and the issue
	// date for the invoice. If you intend the invoice to be due on issue, set this
	// to 0.
	NetTerms param.Field[int64] `json:"net_terms,required"`
	// An optional memo to display on the invoice.
	Memo param.Field[string] `json:"memo"`
}

Passing `invoice_settings` automatically generates an invoice for the newly added credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the calculation of the invoice total is done on that basis.

func (CustomerCreditLedgerNewEntryParamsAddIncrementCreditLedgerEntryRequestParamsInvoiceSettings) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParams

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParams struct {
	// The number of credits to effect. Note that this is required for increment,
	// decrement, void, or undo operations.
	Amount param.Field[float64] `json:"amount,required"`
	// The ID of the block to void.
	BlockID   param.Field[string]                                                                           `json:"block_id,required"`
	EntryType param.Field[CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsEntryType] `json:"entry_type,required"`
	// Optional metadata that can be specified when adding ledger results via the API.
	// For example, this can be used to note an increment refers to trial credits, or
	// for noting corrections as a result of an incident, etc.
	Description param.Field[string] `json:"description"`
	// User-specified key/value pairs for the ledger entry resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Can only be specified when `entry_type=void`. The reason for the void.
	VoidReason param.Field[CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsVoidReason] `json:"void_reason"`
}

func (CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams

func (CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParams) ImplementsCustomerCreditLedgerNewEntryParams()

func (CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParams) MarshalJSON

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsEntryType

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsEntryType string
const (
	CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsEntryTypeVoid CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsEntryType = "void"
)

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsVoidReason

type CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsVoidReason string

Can only be specified when `entry_type=void`. The reason for the void.

const (
	CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsVoidReasonRefund CustomerCreditLedgerNewEntryParamsAddVoidCreditLedgerEntryRequestParamsVoidReason = "refund"
)

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntry

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntry struct {
	ID                   string                                                              `json:"id,required"`
	Amount               float64                                                             `json:"amount,required"`
	CreatedAt            time.Time                                                           `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                              `json:"description,required,nullable"`
	EndingBalance        float64                                                             `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                               `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                   `json:"metadata,required"`
	StartingBalance      float64                                                             `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryResponseAmendmentLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseAmendmentLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseAmendmentLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryTypeAmendment CustomerCreditLedgerNewEntryResponseAmendmentLedgerEntryEntryType = "amendment"
)

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntry

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntry struct {
	ID                   string                                                                      `json:"id,required"`
	Amount               float64                                                                     `json:"amount,required"`
	CreatedAt            time.Time                                                                   `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                      `json:"description,required,nullable"`
	EndingBalance        float64                                                                     `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                       `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                           `json:"metadata,required"`
	StartingBalance      float64                                                                     `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryTypeCreditBlockExpiry CustomerCreditLedgerNewEntryResponseCreditBlockExpiryLedgerEntryEntryType = "credit_block_expiry"
)

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntry

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntry struct {
	ID                   string                                                              `json:"id,required"`
	Amount               float64                                                             `json:"amount,required"`
	CreatedAt            time.Time                                                           `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                              `json:"description,required,nullable"`
	EndingBalance        float64                                                             `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                               `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                   `json:"metadata,required"`
	StartingBalance      float64                                                             `json:"starting_balance,required"`
	EventID              string                                                              `json:"event_id,nullable"`
	InvoiceID            string                                                              `json:"invoice_id,nullable"`
	PriceID              string                                                              `json:"price_id,nullable"`
	JSON                 customerCreditLedgerNewEntryResponseDecrementLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseDecrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseDecrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseDecrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryTypeDecrement CustomerCreditLedgerNewEntryResponseDecrementLedgerEntryEntryType = "decrement"
)

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntry

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntry struct {
	ID                   string                                                                     `json:"id,required"`
	Amount               float64                                                                    `json:"amount,required"`
	CreatedAt            time.Time                                                                  `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                     `json:"description,required,nullable"`
	EndingBalance        float64                                                                    `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                      `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                          `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                                  `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                    `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryTypeExpirationChange CustomerCreditLedgerNewEntryResponseExpirationChangeLedgerEntryEntryType = "expiration_change"
)

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntry

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntry struct {
	ID                   string                                                              `json:"id,required"`
	Amount               float64                                                             `json:"amount,required"`
	CreatedAt            time.Time                                                           `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                              `json:"description,required,nullable"`
	EndingBalance        float64                                                             `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                               `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                   `json:"metadata,required"`
	StartingBalance      float64                                                             `json:"starting_balance,required"`
	JSON                 customerCreditLedgerNewEntryResponseIncrementLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseIncrementLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseIncrementLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseIncrementLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryTypeIncrement CustomerCreditLedgerNewEntryResponseIncrementLedgerEntryEntryType = "increment"
)

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntry

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntry struct {
	ID                   string                                                                  `json:"id,required"`
	Amount               float64                                                                 `json:"amount,required"`
	CreatedAt            time.Time                                                               `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                                  `json:"description,required,nullable"`
	EndingBalance        float64                                                                 `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                                   `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                                       `json:"metadata,required"`
	NewBlockExpiryDate   time.Time                                                               `json:"new_block_expiry_date,required" format:"date-time"`
	StartingBalance      float64                                                                 `json:"starting_balance,required"`
	VoidAmount           float64                                                                 `json:"void_amount,required"`
	VoidReason           string                                                                  `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntry) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryTypeVoidInitiated CustomerCreditLedgerNewEntryResponseVoidInitiatedLedgerEntryEntryType = "void_initiated"
)

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntry

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntry struct {
	ID                   string                                                         `json:"id,required"`
	Amount               float64                                                        `json:"amount,required"`
	CreatedAt            time.Time                                                      `json:"created_at,required" format:"date-time"`
	CreditBlock          CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCreditBlock `json:"credit_block,required"`
	Customer             CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCustomer    `json:"customer,required"`
	Description          string                                                         `json:"description,required,nullable"`
	EndingBalance        float64                                                        `json:"ending_balance,required"`
	EntryStatus          CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatus `json:"entry_status,required"`
	EntryType            CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryType   `json:"entry_type,required"`
	LedgerSequenceNumber int64                                                          `json:"ledger_sequence_number,required"`
	Metadata             map[string]string                                              `json:"metadata,required"`
	StartingBalance      float64                                                        `json:"starting_balance,required"`
	VoidAmount           float64                                                        `json:"void_amount,required"`
	VoidReason           string                                                         `json:"void_reason,required,nullable"`
	JSON                 customerCreditLedgerNewEntryResponseVoidLedgerEntryJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidLedgerEntry) UnmarshalJSON

func (r *CustomerCreditLedgerNewEntryResponseVoidLedgerEntry) UnmarshalJSON(data []byte) (err error)

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCreditBlock

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCreditBlock struct {
	ID               string    `json:"id,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditLedgerNewEntryResponseVoidLedgerEntryCreditBlockJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCreditBlock) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCustomer

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               customerCreditLedgerNewEntryResponseVoidLedgerEntryCustomerJSON
}

func (*CustomerCreditLedgerNewEntryResponseVoidLedgerEntryCustomer) UnmarshalJSON

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatus

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatus string
const (
	CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatusCommitted CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatus = "committed"
	CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatusPending   CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryStatus = "pending"
)

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryType

type CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryType string
const (
	CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryTypeVoid CustomerCreditLedgerNewEntryResponseVoidLedgerEntryEntryType = "void"
)

type CustomerCreditLedgerService

type CustomerCreditLedgerService struct {
	Options []option.RequestOption
}

CustomerCreditLedgerService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerCreditLedgerService method instead.

func NewCustomerCreditLedgerService

func NewCustomerCreditLedgerService(opts ...option.RequestOption) (r *CustomerCreditLedgerService)

NewCustomerCreditLedgerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerCreditLedgerService) List

The credits ledger provides _auditing_ functionality over Orb's credits system with a list of actions that have taken place to modify a customer's credit balance. This [paginated endpoint](../reference/pagination) lists these entries, starting from the most recent ledger entry.

More details on using Orb's real-time credit feature are [here](../guides/product-catalog/prepurchase.md).

There are four major types of modifications to credit balance, detailed below.

## Increment

Credits (which optionally expire on a future date) can be added via the API ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action will always contain the total eligible starting and ending balance for the customer at the time the entry was added to the ledger.

## Decrement

Deductions can occur as a result of an API call to create a ledger entry (see [Add Ledger Entry](create-ledger-entry)), or automatically as a result of incurring usage. Both ledger entries present the `decrement` entry type.

As usage for a customer is reported into Orb, credits may be deducted according to the customer's plan configuration. An automated deduction of this type will result in a ledger entry, also with a starting and ending balance. In order to provide better tracing capabilities for automatic deductions, Orb always associates each automatic deduction with the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are never deducted without an associated usage event.

By default, Orb uses an algorithm that automatically deducts from the _soonest expiring credit block_ first in order to ensure that all credits are utilized appropriately. As an example, if trial credits with an expiration date of 2 weeks from now are present for a customer, they will be used before any deductions take place from a non-expiring credit block.

If there are multiple blocks with the same expiration date, Orb will deduct from the block with the _lower cost basis_ first (ex. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis).

It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block which consists of unexpiring credits. Each of these deductions will lead to a _separate_ ledger entry, one per credit block that is deducted from. By default, the customer's total credit balance in Orb can be negative as a result of a decrement.

## Expiration change

The expiry of credits can be changed as a result of the API (See [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that specifies the balance as well as the initial and target expiry dates.

Note that for this entry type, `starting_balance` will equal `ending_balance`, and the `amount` represents the balance transferred. The credit block linked to the ledger entry is the source credit block from which there was an expiration change

## Credits expiry

When a set of credits expire on pre-set expiration date, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event. Note that credit expiry should always happen close to a date boundary in the customer's timezone.

## Void initiated

Credit blocks can be voided via the API. The `amount` on this entry corresponds to the number of credits that were remaining in the block at time of void. `void_reason` will be populated if the void is created with a reason.

## Void

When a set of credits is voided, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event.

## Amendment

When credits are added to a customer's balance as a result of a correction, this entry will be added to the ledger to indicate the adjustment of credits.

func (*CustomerCreditLedgerService) ListAutoPaging

The credits ledger provides _auditing_ functionality over Orb's credits system with a list of actions that have taken place to modify a customer's credit balance. This [paginated endpoint](../reference/pagination) lists these entries, starting from the most recent ledger entry.

More details on using Orb's real-time credit feature are [here](../guides/product-catalog/prepurchase.md).

There are four major types of modifications to credit balance, detailed below.

## Increment

Credits (which optionally expire on a future date) can be added via the API ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action will always contain the total eligible starting and ending balance for the customer at the time the entry was added to the ledger.

## Decrement

Deductions can occur as a result of an API call to create a ledger entry (see [Add Ledger Entry](create-ledger-entry)), or automatically as a result of incurring usage. Both ledger entries present the `decrement` entry type.

As usage for a customer is reported into Orb, credits may be deducted according to the customer's plan configuration. An automated deduction of this type will result in a ledger entry, also with a starting and ending balance. In order to provide better tracing capabilities for automatic deductions, Orb always associates each automatic deduction with the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are never deducted without an associated usage event.

By default, Orb uses an algorithm that automatically deducts from the _soonest expiring credit block_ first in order to ensure that all credits are utilized appropriately. As an example, if trial credits with an expiration date of 2 weeks from now are present for a customer, they will be used before any deductions take place from a non-expiring credit block.

If there are multiple blocks with the same expiration date, Orb will deduct from the block with the _lower cost basis_ first (ex. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis).

It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block which consists of unexpiring credits. Each of these deductions will lead to a _separate_ ledger entry, one per credit block that is deducted from. By default, the customer's total credit balance in Orb can be negative as a result of a decrement.

## Expiration change

The expiry of credits can be changed as a result of the API (See [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that specifies the balance as well as the initial and target expiry dates.

Note that for this entry type, `starting_balance` will equal `ending_balance`, and the `amount` represents the balance transferred. The credit block linked to the ledger entry is the source credit block from which there was an expiration change

## Credits expiry

When a set of credits expire on pre-set expiration date, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event. Note that credit expiry should always happen close to a date boundary in the customer's timezone.

## Void initiated

Credit blocks can be voided via the API. The `amount` on this entry corresponds to the number of credits that were remaining in the block at time of void. `void_reason` will be populated if the void is created with a reason.

## Void

When a set of credits is voided, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event.

## Amendment

When credits are added to a customer's balance as a result of a correction, this entry will be added to the ledger to indicate the adjustment of credits.

func (*CustomerCreditLedgerService) ListByExternalID

The credits ledger provides _auditing_ functionality over Orb's credits system with a list of actions that have taken place to modify a customer's credit balance. This [paginated endpoint](../reference/pagination) lists these entries, starting from the most recent ledger entry.

More details on using Orb's real-time credit feature are [here](../guides/product-catalog/prepurchase.md).

There are four major types of modifications to credit balance, detailed below.

## Increment

Credits (which optionally expire on a future date) can be added via the API ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action will always contain the total eligible starting and ending balance for the customer at the time the entry was added to the ledger.

## Decrement

Deductions can occur as a result of an API call to create a ledger entry (see [Add Ledger Entry](create-ledger-entry)), or automatically as a result of incurring usage. Both ledger entries present the `decrement` entry type.

As usage for a customer is reported into Orb, credits may be deducted according to the customer's plan configuration. An automated deduction of this type will result in a ledger entry, also with a starting and ending balance. In order to provide better tracing capabilities for automatic deductions, Orb always associates each automatic deduction with the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are never deducted without an associated usage event.

By default, Orb uses an algorithm that automatically deducts from the _soonest expiring credit block_ first in order to ensure that all credits are utilized appropriately. As an example, if trial credits with an expiration date of 2 weeks from now are present for a customer, they will be used before any deductions take place from a non-expiring credit block.

If there are multiple blocks with the same expiration date, Orb will deduct from the block with the _lower cost basis_ first (ex. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis).

It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block which consists of unexpiring credits. Each of these deductions will lead to a _separate_ ledger entry, one per credit block that is deducted from. By default, the customer's total credit balance in Orb can be negative as a result of a decrement.

## Expiration change

The expiry of credits can be changed as a result of the API (See [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that specifies the balance as well as the initial and target expiry dates.

Note that for this entry type, `starting_balance` will equal `ending_balance`, and the `amount` represents the balance transferred. The credit block linked to the ledger entry is the source credit block from which there was an expiration change

## Credits expiry

When a set of credits expire on pre-set expiration date, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event. Note that credit expiry should always happen close to a date boundary in the customer's timezone.

## Void initiated

Credit blocks can be voided via the API. The `amount` on this entry corresponds to the number of credits that were remaining in the block at time of void. `void_reason` will be populated if the void is created with a reason.

## Void

When a set of credits is voided, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event.

## Amendment

When credits are added to a customer's balance as a result of a correction, this entry will be added to the ledger to indicate the adjustment of credits.

func (*CustomerCreditLedgerService) ListByExternalIDAutoPaging

The credits ledger provides _auditing_ functionality over Orb's credits system with a list of actions that have taken place to modify a customer's credit balance. This [paginated endpoint](../reference/pagination) lists these entries, starting from the most recent ledger entry.

More details on using Orb's real-time credit feature are [here](../guides/product-catalog/prepurchase.md).

There are four major types of modifications to credit balance, detailed below.

## Increment

Credits (which optionally expire on a future date) can be added via the API ([Add Ledger Entry](create-ledger-entry)). The ledger entry for such an action will always contain the total eligible starting and ending balance for the customer at the time the entry was added to the ledger.

## Decrement

Deductions can occur as a result of an API call to create a ledger entry (see [Add Ledger Entry](create-ledger-entry)), or automatically as a result of incurring usage. Both ledger entries present the `decrement` entry type.

As usage for a customer is reported into Orb, credits may be deducted according to the customer's plan configuration. An automated deduction of this type will result in a ledger entry, also with a starting and ending balance. In order to provide better tracing capabilities for automatic deductions, Orb always associates each automatic deduction with the `event_id` at the time of ingestion, used to pinpoint _why_ credit deduction took place and to ensure that credits are never deducted without an associated usage event.

By default, Orb uses an algorithm that automatically deducts from the _soonest expiring credit block_ first in order to ensure that all credits are utilized appropriately. As an example, if trial credits with an expiration date of 2 weeks from now are present for a customer, they will be used before any deductions take place from a non-expiring credit block.

If there are multiple blocks with the same expiration date, Orb will deduct from the block with the _lower cost basis_ first (ex. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis).

It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block which consists of unexpiring credits. Each of these deductions will lead to a _separate_ ledger entry, one per credit block that is deducted from. By default, the customer's total credit balance in Orb can be negative as a result of a decrement.

## Expiration change

The expiry of credits can be changed as a result of the API (See [Add Ledger Entry](create-ledger-entry)). This will create a ledger entry that specifies the balance as well as the initial and target expiry dates.

Note that for this entry type, `starting_balance` will equal `ending_balance`, and the `amount` represents the balance transferred. The credit block linked to the ledger entry is the source credit block from which there was an expiration change

## Credits expiry

When a set of credits expire on pre-set expiration date, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event. Note that credit expiry should always happen close to a date boundary in the customer's timezone.

## Void initiated

Credit blocks can be voided via the API. The `amount` on this entry corresponds to the number of credits that were remaining in the block at time of void. `void_reason` will be populated if the void is created with a reason.

## Void

When a set of credits is voided, the customer's balance automatically reflects this change and adds an entry to the ledger indicating this event.

## Amendment

When credits are added to a customer's balance as a result of a correction, this entry will be added to the ledger to indicate the adjustment of credits.

func (*CustomerCreditLedgerService) NewEntry

This endpoint allows you to create a new ledger entry for a specified customer's balance. This can be used to increment balance, deduct credits, and change the expiry date of existing credits.

## Effects of adding a ledger entry

  1. After calling this endpoint, [Fetch Credit Balance](fetch-customer-credits) will return a credit block that represents the changes (i.e. balance changes or transfers).
  2. A ledger entry will be added to the credits ledger for this customer, and therefore returned in the [View Credits Ledger](fetch-customer-credits) response as well as serialized in the response to this request. In the case of deductions without a specified block, multiple ledger entries may be created if the deduction spans credit blocks.
  3. If `invoice_settings` is specified, an invoice will be created that reflects the cost of the credits (based on `amount` and `per_unit_cost_basis`).

## Adding credits

Adding credits is done by creating an entry of type `increment`. This requires the caller to specify a number of credits as well as an optional expiry date in `YYYY-MM-DD` format. Orb also recommends specifying a description to assist with auditing. When adding credits, the caller can also specify a cost basis per-credit, to indicate how much in USD a customer paid for a single credit in a block. This can later be used for revenue recognition.

The following snippet illustrates a sample request body to increment credits which will expire in January of 2022.

```json

{
  "entry_type": "increment",
  "amount": 100,
  "expiry_date": "2022-12-28",
  "per_unit_cost_basis": "0.20",
  "description": "Purchased 100 credits"
}

```

Note that by default, Orb will always first increment any _negative_ balance in existing blocks before adding the remaining amount to the desired credit block.

### Invoicing for credits

By default, Orb manipulates the credit ledger but does not charge for credits. However, if you pass `invoice_settings` in the body of this request, Orb will also generate a one-off invoice for the customer for the credits pre-purchase. Note that you _must_ provide the `per_unit_cost_basis`, since the total charges on the invoice are calculated by multiplying the cost basis with the number of credit units added.

## Deducting Credits

Orb allows you to deduct credits from a customer by creating an entry of type `decrement`. Orb matches the algorithm for automatic deductions for determining which credit blocks to decrement from. In the case that the deduction leads to multiple ledger entries, the response from this endpoint will be the final deduction. Orb also optionally allows specifying a description to assist with auditing.

The following snippet illustrates a sample request body to decrement credits.

```json

{
  "entry_type": "decrement",
  "amount": 20,
  "description": "Removing excess credits"
}

```

## Changing credits expiry

If you'd like to change when existing credits expire, you should create a ledger entry of type `expiration_change`. For this entry, the required parameter `expiry_date` identifies the _originating_ block, and the required parameter `target_expiry_date` identifies when the transferred credits should now expire. A new credit block will be created with expiry date `target_expiry_date`, with the same cost basis data as the original credit block, if present.

Note that the balance of the block with the given `expiry_date` must be at least equal to the desired transfer amount determined by the `amount` parameter.

The following snippet illustrates a sample request body to extend the expiration date of credits by one year:

```json

{
  "entry_type": "expiration_change",
  "amount": 10,
  "expiry_date": "2022-12-28",
  "block_id": "UiUhFWeLHPrBY4Ad",
  "target_expiry_date": "2023-12-28",
  "description": "Extending credit validity"
}

```

## Voiding credits

If you'd like to void a credit block, create a ledger entry of type `void`. For this entry, `block_id` is required to identify the block, and `amount` indicates how many credits to void, up to the block's initial balance. Pass in a `void_reason` of `refund` if the void is due to a refund.

## Amendment

If you'd like to undo a decrement on a credit block, create a ledger entry of type `amendment`. For this entry, `block_id` is required to identify the block that was originally decremented from, and `amount` indicates how many credits to return to the customer, up to the block's initial balance.

func (*CustomerCreditLedgerService) NewEntryByExteralID

This endpoint allows you to create a new ledger entry for a specified customer's balance. This can be used to increment balance, deduct credits, and change the expiry date of existing credits.

## Effects of adding a ledger entry

  1. After calling this endpoint, [Fetch Credit Balance](fetch-customer-credits) will return a credit block that represents the changes (i.e. balance changes or transfers).
  2. A ledger entry will be added to the credits ledger for this customer, and therefore returned in the [View Credits Ledger](fetch-customer-credits) response as well as serialized in the response to this request. In the case of deductions without a specified block, multiple ledger entries may be created if the deduction spans credit blocks.
  3. If `invoice_settings` is specified, an invoice will be created that reflects the cost of the credits (based on `amount` and `per_unit_cost_basis`).

## Adding credits

Adding credits is done by creating an entry of type `increment`. This requires the caller to specify a number of credits as well as an optional expiry date in `YYYY-MM-DD` format. Orb also recommends specifying a description to assist with auditing. When adding credits, the caller can also specify a cost basis per-credit, to indicate how much in USD a customer paid for a single credit in a block. This can later be used for revenue recognition.

The following snippet illustrates a sample request body to increment credits which will expire in January of 2022.

```json

{
  "entry_type": "increment",
  "amount": 100,
  "expiry_date": "2022-12-28",
  "per_unit_cost_basis": "0.20",
  "description": "Purchased 100 credits"
}

```

Note that by default, Orb will always first increment any _negative_ balance in existing blocks before adding the remaining amount to the desired credit block.

### Invoicing for credits

By default, Orb manipulates the credit ledger but does not charge for credits. However, if you pass `invoice_settings` in the body of this request, Orb will also generate a one-off invoice for the customer for the credits pre-purchase. Note that you _must_ provide the `per_unit_cost_basis`, since the total charges on the invoice are calculated by multiplying the cost basis with the number of credit units added.

## Deducting Credits

Orb allows you to deduct credits from a customer by creating an entry of type `decrement`. Orb matches the algorithm for automatic deductions for determining which credit blocks to decrement from. In the case that the deduction leads to multiple ledger entries, the response from this endpoint will be the final deduction. Orb also optionally allows specifying a description to assist with auditing.

The following snippet illustrates a sample request body to decrement credits.

```json

{
  "entry_type": "decrement",
  "amount": 20,
  "description": "Removing excess credits"
}

```

## Changing credits expiry

If you'd like to change when existing credits expire, you should create a ledger entry of type `expiration_change`. For this entry, the required parameter `expiry_date` identifies the _originating_ block, and the required parameter `target_expiry_date` identifies when the transferred credits should now expire. A new credit block will be created with expiry date `target_expiry_date`, with the same cost basis data as the original credit block, if present.

Note that the balance of the block with the given `expiry_date` must be at least equal to the desired transfer amount determined by the `amount` parameter.

The following snippet illustrates a sample request body to extend the expiration date of credits by one year:

```json

{
  "entry_type": "expiration_change",
  "amount": 10,
  "expiry_date": "2022-12-28",
  "block_id": "UiUhFWeLHPrBY4Ad",
  "target_expiry_date": "2023-12-28",
  "description": "Extending credit validity"
}

```

## Voiding credits

If you'd like to void a credit block, create a ledger entry of type `void`. For this entry, `block_id` is required to identify the block, and `amount` indicates how many credits to void, up to the block's initial balance. Pass in a `void_reason` of `refund` if the void is due to a refund.

## Amendment

If you'd like to undo a decrement on a credit block, create a ledger entry of type `amendment`. For this entry, `block_id` is required to identify the block that was originally decremented from, and `amount` indicates how many credits to return to the customer, up to the block's initial balance.

type CustomerCreditListByExternalIDParams

type CustomerCreditListByExternalIDParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (CustomerCreditListByExternalIDParams) URLQuery

URLQuery serializes CustomerCreditListByExternalIDParams's query parameters as `url.Values`.

type CustomerCreditListByExternalIDResponse

type CustomerCreditListByExternalIDResponse struct {
	ID               string    `json:"id,required"`
	Balance          float64   `json:"balance,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditListByExternalIDResponseJSON
}

func (*CustomerCreditListByExternalIDResponse) UnmarshalJSON

func (r *CustomerCreditListByExternalIDResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCreditListParams

type CustomerCreditListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (CustomerCreditListParams) URLQuery

func (r CustomerCreditListParams) URLQuery() (v url.Values)

URLQuery serializes CustomerCreditListParams's query parameters as `url.Values`.

type CustomerCreditListResponse

type CustomerCreditListResponse struct {
	ID               string    `json:"id,required"`
	Balance          float64   `json:"balance,required"`
	ExpiryDate       time.Time `json:"expiry_date,required,nullable" format:"date-time"`
	PerUnitCostBasis string    `json:"per_unit_cost_basis,required,nullable"`
	JSON             customerCreditListResponseJSON
}

func (*CustomerCreditListResponse) UnmarshalJSON

func (r *CustomerCreditListResponse) UnmarshalJSON(data []byte) (err error)

type CustomerCreditService

type CustomerCreditService struct {
	Options []option.RequestOption
	Ledger  *CustomerCreditLedgerService
}

CustomerCreditService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerCreditService method instead.

func NewCustomerCreditService

func NewCustomerCreditService(opts ...option.RequestOption) (r *CustomerCreditService)

NewCustomerCreditService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerCreditService) List

Returns a paginated list of unexpired, non-zero credit blocks for a customer.

func (*CustomerCreditService) ListAutoPaging

Returns a paginated list of unexpired, non-zero credit blocks for a customer.

func (*CustomerCreditService) ListByExternalID

Returns a paginated list of unexpired, non-zero credit blocks for a customer.

func (*CustomerCreditService) ListByExternalIDAutoPaging

Returns a paginated list of unexpired, non-zero credit blocks for a customer.

type CustomerListParams

type CustomerListParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (CustomerListParams) URLQuery

func (r CustomerListParams) URLQuery() (v url.Values)

URLQuery serializes CustomerListParams's query parameters as `url.Values`.

type CustomerNewParams

type CustomerNewParams struct {
	// A valid customer email, to be used for notifications. When Orb triggers payment
	// through a payment gateway, this email will be used for any automatically issued
	// receipts.
	Email param.Field[string] `json:"email,required"`
	// The full name of the customer
	Name                        param.Field[string]                                       `json:"name,required"`
	AccountingSyncConfiguration param.Field[CustomerNewParamsAccountingSyncConfiguration] `json:"accounting_sync_configuration"`
	// Additional email addresses for this customer. If populated, these email
	// addresses will be CC'd for customer communications.
	AdditionalEmails param.Field[[]string] `json:"additional_emails"`
	// Used to determine if invoices for this customer will automatically attempt to
	// charge a saved payment method, if available. This parameter defaults to `True`
	// when a payment provider is provided on customer creation.
	AutoCollection param.Field[bool]                            `json:"auto_collection"`
	BillingAddress param.Field[CustomerNewParamsBillingAddress] `json:"billing_address"`
	// An ISO 4217 currency string used for the customer's invoices and balance. If not
	// set at creation time, will be set at subscription creation time.
	Currency      param.Field[string] `json:"currency"`
	EmailDelivery param.Field[bool]   `json:"email_delivery"`
	// An optional user-defined ID for this customer resource, used throughout the
	// system as an alias for this Customer. Use this field to identify a customer by
	// an existing identifier in your system.
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
	// User-specified key value pairs, often useful for referencing internal resources
	// or IDs. Returned as-is in the customer resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// This is used for creating charges or invoices in an external system via Orb.
	// When not in test mode, the connection must first be configured in the Orb
	// webapp.
	PaymentProvider param.Field[CustomerNewParamsPaymentProvider] `json:"payment_provider"`
	// The ID of this customer in an external payments solution, such as Stripe. This
	// is used for creating charges or invoices in the external system via Orb.
	PaymentProviderID      param.Field[string]                                  `json:"payment_provider_id"`
	ReportingConfiguration param.Field[CustomerNewParamsReportingConfiguration] `json:"reporting_configuration"`
	ShippingAddress        param.Field[CustomerNewParamsShippingAddress]        `json:"shipping_address"`
	TaxID                  param.Field[CustomerNewParamsTaxID]                  `json:"tax_id"`
	// A timezone identifier from the IANA timezone database, such as
	// `"America/Los_Angeles"`. This defaults to your account's timezone if not set.
	// This cannot be changed after customer creation.
	Timezone param.Field[string] `json:"timezone"`
}

func (CustomerNewParams) MarshalJSON

func (r CustomerNewParams) MarshalJSON() (data []byte, err error)

type CustomerNewParamsAccountingSyncConfiguration

type CustomerNewParamsAccountingSyncConfiguration struct {
	AccountingProviders param.Field[[]CustomerNewParamsAccountingSyncConfigurationAccountingProvider] `json:"accounting_providers"`
	Excluded            param.Field[bool]                                                             `json:"excluded"`
}

func (CustomerNewParamsAccountingSyncConfiguration) MarshalJSON

func (r CustomerNewParamsAccountingSyncConfiguration) MarshalJSON() (data []byte, err error)

type CustomerNewParamsAccountingSyncConfigurationAccountingProvider

type CustomerNewParamsAccountingSyncConfigurationAccountingProvider struct {
	ExternalProviderID param.Field[string] `json:"external_provider_id,required"`
	ProviderType       param.Field[string] `json:"provider_type,required"`
}

func (CustomerNewParamsAccountingSyncConfigurationAccountingProvider) MarshalJSON

type CustomerNewParamsBillingAddress

type CustomerNewParamsBillingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerNewParamsBillingAddress) MarshalJSON

func (r CustomerNewParamsBillingAddress) MarshalJSON() (data []byte, err error)

type CustomerNewParamsPaymentProvider

type CustomerNewParamsPaymentProvider string

This is used for creating charges or invoices in an external system via Orb. When not in test mode, the connection must first be configured in the Orb webapp.

const (
	CustomerNewParamsPaymentProviderQuickbooks    CustomerNewParamsPaymentProvider = "quickbooks"
	CustomerNewParamsPaymentProviderBillCom       CustomerNewParamsPaymentProvider = "bill.com"
	CustomerNewParamsPaymentProviderStripeCharge  CustomerNewParamsPaymentProvider = "stripe_charge"
	CustomerNewParamsPaymentProviderStripeInvoice CustomerNewParamsPaymentProvider = "stripe_invoice"
	CustomerNewParamsPaymentProviderNetsuite      CustomerNewParamsPaymentProvider = "netsuite"
)

type CustomerNewParamsReportingConfiguration

type CustomerNewParamsReportingConfiguration struct {
	Exempt param.Field[bool] `json:"exempt,required"`
}

func (CustomerNewParamsReportingConfiguration) MarshalJSON

func (r CustomerNewParamsReportingConfiguration) MarshalJSON() (data []byte, err error)

type CustomerNewParamsShippingAddress

type CustomerNewParamsShippingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerNewParamsShippingAddress) MarshalJSON

func (r CustomerNewParamsShippingAddress) MarshalJSON() (data []byte, err error)

type CustomerNewParamsTaxID

type CustomerNewParamsTaxID struct {
	Country param.Field[string] `json:"country,required"`
	Type    param.Field[string] `json:"type,required"`
	Value   param.Field[string] `json:"value,required"`
}

func (CustomerNewParamsTaxID) MarshalJSON

func (r CustomerNewParamsTaxID) MarshalJSON() (data []byte, err error)

type CustomerPaymentProvider

type CustomerPaymentProvider string

This is used for creating charges or invoices in an external system via Orb. When not in test mode, the connection must first be configured in the Orb webapp.

const (
	CustomerPaymentProviderQuickbooks    CustomerPaymentProvider = "quickbooks"
	CustomerPaymentProviderBillCom       CustomerPaymentProvider = "bill.com"
	CustomerPaymentProviderStripeCharge  CustomerPaymentProvider = "stripe_charge"
	CustomerPaymentProviderStripeInvoice CustomerPaymentProvider = "stripe_invoice"
	CustomerPaymentProviderNetsuite      CustomerPaymentProvider = "netsuite"
)

type CustomerReportingConfiguration

type CustomerReportingConfiguration struct {
	Exempt bool `json:"exempt,required"`
	JSON   customerReportingConfigurationJSON
}

func (*CustomerReportingConfiguration) UnmarshalJSON

func (r *CustomerReportingConfiguration) UnmarshalJSON(data []byte) (err error)

type CustomerService

type CustomerService struct {
	Options             []option.RequestOption
	Costs               *CustomerCostService
	Usage               *CustomerUsageService
	Credits             *CustomerCreditService
	BalanceTransactions *CustomerBalanceTransactionService
}

CustomerService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerService method instead.

func NewCustomerService

func NewCustomerService(opts ...option.RequestOption) (r *CustomerService)

NewCustomerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerService) Delete

func (r *CustomerService) Delete(ctx context.Context, customerID string, opts ...option.RequestOption) (err error)

This performs a deletion of this customer, its subscriptions, and its invoices. This operation is irreversible. Note that this is a _soft_ deletion, but the data will be inaccessible through the API and Orb dashboard. For hard-deletion, please reach out to the Orb team directly.

**Note**: This operation happens asynchronously and can be expected to take a few minutes to propagate to related resources. However, querying for the customer on subsequent GET requests while deletion is in process will reflect its deletion with a `deleted: true` property. Once the customer deletion has been fully processed, the customer will not be returned in the API.

On successful processing, this returns an empty dictionary (`{}`) in the API.

func (*CustomerService) Fetch

func (r *CustomerService) Fetch(ctx context.Context, customerID string, opts ...option.RequestOption) (res *Customer, err error)

This endpoint is used to fetch customer details given an identifier. If the `Customer` is in the process of being deleted, only the properties `id` and `deleted: true` will be returned.

See the [Customer resource](../guides/core-concepts.mdx#customer) for a full discussion of the Customer model.

func (*CustomerService) FetchByExternalID

func (r *CustomerService) FetchByExternalID(ctx context.Context, externalCustomerID string, opts ...option.RequestOption) (res *Customer, err error)

This endpoint is used to fetch customer details given an `external_customer_id` (see [Customer ID Aliases](../guides/events-and-metrics/customer-aliases)).

Note that the resource and semantics of this endpoint exactly mirror [Get Customer](fetch-customer).

func (*CustomerService) List

func (r *CustomerService) List(ctx context.Context, query CustomerListParams, opts ...option.RequestOption) (res *shared.Page[Customer], err error)

This endpoint returns a list of all customers for an account. The list of customers is ordered starting from the most recently created customer. This endpoint follows Orb's [standardized pagination format](../reference/pagination).

See Customer(../guides/concepts#customer) for an overview of the customer model.

func (*CustomerService) ListAutoPaging

This endpoint returns a list of all customers for an account. The list of customers is ordered starting from the most recently created customer. This endpoint follows Orb's [standardized pagination format](../reference/pagination).

See Customer(../guides/concepts#customer) for an overview of the customer model.

func (*CustomerService) New

func (r *CustomerService) New(ctx context.Context, body CustomerNewParams, opts ...option.RequestOption) (res *Customer, err error)

This operation is used to create an Orb customer, who is party to the core billing relationship. See Customer(../guides/concepts#customer) for an overview of the customer resource.

This endpoint is critical in the following Orb functionality:

  • Automated charges can be configured by setting `payment_provider` and `payment_provider_id` to automatically issue invoices
  • [Customer ID Aliases](../guides/events-and-metrics/customer-aliases) can be configured by setting `external_customer_id`
  • [Timezone localization](../guides/product-catalog/timezones.md) can be configured on a per-customer basis by setting the `timezone` parameter

func (*CustomerService) Update

func (r *CustomerService) Update(ctx context.Context, customerID string, body CustomerUpdateParams, opts ...option.RequestOption) (res *Customer, err error)

This endpoint can be used to update the `payment_provider`, `payment_provider_id`, `name`, `email`, `email_delivery`, `tax_id`, `auto_collection`, `metadata`, `shipping_address`, `billing_address`, and `additional_emails` of an existing customer. "Other fields on a customer are currently immutable.

func (*CustomerService) UpdateByExternalID

func (r *CustomerService) UpdateByExternalID(ctx context.Context, id string, body CustomerUpdateByExternalIDParams, opts ...option.RequestOption) (res *Customer, err error)

This endpoint is used to update customer details given an `external_customer_id` (see [Customer ID Aliases](../guides/events-and-metrics/customer-aliases)). Note that the resource and semantics of this endpoint exactly mirror [Update Customer](update-customer).

type CustomerShippingAddress

type CustomerShippingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       customerShippingAddressJSON
}

func (*CustomerShippingAddress) UnmarshalJSON

func (r *CustomerShippingAddress) UnmarshalJSON(data []byte) (err error)

type CustomerTaxID

type CustomerTaxID struct {
	Country string `json:"country,required"`
	Type    string `json:"type,required"`
	Value   string `json:"value,required"`
	JSON    customerTaxIDJSON
}

func (*CustomerTaxID) UnmarshalJSON

func (r *CustomerTaxID) UnmarshalJSON(data []byte) (err error)

type CustomerUpdateByExternalIDParams

type CustomerUpdateByExternalIDParams struct {
	AccountingSyncConfiguration param.Field[CustomerUpdateByExternalIDParamsAccountingSyncConfiguration] `json:"accounting_sync_configuration"`
	// Additional email addresses for this customer. If populated, these email
	// addresses will be CC'd for customer communications.
	AdditionalEmails param.Field[[]string] `json:"additional_emails"`
	// Used to determine if invoices for this customer will automatically attempt to
	// charge a saved payment method, if available. This parameter defaults to `True`
	// when a payment provider is provided on customer creation.
	AutoCollection param.Field[bool]                                           `json:"auto_collection"`
	BillingAddress param.Field[CustomerUpdateByExternalIDParamsBillingAddress] `json:"billing_address"`
	// An ISO 4217 currency string used for the customer's invoices and balance. If not
	// set at creation time, will be set at subscription creation time.
	Currency param.Field[string] `json:"currency"`
	// A valid customer email, to be used for invoicing and notifications.
	Email         param.Field[string] `json:"email"`
	EmailDelivery param.Field[bool]   `json:"email_delivery"`
	// An optional user-defined ID for this customer resource, used throughout the
	// system as an alias for this Customer. Use this field to identify a customer by
	// an existing identifier in your system.
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
	// User-specified key value pairs, often useful for referencing internal resources
	// or IDs. Returned as-is in the customer resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// The full name of the customer
	Name param.Field[string] `json:"name"`
	// This is used for creating charges or invoices in an external system via Orb.
	// When not in test mode:
	//
	//   - the connection must first be configured in the Orb webapp.
	//   - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`,
	//     `bill.com`, `netsuite`), any product mappings must first be configured with
	//     the Orb team.
	PaymentProvider param.Field[CustomerUpdateByExternalIDParamsPaymentProvider] `json:"payment_provider"`
	// The ID of this customer in an external payments solution, such as Stripe. This
	// is used for creating charges or invoices in the external system via Orb.
	PaymentProviderID      param.Field[string]                                                 `json:"payment_provider_id"`
	ReportingConfiguration param.Field[CustomerUpdateByExternalIDParamsReportingConfiguration] `json:"reporting_configuration"`
	ShippingAddress        param.Field[CustomerUpdateByExternalIDParamsShippingAddress]        `json:"shipping_address"`
	TaxID                  param.Field[CustomerUpdateByExternalIDParamsTaxID]                  `json:"tax_id"`
}

func (CustomerUpdateByExternalIDParams) MarshalJSON

func (r CustomerUpdateByExternalIDParams) MarshalJSON() (data []byte, err error)

type CustomerUpdateByExternalIDParamsAccountingSyncConfiguration

type CustomerUpdateByExternalIDParamsAccountingSyncConfiguration struct {
	AccountingProviders param.Field[[]CustomerUpdateByExternalIDParamsAccountingSyncConfigurationAccountingProvider] `json:"accounting_providers"`
	Excluded            param.Field[bool]                                                                            `json:"excluded"`
}

func (CustomerUpdateByExternalIDParamsAccountingSyncConfiguration) MarshalJSON

type CustomerUpdateByExternalIDParamsAccountingSyncConfigurationAccountingProvider

type CustomerUpdateByExternalIDParamsAccountingSyncConfigurationAccountingProvider struct {
	ExternalProviderID param.Field[string] `json:"external_provider_id,required"`
	ProviderType       param.Field[string] `json:"provider_type,required"`
}

func (CustomerUpdateByExternalIDParamsAccountingSyncConfigurationAccountingProvider) MarshalJSON

type CustomerUpdateByExternalIDParamsBillingAddress

type CustomerUpdateByExternalIDParamsBillingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerUpdateByExternalIDParamsBillingAddress) MarshalJSON

func (r CustomerUpdateByExternalIDParamsBillingAddress) MarshalJSON() (data []byte, err error)

type CustomerUpdateByExternalIDParamsPaymentProvider

type CustomerUpdateByExternalIDParamsPaymentProvider string

This is used for creating charges or invoices in an external system via Orb. When not in test mode:

  • the connection must first be configured in the Orb webapp.
  • if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, `netsuite`), any product mappings must first be configured with the Orb team.
const (
	CustomerUpdateByExternalIDParamsPaymentProviderQuickbooks    CustomerUpdateByExternalIDParamsPaymentProvider = "quickbooks"
	CustomerUpdateByExternalIDParamsPaymentProviderBillCom       CustomerUpdateByExternalIDParamsPaymentProvider = "bill.com"
	CustomerUpdateByExternalIDParamsPaymentProviderStripeCharge  CustomerUpdateByExternalIDParamsPaymentProvider = "stripe_charge"
	CustomerUpdateByExternalIDParamsPaymentProviderStripeInvoice CustomerUpdateByExternalIDParamsPaymentProvider = "stripe_invoice"
	CustomerUpdateByExternalIDParamsPaymentProviderNetsuite      CustomerUpdateByExternalIDParamsPaymentProvider = "netsuite"
)

type CustomerUpdateByExternalIDParamsReportingConfiguration

type CustomerUpdateByExternalIDParamsReportingConfiguration struct {
	Exempt param.Field[bool] `json:"exempt,required"`
}

func (CustomerUpdateByExternalIDParamsReportingConfiguration) MarshalJSON

type CustomerUpdateByExternalIDParamsShippingAddress

type CustomerUpdateByExternalIDParamsShippingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerUpdateByExternalIDParamsShippingAddress) MarshalJSON

func (r CustomerUpdateByExternalIDParamsShippingAddress) MarshalJSON() (data []byte, err error)

type CustomerUpdateByExternalIDParamsTaxID

type CustomerUpdateByExternalIDParamsTaxID struct {
	Country param.Field[string] `json:"country,required"`
	Type    param.Field[string] `json:"type,required"`
	Value   param.Field[string] `json:"value,required"`
}

func (CustomerUpdateByExternalIDParamsTaxID) MarshalJSON

func (r CustomerUpdateByExternalIDParamsTaxID) MarshalJSON() (data []byte, err error)

type CustomerUpdateParams

type CustomerUpdateParams struct {
	AccountingSyncConfiguration param.Field[CustomerUpdateParamsAccountingSyncConfiguration] `json:"accounting_sync_configuration"`
	// Additional email addresses for this customer. If populated, these email
	// addresses will be CC'd for customer communications.
	AdditionalEmails param.Field[[]string] `json:"additional_emails"`
	// Used to determine if invoices for this customer will automatically attempt to
	// charge a saved payment method, if available. This parameter defaults to `True`
	// when a payment provider is provided on customer creation.
	AutoCollection param.Field[bool]                               `json:"auto_collection"`
	BillingAddress param.Field[CustomerUpdateParamsBillingAddress] `json:"billing_address"`
	// An ISO 4217 currency string used for the customer's invoices and balance. If not
	// set at creation time, will be set at subscription creation time.
	Currency param.Field[string] `json:"currency"`
	// A valid customer email, to be used for invoicing and notifications.
	Email         param.Field[string] `json:"email"`
	EmailDelivery param.Field[bool]   `json:"email_delivery"`
	// An optional user-defined ID for this customer resource, used throughout the
	// system as an alias for this Customer. Use this field to identify a customer by
	// an existing identifier in your system.
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
	// User-specified key value pairs, often useful for referencing internal resources
	// or IDs. Returned as-is in the customer resource.
	Metadata param.Field[interface{}] `json:"metadata"`
	// The full name of the customer
	Name param.Field[string] `json:"name"`
	// This is used for creating charges or invoices in an external system via Orb.
	// When not in test mode:
	//
	//   - the connection must first be configured in the Orb webapp.
	//   - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`,
	//     `bill.com`, `netsuite`), any product mappings must first be configured with
	//     the Orb team.
	PaymentProvider param.Field[CustomerUpdateParamsPaymentProvider] `json:"payment_provider"`
	// The ID of this customer in an external payments solution, such as Stripe. This
	// is used for creating charges or invoices in the external system via Orb.
	PaymentProviderID      param.Field[string]                                     `json:"payment_provider_id"`
	ReportingConfiguration param.Field[CustomerUpdateParamsReportingConfiguration] `json:"reporting_configuration"`
	ShippingAddress        param.Field[CustomerUpdateParamsShippingAddress]        `json:"shipping_address"`
	TaxID                  param.Field[CustomerUpdateParamsTaxID]                  `json:"tax_id"`
}

func (CustomerUpdateParams) MarshalJSON

func (r CustomerUpdateParams) MarshalJSON() (data []byte, err error)

type CustomerUpdateParamsAccountingSyncConfiguration

type CustomerUpdateParamsAccountingSyncConfiguration struct {
	AccountingProviders param.Field[[]CustomerUpdateParamsAccountingSyncConfigurationAccountingProvider] `json:"accounting_providers"`
	Excluded            param.Field[bool]                                                                `json:"excluded"`
}

func (CustomerUpdateParamsAccountingSyncConfiguration) MarshalJSON

func (r CustomerUpdateParamsAccountingSyncConfiguration) MarshalJSON() (data []byte, err error)

type CustomerUpdateParamsAccountingSyncConfigurationAccountingProvider

type CustomerUpdateParamsAccountingSyncConfigurationAccountingProvider struct {
	ExternalProviderID param.Field[string] `json:"external_provider_id,required"`
	ProviderType       param.Field[string] `json:"provider_type,required"`
}

func (CustomerUpdateParamsAccountingSyncConfigurationAccountingProvider) MarshalJSON

type CustomerUpdateParamsBillingAddress

type CustomerUpdateParamsBillingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerUpdateParamsBillingAddress) MarshalJSON

func (r CustomerUpdateParamsBillingAddress) MarshalJSON() (data []byte, err error)

type CustomerUpdateParamsPaymentProvider

type CustomerUpdateParamsPaymentProvider string

This is used for creating charges or invoices in an external system via Orb. When not in test mode:

  • the connection must first be configured in the Orb webapp.
  • if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, `netsuite`), any product mappings must first be configured with the Orb team.
const (
	CustomerUpdateParamsPaymentProviderQuickbooks    CustomerUpdateParamsPaymentProvider = "quickbooks"
	CustomerUpdateParamsPaymentProviderBillCom       CustomerUpdateParamsPaymentProvider = "bill.com"
	CustomerUpdateParamsPaymentProviderStripeCharge  CustomerUpdateParamsPaymentProvider = "stripe_charge"
	CustomerUpdateParamsPaymentProviderStripeInvoice CustomerUpdateParamsPaymentProvider = "stripe_invoice"
	CustomerUpdateParamsPaymentProviderNetsuite      CustomerUpdateParamsPaymentProvider = "netsuite"
)

type CustomerUpdateParamsReportingConfiguration

type CustomerUpdateParamsReportingConfiguration struct {
	Exempt param.Field[bool] `json:"exempt,required"`
}

func (CustomerUpdateParamsReportingConfiguration) MarshalJSON

func (r CustomerUpdateParamsReportingConfiguration) MarshalJSON() (data []byte, err error)

type CustomerUpdateParamsShippingAddress

type CustomerUpdateParamsShippingAddress struct {
	City       param.Field[string] `json:"city"`
	Country    param.Field[string] `json:"country"`
	Line1      param.Field[string] `json:"line1"`
	Line2      param.Field[string] `json:"line2"`
	PostalCode param.Field[string] `json:"postal_code"`
	State      param.Field[string] `json:"state"`
}

func (CustomerUpdateParamsShippingAddress) MarshalJSON

func (r CustomerUpdateParamsShippingAddress) MarshalJSON() (data []byte, err error)

type CustomerUpdateParamsTaxID

type CustomerUpdateParamsTaxID struct {
	Country param.Field[string] `json:"country,required"`
	Type    param.Field[string] `json:"type,required"`
	Value   param.Field[string] `json:"value,required"`
}

func (CustomerUpdateParamsTaxID) MarshalJSON

func (r CustomerUpdateParamsTaxID) MarshalJSON() (data []byte, err error)

type CustomerUsageService

type CustomerUsageService struct {
	Options []option.RequestOption
}

CustomerUsageService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCustomerUsageService method instead.

func NewCustomerUsageService

func NewCustomerUsageService(opts ...option.RequestOption) (r *CustomerUsageService)

NewCustomerUsageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CustomerUsageService) Update

This endpoint is used to amend usage within a timeframe for a customer that has an active subscription.

This endpoint will mark _all_ existing events within `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls to th is endpoint.

This is a powerful and audit-safe mechanism to retroactively change usage data in cases where you need to:

  • decrease historical usage consumption because of degraded service availability in your systems

  • account for gaps from your usage reporting mechanism

  • make point-in-time fixes for specific event records, while ret aining the original time of usage and associated metadata. This amendment API is designed with two explicit goals:

    1. Amendments are **always audit-safe**. The amendment process will still retain original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. 2. Amendments always preser ve data **consistency**. In other words, either an amendment is fully processed by the system (and the new events for th e timeframe are honored rather than the existing ones) or the amendment request fails. To maintain this important proper ty, Orb prevents _partial event ingestion_ on this endpoint.

## Response semantics

  • Either all events are ingested successfully, or all fail to ingest (returning a `4xx` or `5xx` response code).
  • Any event that fails schema validation will lead to a `4xx` response. In this case, to maintain data consistency, Orb will not ingest any events and will also not deprecate existing events in the time period.
  • You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new events have been ingested, updati ng usage totals happens asynchronously and may be delayed by a few minutes.

As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the amend ment) or the new state (with new events in the requested timeframe).

## Sample request body

```json

{
  "events": [
    {
      "event_name": "payment_processed",
      "timestamp": "2022-03-24T07:15:00Z",
      "properties": {
        "amount": 100
      }
    },
    {
      "event_name": "payment_failed",
      "timestamp": "2022-03-24T07:15:00Z",
      "properties": {
        "amount": 100
      }
    }
  ]
}

```

## Request Validation

  • The `timestamp` of each event reported must fall within the bounds of `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must be sent in ISO8601 format with UTC timezone offset.

  • Orb **does not accept an `idempotency_key`** with each event in this endpoint, since the entirety of the event list must be ingested to ensure consistency. On retryable errors , you should retry the request in its entirety, and assume that the amendment operation has not succeeded until receipt of a `2xx`.

  • Both `timeframe_start` and `timeframe_end` must be timestamps in the past. Furthermore, Orb will genera lly validate that the `timeframe_start` and `timeframe_end` fall within the customer's _current_ subscription billing pe riod. However, Orb does allow amendments while in the grace period of the previous billing period; in this instance, the timeframe can start before the current period.

## API Limits

Note that Orb does not currently enforce a hard rate- limit for API usage or a maximum request payload size. Similar to the event ingestion API, this API is architected for h igh-throughput ingestion. It is also safe to _programmatically_ call this endpoint if your system can automatically dete ct a need for historical amendment.

In order to overwrite timeframes with a very large number of events, we suggest using multiple calls with small adjacent (e.g. every hour) timeframes.

func (*CustomerUsageService) UpdateByExternalID

This endpoint is used to amend usage within a timeframe for a customer that has an active subscription.

This endpoint will mark _all_ existing events within `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls to th is endpoint.

This is a powerful and audit-safe mechanism to retroactively change usage data in cases where you need to:

  • decrease historical usage consumption because of degraded service availability in your systems

  • account for gaps from your usage reporting mechanism

  • make point-in-time fixes for specific event records, while ret aining the original time of usage and associated metadata. This amendment API is designed with two explicit goals:

    1. Amendments are **always audit-safe**. The amendment process will still retain original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. 2. Amendments always preser ve data **consistency**. In other words, either an amendment is fully processed by the system (and the new events for th e timeframe are honored rather than the existing ones) or the amendment request fails. To maintain this important proper ty, Orb prevents _partial event ingestion_ on this endpoint.

## Response semantics

  • Either all events are ingested successfully, or all fail to ingest (returning a `4xx` or `5xx` response code).
  • Any event that fails schema validation will lead to a `4xx` response. In this case, to maintain data consistency, Orb will not ingest any events and will also not deprecate existing events in the time period.
  • You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new events have been ingested, updati ng usage totals happens asynchronously and may be delayed by a few minutes.

As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the amend ment) or the new state (with new events in the requested timeframe).

## Sample request body

```json

{
  "events": [
    {
      "event_name": "payment_processed",
      "timestamp": "2022-03-24T07:15:00Z",
      "properties": {
        "amount": 100
      }
    },
    {
      "event_name": "payment_failed",
      "timestamp": "2022-03-24T07:15:00Z",
      "properties": {
        "amount": 100
      }
    }
  ]
}

```

## Request Validation

  • The `timestamp` of each event reported must fall within the bounds of `timeframe_start` and `timeframe_end`. As with ingestion, all timesta mps must be sent in ISO8601 format with UTC timezone offset.

  • Orb **does not accept an `idempotency_key`** with each event in this endpoint, since the entirety of the event list must be ingested to ensure consistency. On retryable errors , you should retry the request in its entirety, and assume that the amendment operation has not succeeded until receipt of a `2xx`.

  • Both `timeframe_start` and `timeframe_end` must be timestamps in the past. Furthermore, Orb will genera lly validate that the `timeframe_start` and `timeframe_end` fall within the customer's _current_ subscription billing pe riod. However, Orb does allow amendments while in the grace period of the previous billing period; in this instance, the timeframe can start before the current period.

## API Limits

Note that Orb does not currently enforce a hard rate- limit for API usage or a maximum request payload size. Similar to the event ingestion API, this API is architected for h igh-throughput ingestion. It is also safe to _programmatically_ call this endpoint if your system can automatically dete ct a need for historical amendment.

In order to overwrite timeframes with a very large number of events, we suggest using multiple calls with small adjacent (e.g. every hour) timeframes.

type CustomerUsageUpdateByExternalIDParams

type CustomerUsageUpdateByExternalIDParams struct {
	// A name to meaningfully identify the action or event type.
	EventName param.Field[string] `json:"event_name,required"`
	// A dictionary of custom properties. Values in this dictionary must be numeric,
	// boolean, or strings. Nested dictionaries are disallowed.
	Properties param.Field[interface{}] `json:"properties,required"`
	// An ISO 8601 format date with no timezone offset (i.e. UTC). This should
	// represent the time that usage was recorded, and is particularly important to
	// attribute usage to a given billing period.
	Timestamp param.Field[time.Time] `json:"timestamp,required" format:"date-time"`
	// This bound is exclusive (i.e. events before this timestamp will be updated)
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// This bound is inclusive (i.e. events with this timestamp onward, inclusive will
	// be updated)
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// The Orb Customer identifier
	CustomerID param.Field[string] `json:"customer_id"`
	// An alias for the Orb customer, whose mapping is specified when creating the
	// customer
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
}

func (CustomerUsageUpdateByExternalIDParams) MarshalJSON

func (r CustomerUsageUpdateByExternalIDParams) MarshalJSON() (data []byte, err error)

func (CustomerUsageUpdateByExternalIDParams) URLQuery

URLQuery serializes CustomerUsageUpdateByExternalIDParams's query parameters as `url.Values`.

type CustomerUsageUpdateByExternalIDResponse

type CustomerUsageUpdateByExternalIDResponse struct {
	// An array of strings, corresponding to idempotency_key's marked as duplicates
	// (previously ingested)
	Duplicate []string `json:"duplicate,required"`
	// An array of strings, corresponding to idempotency_key's which were successfully
	// ingested.
	Ingested []string `json:"ingested,required"`
	JSON     customerUsageUpdateByExternalIDResponseJSON
}

func (*CustomerUsageUpdateByExternalIDResponse) UnmarshalJSON

func (r *CustomerUsageUpdateByExternalIDResponse) UnmarshalJSON(data []byte) (err error)

type CustomerUsageUpdateParams

type CustomerUsageUpdateParams struct {
	// A name to meaningfully identify the action or event type.
	EventName param.Field[string] `json:"event_name,required"`
	// A dictionary of custom properties. Values in this dictionary must be numeric,
	// boolean, or strings. Nested dictionaries are disallowed.
	Properties param.Field[interface{}] `json:"properties,required"`
	// An ISO 8601 format date with no timezone offset (i.e. UTC). This should
	// represent the time that usage was recorded, and is particularly important to
	// attribute usage to a given billing period.
	Timestamp param.Field[time.Time] `json:"timestamp,required" format:"date-time"`
	// This bound is exclusive (i.e. events before this timestamp will be updated)
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// This bound is inclusive (i.e. events with this timestamp onward, inclusive will
	// be updated)
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// The Orb Customer identifier
	CustomerID param.Field[string] `json:"customer_id"`
	// An alias for the Orb customer, whose mapping is specified when creating the
	// customer
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
}

func (CustomerUsageUpdateParams) MarshalJSON

func (r CustomerUsageUpdateParams) MarshalJSON() (data []byte, err error)

func (CustomerUsageUpdateParams) URLQuery

func (r CustomerUsageUpdateParams) URLQuery() (v url.Values)

URLQuery serializes CustomerUsageUpdateParams's query parameters as `url.Values`.

type CustomerUsageUpdateResponse

type CustomerUsageUpdateResponse struct {
	// An array of strings, corresponding to idempotency_key's marked as duplicates
	// (previously ingested)
	Duplicate []string `json:"duplicate,required"`
	// An array of strings, corresponding to idempotency_key's which were successfully
	// ingested.
	Ingested []string `json:"ingested,required"`
	JSON     customerUsageUpdateResponseJSON
}

func (*CustomerUsageUpdateResponse) UnmarshalJSON

func (r *CustomerUsageUpdateResponse) UnmarshalJSON(data []byte) (err error)

type DiscountDiscountType

type DiscountDiscountType string
const (
	DiscountDiscountTypePercentage DiscountDiscountType = "percentage"
	DiscountDiscountTypeTrial      DiscountDiscountType = "trial"
	DiscountDiscountTypeUsage      DiscountDiscountType = "usage"
	DiscountDiscountTypeAmount     DiscountDiscountType = "amount"
)

type DiscountParam

type DiscountParam struct {
	DiscountType param.Field[DiscountDiscountType] `json:"discount_type,required"`
	// Only available if discount_type is `amount`.
	AmountDiscount param.Field[string] `json:"amount_discount"`
	// List of price_ids that this discount applies to. For plan/plan phase discounts,
	// this can be a subset of prices.
	AppliesToPriceIDs param.Field[[]string] `json:"applies_to_price_ids"`
	// Only available if discount_type is `percentage`. This is a number between 0
	// and 1.
	PercentageDiscount param.Field[float64] `json:"percentage_discount"`
	// Only available if discount_type is `trial`
	TrialAmountDiscount param.Field[string] `json:"trial_amount_discount"`
	// Only available if discount_type is `usage`. Number of usage units that this
	// discount is for
	UsageDiscount param.Field[float64] `json:"usage_discount"`
}

func (DiscountParam) MarshalJSON

func (r DiscountParam) MarshalJSON() (data []byte, err error)

type Error

type Error = apierror.Error

type EventBackfillCloseResponse

type EventBackfillCloseResponse struct {
	ID string `json:"id,required"`
	// If in the future, the time at which the backfill will automatically close. If in
	// the past, the time at which the backfill was closed.
	CloseTime time.Time `json:"close_time,required,nullable" format:"date-time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The customer ID this backfill is scoped to. If null, this backfill is not scoped
	// to a single customer.
	CustomerID string `json:"customer_id,required,nullable"`
	// The time at which this backfill was reverted.
	RevertedAt time.Time `json:"reverted_at,required,nullable" format:"date-time"`
	// The status of the backfill.
	Status         EventBackfillCloseResponseStatus `json:"status,required"`
	TimeframeEnd   time.Time                        `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time                        `json:"timeframe_start,required" format:"date-time"`
	JSON           eventBackfillCloseResponseJSON
}

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

func (*EventBackfillCloseResponse) UnmarshalJSON

func (r *EventBackfillCloseResponse) UnmarshalJSON(data []byte) (err error)

type EventBackfillCloseResponseStatus

type EventBackfillCloseResponseStatus string

The status of the backfill.

const (
	EventBackfillCloseResponseStatusPending       EventBackfillCloseResponseStatus = "pending"
	EventBackfillCloseResponseStatusReflected     EventBackfillCloseResponseStatus = "reflected"
	EventBackfillCloseResponseStatusPendingRevert EventBackfillCloseResponseStatus = "pending_revert"
	EventBackfillCloseResponseStatusReverted      EventBackfillCloseResponseStatus = "reverted"
)

type EventBackfillFetchResponse

type EventBackfillFetchResponse struct {
	ID string `json:"id,required"`
	// If in the future, the time at which the backfill will automatically close. If in
	// the past, the time at which the backfill was closed.
	CloseTime time.Time `json:"close_time,required,nullable" format:"date-time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The customer ID this backfill is scoped to. If null, this backfill is not scoped
	// to a single customer.
	CustomerID string `json:"customer_id,required,nullable"`
	// The time at which this backfill was reverted.
	RevertedAt time.Time `json:"reverted_at,required,nullable" format:"date-time"`
	// The status of the backfill.
	Status         EventBackfillFetchResponseStatus `json:"status,required"`
	TimeframeEnd   time.Time                        `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time                        `json:"timeframe_start,required" format:"date-time"`
	JSON           eventBackfillFetchResponseJSON
}

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

func (*EventBackfillFetchResponse) UnmarshalJSON

func (r *EventBackfillFetchResponse) UnmarshalJSON(data []byte) (err error)

type EventBackfillFetchResponseStatus

type EventBackfillFetchResponseStatus string

The status of the backfill.

const (
	EventBackfillFetchResponseStatusPending       EventBackfillFetchResponseStatus = "pending"
	EventBackfillFetchResponseStatusReflected     EventBackfillFetchResponseStatus = "reflected"
	EventBackfillFetchResponseStatusPendingRevert EventBackfillFetchResponseStatus = "pending_revert"
	EventBackfillFetchResponseStatusReverted      EventBackfillFetchResponseStatus = "reverted"
)

type EventBackfillListParams

type EventBackfillListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (EventBackfillListParams) URLQuery

func (r EventBackfillListParams) URLQuery() (v url.Values)

URLQuery serializes EventBackfillListParams's query parameters as `url.Values`.

type EventBackfillListResponse

type EventBackfillListResponse struct {
	ID string `json:"id,required"`
	// If in the future, the time at which the backfill will automatically close. If in
	// the past, the time at which the backfill was closed.
	CloseTime time.Time `json:"close_time,required,nullable" format:"date-time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The customer ID this backfill is scoped to. If null, this backfill is not scoped
	// to a single customer.
	CustomerID string `json:"customer_id,required,nullable"`
	// The time at which this backfill was reverted.
	RevertedAt time.Time `json:"reverted_at,required,nullable" format:"date-time"`
	// The status of the backfill.
	Status         EventBackfillListResponseStatus `json:"status,required"`
	TimeframeEnd   time.Time                       `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time                       `json:"timeframe_start,required" format:"date-time"`
	JSON           eventBackfillListResponseJSON
}

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

func (*EventBackfillListResponse) UnmarshalJSON

func (r *EventBackfillListResponse) UnmarshalJSON(data []byte) (err error)

type EventBackfillListResponseStatus

type EventBackfillListResponseStatus string

The status of the backfill.

const (
	EventBackfillListResponseStatusPending       EventBackfillListResponseStatus = "pending"
	EventBackfillListResponseStatusReflected     EventBackfillListResponseStatus = "reflected"
	EventBackfillListResponseStatusPendingRevert EventBackfillListResponseStatus = "pending_revert"
	EventBackfillListResponseStatusReverted      EventBackfillListResponseStatus = "reverted"
)

type EventBackfillNewParams

type EventBackfillNewParams struct {
	// The (exclusive) end of the usage timeframe affected by this backfill.
	TimeframeEnd param.Field[time.Time] `json:"timeframe_end,required" format:"date-time"`
	// The (inclusive) start of the usage timeframe affected by this backfill.
	TimeframeStart param.Field[time.Time] `json:"timeframe_start,required" format:"date-time"`
	// The time at which no more events will be accepted for this backfill. The
	// backfill will automatically begin reflecting throughout Orb at the close time.
	// If not specified, it will default to 1 day after the creation of the backfill.
	CloseTime param.Field[time.Time] `json:"close_time" format:"date-time"`
	// The ID of the customer to which this backfill is scoped.
	CustomerID param.Field[string] `json:"customer_id"`
	// The external customer ID of the customer to which this backfill is scoped.
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
	// If true, replaces all existing events in the timeframe with the newly ingested
	// events. If false, adds the newly ingested events to the existing events.
	ReplaceExistingEvents param.Field[bool] `json:"replace_existing_events"`
}

func (EventBackfillNewParams) MarshalJSON

func (r EventBackfillNewParams) MarshalJSON() (data []byte, err error)

type EventBackfillNewResponse

type EventBackfillNewResponse struct {
	ID string `json:"id,required"`
	// If in the future, the time at which the backfill will automatically close. If in
	// the past, the time at which the backfill was closed.
	CloseTime time.Time `json:"close_time,required,nullable" format:"date-time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The customer ID this backfill is scoped to. If null, this backfill is not scoped
	// to a single customer.
	CustomerID string `json:"customer_id,required,nullable"`
	// The time at which this backfill was reverted.
	RevertedAt time.Time `json:"reverted_at,required,nullable" format:"date-time"`
	// The status of the backfill.
	Status         EventBackfillNewResponseStatus `json:"status,required"`
	TimeframeEnd   time.Time                      `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time                      `json:"timeframe_start,required" format:"date-time"`
	JSON           eventBackfillNewResponseJSON
}

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

func (*EventBackfillNewResponse) UnmarshalJSON

func (r *EventBackfillNewResponse) UnmarshalJSON(data []byte) (err error)

type EventBackfillNewResponseStatus

type EventBackfillNewResponseStatus string

The status of the backfill.

const (
	EventBackfillNewResponseStatusPending       EventBackfillNewResponseStatus = "pending"
	EventBackfillNewResponseStatusReflected     EventBackfillNewResponseStatus = "reflected"
	EventBackfillNewResponseStatusPendingRevert EventBackfillNewResponseStatus = "pending_revert"
	EventBackfillNewResponseStatusReverted      EventBackfillNewResponseStatus = "reverted"
)

type EventBackfillRevertResponse

type EventBackfillRevertResponse struct {
	ID string `json:"id,required"`
	// If in the future, the time at which the backfill will automatically close. If in
	// the past, the time at which the backfill was closed.
	CloseTime time.Time `json:"close_time,required,nullable" format:"date-time"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The customer ID this backfill is scoped to. If null, this backfill is not scoped
	// to a single customer.
	CustomerID string `json:"customer_id,required,nullable"`
	// The time at which this backfill was reverted.
	RevertedAt time.Time `json:"reverted_at,required,nullable" format:"date-time"`
	// The status of the backfill.
	Status         EventBackfillRevertResponseStatus `json:"status,required"`
	TimeframeEnd   time.Time                         `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time                         `json:"timeframe_start,required" format:"date-time"`
	JSON           eventBackfillRevertResponseJSON
}

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

func (*EventBackfillRevertResponse) UnmarshalJSON

func (r *EventBackfillRevertResponse) UnmarshalJSON(data []byte) (err error)

type EventBackfillRevertResponseStatus

type EventBackfillRevertResponseStatus string

The status of the backfill.

const (
	EventBackfillRevertResponseStatusPending       EventBackfillRevertResponseStatus = "pending"
	EventBackfillRevertResponseStatusReflected     EventBackfillRevertResponseStatus = "reflected"
	EventBackfillRevertResponseStatusPendingRevert EventBackfillRevertResponseStatus = "pending_revert"
	EventBackfillRevertResponseStatusReverted      EventBackfillRevertResponseStatus = "reverted"
)

type EventBackfillService

type EventBackfillService struct {
	Options []option.RequestOption
}

EventBackfillService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventBackfillService method instead.

func NewEventBackfillService

func NewEventBackfillService(opts ...option.RequestOption) (r *EventBackfillService)

NewEventBackfillService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventBackfillService) Close

func (r *EventBackfillService) Close(ctx context.Context, backfillID string, opts ...option.RequestOption) (res *EventBackfillCloseResponse, err error)

Closing a backfill makes the updated usage visible in Orb. Upon closing a backfill, Orb will asynchronously reflect the updated usage in invoice amounts and usage graphs. Once all of the updates are complete, the backfill's status will transition to `reflected`.

func (*EventBackfillService) Fetch

func (r *EventBackfillService) Fetch(ctx context.Context, backfillID string, opts ...option.RequestOption) (res *EventBackfillFetchResponse, err error)

This endpoint is used to fetch a backfill given an identifier.

func (*EventBackfillService) List

This endpoint returns a list of all backfills in a list format.

The list of backfills is ordered starting from the most recently created backfill. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the [Pagination-metadata schema](pagination).

func (*EventBackfillService) ListAutoPaging

This endpoint returns a list of all backfills in a list format.

The list of backfills is ordered starting from the most recently created backfill. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist. More information about pagination can be found in the [Pagination-metadata schema](pagination).

func (*EventBackfillService) New

Creating the backfill enables adding or replacing past events, even those that are older than the ingestion grace period. Performing a backfill in Orb involves 3 steps:

  1. Create the backfill, specifying its parameters.
  2. [Ingest](ingest) usage events, referencing the backfill (query parameter `backfill_id`).
  3. [Close](close-backfill) the backfill, propagating the update in past usage throughout Orb.

Changes from a backfill are not reflected until the backfill is closed, so you won’t need to worry about your customers seeing partially updated usage data. Backfills are also reversible, so you’ll be able to revert a backfill if you’ve made a mistake.

This endpoint will return a backfill object, which contains an `id`. That `id` can then be used as the `backfill_id` query parameter to the event ingestion endpoint to associate ingested events with this backfill. The effects (e.g. updated usage graphs) of this backfill will not take place until the backfill is closed.

If the `replace_existing_events` is `true`, existing events in the backfill's timeframe will be replaced with the newly ingested events associated with the backfill. If `false`, newly ingested events will be added to the existing events.

func (*EventBackfillService) Revert

func (r *EventBackfillService) Revert(ctx context.Context, backfillID string, opts ...option.RequestOption) (res *EventBackfillRevertResponse, err error)

Reverting a backfill undoes all the effects of closing the backfill. If the backfill is reflected, the status will transition to `pending_revert` while the effects of the backfill are undone. Once all effects are undone, the backfill will transition to `reverted`.

If a backfill is reverted before its closed, no usage will be updated as a result of the backfill and it will immediately transition to `reverted`.

type EventDeprecateResponse

type EventDeprecateResponse struct {
	// event_id of the deprecated event, if successfully updated
	Deprecated string `json:"deprecated,required"`
	JSON       eventDeprecateResponseJSON
}

func (*EventDeprecateResponse) UnmarshalJSON

func (r *EventDeprecateResponse) UnmarshalJSON(data []byte) (err error)

type EventIngestParams

type EventIngestParams struct {
	Events param.Field[[]EventIngestParamsEvent] `json:"events,required"`
	// If this ingestion request is part of a backfill, this parameter ties the
	// ingested events to the backfill
	BackfillID param.Field[string] `query:"backfill_id"`
	// Flag to enable additional debug information in the endpoint response
	Debug param.Field[bool] `query:"debug"`
}

func (EventIngestParams) MarshalJSON

func (r EventIngestParams) MarshalJSON() (data []byte, err error)

func (EventIngestParams) URLQuery

func (r EventIngestParams) URLQuery() (v url.Values)

URLQuery serializes EventIngestParams's query parameters as `url.Values`.

type EventIngestParamsEvent

type EventIngestParamsEvent struct {
	// A name to meaningfully identify the action or event type.
	EventName param.Field[string] `json:"event_name,required"`
	// A unique value, generated by the client, that is used to de-duplicate events.
	// Exactly one event with a given idempotency key will be ingested, which allows
	// for safe request retries.
	IdempotencyKey param.Field[string] `json:"idempotency_key,required"`
	// A dictionary of custom properties. Values in this dictionary must be numeric,
	// boolean, or strings. Nested dictionaries are disallowed.
	Properties param.Field[interface{}] `json:"properties,required"`
	// An ISO 8601 format date with no timezone offset (i.e. UTC). This should
	// represent the time that usage was recorded, and is particularly important to
	// attribute usage to a given billing period.
	Timestamp param.Field[time.Time] `json:"timestamp,required" format:"date-time"`
	// The Orb Customer identifier
	CustomerID param.Field[string] `json:"customer_id"`
	// An alias for the Orb customer, whose mapping is specified when creating the
	// customer
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
}

func (EventIngestParamsEvent) MarshalJSON

func (r EventIngestParamsEvent) MarshalJSON() (data []byte, err error)

type EventIngestResponse

type EventIngestResponse struct {
	// Contains all failing validation events. In the case of a 200, this array will
	// always be empty. This field will always be present.
	ValidationFailed []EventIngestResponseValidationFailed `json:"validation_failed,required"`
	// Optional debug information (only present when debug=true is passed to the
	// endpoint). Contains ingested and duplicate event idempotency keys.
	Debug EventIngestResponseDebug `json:"debug,nullable"`
	JSON  eventIngestResponseJSON
}

func (*EventIngestResponse) UnmarshalJSON

func (r *EventIngestResponse) UnmarshalJSON(data []byte) (err error)

type EventIngestResponseDebug

type EventIngestResponseDebug struct {
	Duplicate []string `json:"duplicate,required"`
	Ingested  []string `json:"ingested,required"`
	JSON      eventIngestResponseDebugJSON
}

Optional debug information (only present when debug=true is passed to the endpoint). Contains ingested and duplicate event idempotency keys.

func (*EventIngestResponseDebug) UnmarshalJSON

func (r *EventIngestResponseDebug) UnmarshalJSON(data []byte) (err error)

type EventIngestResponseValidationFailed

type EventIngestResponseValidationFailed struct {
	// The passed idempotency_key corresponding to the validation_errors
	IdempotencyKey string `json:"idempotency_key,required"`
	// An array of strings corresponding to validation failures for this
	// idempotency_key.
	ValidationErrors []string `json:"validation_errors,required"`
	JSON             eventIngestResponseValidationFailedJSON
}

func (*EventIngestResponseValidationFailed) UnmarshalJSON

func (r *EventIngestResponseValidationFailed) UnmarshalJSON(data []byte) (err error)

type EventSearchParams

type EventSearchParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit        param.Field[int64]     `query:"limit"`
	TimestampGt  param.Field[time.Time] `query:"timestamp[gt]" format:"date-time"`
	TimestampGte param.Field[time.Time] `query:"timestamp[gte]" format:"date-time"`
	TimestampLt  param.Field[time.Time] `query:"timestamp[lt]" format:"date-time"`
	TimestampLte param.Field[time.Time] `query:"timestamp[lte]" format:"date-time"`
	// This is an explicit array of IDs to filter by. Note that an event's ID is the
	// idempotency_key that was originally used for ingestion. Values in this array
	// will be treated case sensitively.
	EventIDs param.Field[[]string] `json:"event_ids"`
	// This is an issued Orb invoice ID (see also List Invoices). Orb will fetch all
	// events that were used to calculate the invoice. In the common case, this will be
	// a list of events whose timestamp property falls within the billing period
	// specified by the invoice.
	InvoiceID param.Field[string] `json:"invoice_id"`
}

func (EventSearchParams) MarshalJSON

func (r EventSearchParams) MarshalJSON() (data []byte, err error)

func (EventSearchParams) URLQuery

func (r EventSearchParams) URLQuery() (v url.Values)

URLQuery serializes EventSearchParams's query parameters as `url.Values`.

type EventSearchResponse

type EventSearchResponse struct {
	Data               []EventSearchResponseData             `json:"data,required"`
	PaginationMetadata EventSearchResponsePaginationMetadata `json:"pagination_metadata,required"`
	JSON               eventSearchResponseJSON
}

func (*EventSearchResponse) UnmarshalJSON

func (r *EventSearchResponse) UnmarshalJSON(data []byte) (err error)

type EventSearchResponseData

type EventSearchResponseData struct {
	// A unique value, generated by the client, that is used to de-duplicate events.
	// Exactly one event with a given idempotency key will be ingested, which allows
	// for safe request retries.
	ID string `json:"id,required"`
	// The Orb Customer identifier
	CustomerID string `json:"customer_id,required"`
	// A name to meaningfully identify the action or event type.
	EventName string `json:"event_name,required"`
	// An alias for the Orb customer, whose mapping is specified when creating the
	// customer
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	// A dictionary of custom properties. Values in this dictionary must be numeric,
	// boolean, or strings. Nested dictionaries are disallowed.
	Properties interface{} `json:"properties,required"`
	// An ISO 8601 format date with no timezone offset (i.e. UTC). This should
	// represent the time that usage was recorded, and is particularly important to
	// attribute usage to a given billing period.
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	JSON      eventSearchResponseDataJSON
}

The [Event](../guides/core-concepts.mdx#event) resource represents a usage event that has been created for a customer. Events are the core of Orb's usage-based billing model, and are used to calculate the usage charges for a given billing period.

func (*EventSearchResponseData) UnmarshalJSON

func (r *EventSearchResponseData) UnmarshalJSON(data []byte) (err error)

type EventSearchResponsePaginationMetadata

type EventSearchResponsePaginationMetadata struct {
	HasMore    bool   `json:"has_more,required"`
	NextCursor string `json:"next_cursor,required,nullable"`
	JSON       eventSearchResponsePaginationMetadataJSON
}

func (*EventSearchResponsePaginationMetadata) UnmarshalJSON

func (r *EventSearchResponsePaginationMetadata) UnmarshalJSON(data []byte) (err error)

type EventService

type EventService struct {
	Options   []option.RequestOption
	Backfills *EventBackfillService
}

EventService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r *EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) Deprecate

func (r *EventService) Deprecate(ctx context.Context, eventID string, opts ...option.RequestOption) (res *EventDeprecateResponse, err error)

This endpoint is used to deprecate a single usage event with a given `event_id`. `event_id` refers to the `idempotency_key` passed in during ingestion.

This endpoint will mark the existing event as ignored. Note that if you attempt to re-ingest an event with the same `event_id` as a deprecated event, Orb will return an error.

This is a powerful and audit-safe mechanism to retroactively deprecate a single event in cases where you need to:

  • no longer bill for an event that was improperly reported
  • no longer bill for an event based on the result of an external API call (ex. call to a payment gateway failed and the user should not be billed)

If you want to only change specific properties of an event, but keep the event as part of the billing calculation, use the [Amend single event](amend-event) endpoint instead.

This API is always audit-safe. The process will still retain the deprecated event, though it will be ignored for billing calculations. For auditing and data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data.

## Request validation

  • Orb does not accept an `idempotency_key` with the event in this endpoint, since this request is by design idempotent. On retryable errors, you should retry the request and assume the deprecation operation has not succeeded until receipt of a 2xx.
  • The event's `timestamp` must fall within the customer's current subscription's billing period, or within the grace period of the customer's current subscription's previous billing period. Orb does not allow deprecating events for billing periods that have already invoiced customers.
  • The `customer_id` or the `external_customer_id` of the original event ingestion request must identify a Customer resource within Orb, even if this event was ingested during the initial integration period. We do not allow deprecating events for customers not in the Orb system.

func (*EventService) Ingest

func (r *EventService) Ingest(ctx context.Context, params EventIngestParams, opts ...option.RequestOption) (res *EventIngestResponse, err error)

Orb's event ingestion model and API is designed around two core principles:

  1. **Data fidelity**: The accuracy of your billing model depends on a robust foundation of events. Orb's API protocol encourages usage patterns that ensure that your data is consistently complete and correct.
  2. **Fast integration**: Sending events into Orb requires no tedious setup steps or explicit field schema for your event shape, making it instant to start streaming in usage in real-time.

## Event shape

Events are the starting point for all usage calculations in the system, and are simple at their core:

```json { // customer_id and external_customer_id are used to // attribute usage to a given Customer. Exactly one of these // should be specified in a given ingestion event.

// `customer_id` is the Orb generated identifier for the Customer, // which is returned from the Create customer API call. customer_id: string,

// external_customer_id is an alternate identifier which is associated // with a Customer at creation time. This is treated as an alias for // customer_id, and is usually set to an identifier native to your system. external_customer_id: string,

// A string name identifying the event, usually a usage // action. By convention, this should not contain any whitespace. event_name: string,

// An ISO 8601 format date with no timezone offset. // This should represent the time that usage occurred // and is important to attribute usage to a given // billing period. See the notes below on determining the timestamp. // e.g. 2020-12-09T16:09:53Z timestamp: string,

// A unique value, generated by the client, that is // used to de-duplicate events. // Exactly one event with a given // idempotency key will be ingested, which allows for // safe request retries. idempotency_key: string

// Optional custom metadata to attach to the event. // This might include a numeric value used for aggregation, // or a string/boolean value used for filtering. // The schema of this dictionary need not be pre-declared, and // properties can be added at any time. properties: { [key: string]?: string | number | boolean, }, } ```

## Required fields

Because events streamed to Orb are meant to be as flexible as possible, there are only a few required fields in every event.

  • We recommend that `idempotency_key` are unique strings that you generated with V4 UUIDs, but only require that they uniquely identify an event (i.e. don’t collide).
  • The `timestamp` field in the event body will be used to determine which billable period a given event falls into. For example, with a monthly billing cycle starting from the first of December, Orb will calculate metrics based on events that fall into the range `12-01 00:00:00 <= timestamp < 01-01 00:00:00`.

## Logging metadata

Orb allows tagging events with metadata using a flexible properties dictionary. Since Orb does not enforce a rigid schema for this field-set, key-value pairs can be added dynamically as your events evolve.

This dictionary can be helpful for a wide variety of use cases:

  • Numeric properties on events like `compute_time_ms` can later be inputs to our flexible query engine to determine usage.
  • Logging a region or cluster with each event can help you provide customers more granular visibility into their usage.

We encourage logging this metadata with an eye towards future use cases to ensure full coverage for historical data. The datatype of the value in the properties dictionary is important for metric creation from an event source. Values that you wish to numerically aggregate should be of numeric type in the event.

## Determining event timestamp

For cases where usage is being reported in real time as it is occurring, timestamp should correspond to the time that usage occurred.

In cases where usage is reported in aggregate for a historical timeframe at a regular interval, we recommend setting the event `timestamp` to the midpoint of the interval. As an example, if you have an hourly reporter that sends data once an hour for the previous hour of usage, setting the `timestamp` to the half-hour mark will ensure that the usage is counted within the correct period.

Note that other time-related fields (e.g. time elapsed) can be added to the properties dictionary as necessary.

In cases where usage is reported in aggregate for a historical timeframe, the timestamp must be within the grace period set for your account. Events with `timestamp < current_time - grace_period` will not be accepted as a valid event, and will throw validation errors. Enforcing the grace period enables Orb to accurately map usage to the correct billing cycle and ensure that all usage is billed for in the corresponding billing period.

## Event validation

Orb’s validation ensures that you recognize errors in your events as quickly as possible, and the API provides informative error messages to help you fix problems quickly.

We validate the following:

  • Exactly one of `customer_id` and `external_customer_id` should be specified.
  • If specified, `customer_id` must identify a Customer resource within Orb. We do not support sending events for customers that have not been provisioned. Similarly, if specified, `external_customer_id` must be an identifier that is associated with an Orb Customer resource. Note: During our initial integration period, this enforcement will be temporarily turned into a warning to ensure smooth customer migration.
  • `timestamp` must conform to ISO 8601 and represent a timestamp at most 1 hour in the future. This timestamp should be sent in UTC timezone (no timezone offset).

## Idempotency and retry semantics

Orb's idempotency guarantees allow you to implement safe retry logic in the event of network or machine failures, ensuring data fidelity. Each event in the request payload is associated with an idempotency key, and Orb guarantees that a single idempotency key will be successfully ingested at most once.

  • Successful responses return a 200 HTTP status code. The response contains information about previously processed events.
  • Requests that return a `4xx` HTTP status code indicate a payload error and contain at least one event with a validation failure. An event with a validation failure can be re-sent to the ingestion endpoint (after the payload is fixed) with the original idempotency key since that key is not marked as processed.
  • Requests that return a `5xx` HTTP status code indicate a server-side failure. These requests should be retried in their entirety.

## API usage and limits

The ingestion API is designed made for real-time streaming ingestion and architected for high throughput. Even if events are later deemed unnecessary or filtered out, we encourage you to log them to Orb if they may be relevant to billing calculations in the future.

To take advantage of the real-time features of the Orb platform and avoid any chance of dropped events by producers, we recommend reporting events to Orb frequently. Optionally, events can also be briefly aggregated at the source, as this API accepts an array of event bodies.

Orb does not currently enforce a hard rate-limit for API usage or a maximum request payload size, but please give us a heads up if you’re changing either of these factors by an order of magnitude from initial setup.

## Testing in debug mode

The ingestion API supports a debug mode, which returns additional verbose output to indicate which event idempotency keys were newly ingested or duplicates from previous requests. To enable this mode, mark `debug=true` as a query parameter.

If `debug=true` is not specified, the response will only contain `validation_failed`. Orb will still honor the idempotency guarantees set [here](../guides/events-and-metrics/event-ingestion#event-volume-and-concurrency) in all cases.

We strongly recommend that you only use debug mode as part of testing your initial Orb integration. Once you're ready to switch to production, disable debug mode to take advantage of improved performance and maximal throughput.

#### Example: ingestion response with `debug=true`

```json

{
  "debug": {
    "duplicate": [],
    "ingested": ["B7E83HDMfJPAunXW", "SJs5DQJ3TnwSqEZE", "8SivfDsNKwCeAXim"]
  },
  "validation_failed": []
}

```

#### Example: ingestion response with `debug=false`

```json

{
  "validation_failed": []
}

```

func (*EventService) Search

func (r *EventService) Search(ctx context.Context, params EventSearchParams, opts ...option.RequestOption) (res *EventSearchResponse, err error)

This endpoint returns a filtered set of events for an account in a [paginated list format](../reference/pagination).

Note that this is a `POST` endpoint rather than a `GET` endpoint because it employs a JSON body for search criteria rather than query parameters, allowing for a more flexible search syntax.

Note that a search criteria _must_ be specified. Currently, Orb supports the following criteria:

  • `event_ids`: This is an explicit array of IDs to filter by. Note that an event's ID is the `idempotency_key` that was originally used for ingestion.
  • `invoice_id`: This is an issued Orb invoice ID (see also [List Invoices](list-invoices)). Orb will fetch all events that were used to calculate the invoice. In the common case, this will be a list of events whose `timestamp` property falls within the billing period specified by the invoice.

By default, Orb does not return _deprecated_ events in this endpoint.

By default, Orb will not throw a `404` if no events matched, Orb will return an empty array for `data` instead.

func (*EventService) Update

func (r *EventService) Update(ctx context.Context, eventID string, body EventUpdateParams, opts ...option.RequestOption) (res *EventUpdateResponse, err error)

This endpoint is used to amend a single usage event with a given `event_id`. `event_id` refers to the `idempotency_key` passed in during ingestion. The event will maintain its existing `event_id` after the amendment.

This endpoint will mark the existing event as ignored, and Orb will only use the new event passed in the body of this request as the source of truth for that `event_id`. Note that a single event can be amended any number of times, so the same event can be overwritten in subsequent calls to this endpoint, or overwritten using the [Amend customer usage](amend-usage) endpoint. Only a single event with a given `event_id` will be considered the source of truth at any given time.

This is a powerful and audit-safe mechanism to retroactively update a single event in cases where you need to:

  • update an event with new metadata as you iterate on your pricing model
  • update an event based on the result of an external API call (ex. call to a payment gateway succeeded or failed)

This amendment API is always audit-safe. The process will still retain the original event, though it will be ignored for billing calculations. For auditing and data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data.

## Request validation

  • The `timestamp` of the new event must match the `timestamp` of the existing event already ingested. As with ingestion, all timestamps must be sent in ISO8601 format with UTC timezone offset.
  • The `customer_id` or `external_customer_id` of the new event must match the `customer_id` or `external_customer_id` of the existing event already ingested. Exactly one of `customer_id` and `external_customer_id` should be specified, and similar to ingestion, the ID must identify a Customer resource within Orb. Unlike ingestion, for event amendment, we strictly enforce that the Customer must be in the Orb system, even during the initial integration period. We do not allow updating the `Customer` an event is associated with.
  • Orb does not accept an `idempotency_key` with the event in this endpoint, since this request is by design idempotent. On retryable errors, you should retry the request and assume the amendment operation has not succeeded until receipt of a 2xx.
  • The event's `timestamp` must fall within the customer's current subscription's billing period, or within the grace period of the customer's current subscription's previous billing period.

type EventUpdateParams

type EventUpdateParams struct {
	// A name to meaningfully identify the action or event type.
	EventName param.Field[string] `json:"event_name,required"`
	// A dictionary of custom properties. Values in this dictionary must be numeric,
	// boolean, or strings. Nested dictionaries are disallowed.
	Properties param.Field[interface{}] `json:"properties,required"`
	// An ISO 8601 format date with no timezone offset (i.e. UTC). This should
	// represent the time that usage was recorded, and is particularly important to
	// attribute usage to a given billing period.
	Timestamp param.Field[time.Time] `json:"timestamp,required" format:"date-time"`
	// The Orb Customer identifier
	CustomerID param.Field[string] `json:"customer_id"`
	// An alias for the Orb customer, whose mapping is specified when creating the
	// customer
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
}

func (EventUpdateParams) MarshalJSON

func (r EventUpdateParams) MarshalJSON() (data []byte, err error)

type EventUpdateResponse

type EventUpdateResponse struct {
	// event_id of the amended event, if successfully ingested
	Amended string `json:"amended,required"`
	JSON    eventUpdateResponseJSON
}

func (*EventUpdateResponse) UnmarshalJSON

func (r *EventUpdateResponse) UnmarshalJSON(data []byte) (err error)

type Invoice

type Invoice struct {
	ID string `json:"id,required"`
	// This is the final amount required to be charged to the customer and reflects the
	// application of the customer balance to the `total` of the invoice.
	AmountDue      string                `json:"amount_due,required"`
	AutoCollection InvoiceAutoCollection `json:"auto_collection,required"`
	BillingAddress InvoiceBillingAddress `json:"billing_address,required,nullable"`
	// The creation time of the resource in Orb.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// A list of credit notes associated with the invoice
	CreditNotes []InvoiceCreditNote `json:"credit_notes,required"`
	// An ISO 4217 currency string or `credits`
	Currency                    string                              `json:"currency,required"`
	Customer                    InvoiceCustomer                     `json:"customer,required"`
	CustomerBalanceTransactions []InvoiceCustomerBalanceTransaction `json:"customer_balance_transactions,required"`
	CustomerTaxID               InvoiceCustomerTaxID                `json:"customer_tax_id,required,nullable"`
	Discount                    InvoiceDiscount                     `json:"discount,required,nullable"`
	Discounts                   []InvoiceDiscount                   `json:"discounts,required"`
	// When the invoice payment is due.
	DueDate time.Time `json:"due_date,required" format:"date-time"`
	// If the invoice has a status of `draft`, this will be the time that the invoice
	// will be eligible to be issued, otherwise it will be `null`. If `auto-issue` is
	// true, the invoice will automatically begin issuing at this time.
	EligibleToIssueAt time.Time `json:"eligible_to_issue_at,required,nullable" format:"date-time"`
	// A URL for the invoice portal.
	HostedInvoiceURL string `json:"hosted_invoice_url,required,nullable"`
	// The scheduled date of the invoice
	InvoiceDate time.Time `json:"invoice_date,required" format:"date-time"`
	// Automatically generated invoice number to help track and reconcile invoices.
	// Invoice numbers have a prefix such as `RFOBWG`. These can be sequential per
	// account or customer.
	InvoiceNumber string `json:"invoice_number,required"`
	// The link to download the PDF representation of the `Invoice`.
	InvoicePdf string `json:"invoice_pdf,required,nullable"`
	// If the invoice failed to issue, this will be the last time it failed to issue
	// (even if it is now in a different state.)
	IssueFailedAt time.Time `json:"issue_failed_at,required,nullable" format:"date-time"`
	// If the invoice has been issued, this will be the time it transitioned to
	// `issued` (even if it is now in a different state.)
	IssuedAt time.Time `json:"issued_at,required,nullable" format:"date-time"`
	// The breakdown of prices in this invoice.
	LineItems     []InvoiceLineItem `json:"line_items,required"`
	Maximum       InvoiceMaximum    `json:"maximum,required,nullable"`
	MaximumAmount string            `json:"maximum_amount,required,nullable"`
	// Free-form text which is available on the invoice PDF and the Orb invoice portal.
	Memo          string         `json:"memo,required,nullable"`
	Metadata      interface{}    `json:"metadata,required"`
	Minimum       InvoiceMinimum `json:"minimum,required,nullable"`
	MinimumAmount string         `json:"minimum_amount,required,nullable"`
	// If the invoice has a status of `paid`, this gives a timestamp when the invoice
	// was paid.
	PaidAt time.Time `json:"paid_at,required,nullable" format:"date-time"`
	// If payment was attempted on this invoice but failed, this will be the time of
	// the most recent attempt.
	PaymentFailedAt time.Time `json:"payment_failed_at,required,nullable" format:"date-time"`
	// If payment was attempted on this invoice, this will be the start time of the
	// most recent attempt. This field is especially useful for delayed-notification
	// payment mechanisms (like bank transfers), where payment can take 3 days or more.
	PaymentStartedAt time.Time `json:"payment_started_at,required,nullable" format:"date-time"`
	// If the invoice is in draft, this timestamp will reflect when the invoice is
	// scheduled to be issued.
	ScheduledIssueAt time.Time              `json:"scheduled_issue_at,required,nullable" format:"date-time"`
	ShippingAddress  InvoiceShippingAddress `json:"shipping_address,required,nullable"`
	Status           InvoiceStatus          `json:"status,required"`
	Subscription     InvoiceSubscription    `json:"subscription,required,nullable"`
	// The total before any discounts and minimums are applied.
	Subtotal string `json:"subtotal,required"`
	// If the invoice failed to sync, this will be the last time an external invoicing
	// provider sync was attempted. This field will always be `null` for invoices using
	// Orb Invoicing.
	SyncFailedAt time.Time `json:"sync_failed_at,required,nullable" format:"date-time"`
	// The total after any minimums and discounts have been applied.
	Total string `json:"total,required"`
	// If the invoice has a status of `void`, this gives a timestamp when the invoice
	// was voided.
	VoidedAt time.Time `json:"voided_at,required,nullable" format:"date-time"`
	// This is true if the invoice will be automatically issued in the future, and
	// false otherwise.
	WillAutoIssue bool `json:"will_auto_issue,required"`
	JSON          invoiceJSON
}

An [`Invoice`](../guides/concepts#invoice) is a fundamental billing entity, representing the request for payment for a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as the result of an action, such as a cancellation.

func (*Invoice) UnmarshalJSON

func (r *Invoice) UnmarshalJSON(data []byte) (err error)

type InvoiceAutoCollection

type InvoiceAutoCollection struct {
	// True only if auto-collection is enabled for this invoice.
	Enabled bool `json:"enabled,required,nullable"`
	// If the invoice is scheduled for auto-collection, this field will reflect when
	// the next attempt will occur. If dunning has been exhausted, or auto-collection
	// is not enabled for this invoice, this field will be `null`.
	NextAttemptAt time.Time `json:"next_attempt_at,required,nullable" format:"date-time"`
	// If Orb has ever attempted payment auto-collection for this invoice, this field
	// will reflect when that attempt occurred. In conjunction with `next_attempt_at`,
	// this can be used to tell whether the invoice is currently in dunning (that is,
	// `previously_attempted_at` is non-null, and `next_attempt_time` is non-null), or
	// if dunning has been exhausted (`previously_attempted_at` is non-null, but
	// `next_attempt_time` is null).
	PreviouslyAttemptedAt time.Time `json:"previously_attempted_at,required,nullable" format:"date-time"`
	JSON                  invoiceAutoCollectionJSON
}

func (*InvoiceAutoCollection) UnmarshalJSON

func (r *InvoiceAutoCollection) UnmarshalJSON(data []byte) (err error)

type InvoiceBillingAddress

type InvoiceBillingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       invoiceBillingAddressJSON
}

func (*InvoiceBillingAddress) UnmarshalJSON

func (r *InvoiceBillingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceCreditNote

type InvoiceCreditNote struct {
	ID               string `json:"id,required"`
	CreditNoteNumber string `json:"credit_note_number,required"`
	Reason           string `json:"reason,required"`
	Total            string `json:"total,required"`
	Type             string `json:"type,required"`
	// If the credit note has a status of `void`, this gives a timestamp when the
	// credit note was voided.
	VoidedAt time.Time `json:"voided_at,required,nullable" format:"date-time"`
	JSON     invoiceCreditNoteJSON
}

func (*InvoiceCreditNote) UnmarshalJSON

func (r *InvoiceCreditNote) UnmarshalJSON(data []byte) (err error)

type InvoiceCustomer

type InvoiceCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               invoiceCustomerJSON
}

func (*InvoiceCustomer) UnmarshalJSON

func (r *InvoiceCustomer) UnmarshalJSON(data []byte) (err error)

type InvoiceCustomerBalanceTransaction

type InvoiceCustomerBalanceTransaction struct {
	// A unique id for this transaction.
	ID     string                                   `json:"id,required"`
	Action InvoiceCustomerBalanceTransactionsAction `json:"action,required"`
	// The value of the amount changed in the transaction.
	Amount string `json:"amount,required"`
	// The creation time of this transaction.
	CreatedAt  time.Time                                    `json:"created_at,required" format:"date-time"`
	CreditNote InvoiceCustomerBalanceTransactionsCreditNote `json:"credit_note,required,nullable"`
	// An optional description provided for manual customer balance adjustments.
	Description string `json:"description,required,nullable"`
	// The new value of the customer's balance prior to the transaction, in the
	// customer's currency.
	EndingBalance string                                    `json:"ending_balance,required"`
	Invoice       InvoiceCustomerBalanceTransactionsInvoice `json:"invoice,required,nullable"`
	// The original value of the customer's balance prior to the transaction, in the
	// customer's currency.
	StartingBalance string                                 `json:"starting_balance,required"`
	Type            InvoiceCustomerBalanceTransactionsType `json:"type,required"`
	JSON            invoiceCustomerBalanceTransactionJSON
}

func (*InvoiceCustomerBalanceTransaction) UnmarshalJSON

func (r *InvoiceCustomerBalanceTransaction) UnmarshalJSON(data []byte) (err error)

type InvoiceCustomerBalanceTransactionsAction

type InvoiceCustomerBalanceTransactionsAction string
const (
	InvoiceCustomerBalanceTransactionsActionAppliedToInvoice InvoiceCustomerBalanceTransactionsAction = "applied_to_invoice"
	InvoiceCustomerBalanceTransactionsActionProratedRefund   InvoiceCustomerBalanceTransactionsAction = "prorated_refund"
	InvoiceCustomerBalanceTransactionsActionManualAdjustment InvoiceCustomerBalanceTransactionsAction = "manual_adjustment"
)

type InvoiceCustomerBalanceTransactionsCreditNote

type InvoiceCustomerBalanceTransactionsCreditNote struct {
	// The id of the Credit note
	ID   string `json:"id,required"`
	JSON invoiceCustomerBalanceTransactionsCreditNoteJSON
}

func (*InvoiceCustomerBalanceTransactionsCreditNote) UnmarshalJSON

func (r *InvoiceCustomerBalanceTransactionsCreditNote) UnmarshalJSON(data []byte) (err error)

type InvoiceCustomerBalanceTransactionsInvoice

type InvoiceCustomerBalanceTransactionsInvoice struct {
	// The Invoice id
	ID   string `json:"id,required"`
	JSON invoiceCustomerBalanceTransactionsInvoiceJSON
}

func (*InvoiceCustomerBalanceTransactionsInvoice) UnmarshalJSON

func (r *InvoiceCustomerBalanceTransactionsInvoice) UnmarshalJSON(data []byte) (err error)

type InvoiceCustomerBalanceTransactionsType

type InvoiceCustomerBalanceTransactionsType string
const (
	InvoiceCustomerBalanceTransactionsTypeIncrement InvoiceCustomerBalanceTransactionsType = "increment"
	InvoiceCustomerBalanceTransactionsTypeDecrement InvoiceCustomerBalanceTransactionsType = "decrement"
)

type InvoiceCustomerTaxID

type InvoiceCustomerTaxID struct {
	Country string `json:"country,required"`
	Type    string `json:"type,required"`
	Value   string `json:"value,required"`
	JSON    invoiceCustomerTaxIDJSON
}

func (*InvoiceCustomerTaxID) UnmarshalJSON

func (r *InvoiceCustomerTaxID) UnmarshalJSON(data []byte) (err error)

type InvoiceDiscount

type InvoiceDiscount interface {
	// contains filtered or unexported methods
}

Union satisfied by InvoiceDiscountPercentageDiscount, InvoiceDiscountTrialDiscount, InvoiceDiscountUsageDiscount or InvoiceDiscountAmountDiscount.

type InvoiceDiscountAmountDiscount

type InvoiceDiscountAmountDiscount struct {
	// Only available if discount_type is `amount`.
	AmountDiscount string `json:"amount_discount,required"`
	// List of price_ids that this discount applies to. For plan/plan phase discounts,
	// this can be a subset of prices.
	AppliesToPriceIDs []string                                  `json:"applies_to_price_ids,required"`
	DiscountType      InvoiceDiscountAmountDiscountDiscountType `json:"discount_type,required"`
	JSON              invoiceDiscountAmountDiscountJSON
}

func (*InvoiceDiscountAmountDiscount) UnmarshalJSON

func (r *InvoiceDiscountAmountDiscount) UnmarshalJSON(data []byte) (err error)

type InvoiceDiscountAmountDiscountDiscountType

type InvoiceDiscountAmountDiscountDiscountType string
const (
	InvoiceDiscountAmountDiscountDiscountTypeAmount InvoiceDiscountAmountDiscountDiscountType = "amount"
)

type InvoiceDiscountPercentageDiscount

type InvoiceDiscountPercentageDiscount struct {
	// List of price_ids that this discount applies to. For plan/plan phase discounts,
	// this can be a subset of prices.
	AppliesToPriceIDs []string                                      `json:"applies_to_price_ids,required"`
	DiscountType      InvoiceDiscountPercentageDiscountDiscountType `json:"discount_type,required"`
	// Only available if discount_type is `percentage`.This is a number between 0
	// and 1.
	PercentageDiscount float64 `json:"percentage_discount,required"`
	JSON               invoiceDiscountPercentageDiscountJSON
}

func (*InvoiceDiscountPercentageDiscount) UnmarshalJSON

func (r *InvoiceDiscountPercentageDiscount) UnmarshalJSON(data []byte) (err error)

type InvoiceDiscountPercentageDiscountDiscountType

type InvoiceDiscountPercentageDiscountDiscountType string
const (
	InvoiceDiscountPercentageDiscountDiscountTypePercentage InvoiceDiscountPercentageDiscountDiscountType = "percentage"
)

type InvoiceDiscountTrialDiscount

type InvoiceDiscountTrialDiscount struct {
	// List of price_ids that this discount applies to. For plan/plan phase discounts,
	// this can be a subset of prices.
	AppliesToPriceIDs []string                                 `json:"applies_to_price_ids,required"`
	DiscountType      InvoiceDiscountTrialDiscountDiscountType `json:"discount_type,required"`
	// Only available if discount_type is `trial`
	TrialAmountDiscount string `json:"trial_amount_discount,nullable"`
	// Only available if discount_type is `trial`
	TrialPercentageDiscount float64 `json:"trial_percentage_discount,nullable"`
	JSON                    invoiceDiscountTrialDiscountJSON
}

func (*InvoiceDiscountTrialDiscount) UnmarshalJSON

func (r *InvoiceDiscountTrialDiscount) UnmarshalJSON(data []byte) (err error)

type InvoiceDiscountTrialDiscountDiscountType

type InvoiceDiscountTrialDiscountDiscountType string
const (
	InvoiceDiscountTrialDiscountDiscountTypeTrial InvoiceDiscountTrialDiscountDiscountType = "trial"
)

type InvoiceDiscountUsageDiscount

type InvoiceDiscountUsageDiscount struct {
	// List of price_ids that this discount applies to. For plan/plan phase discounts,
	// this can be a subset of prices.
	AppliesToPriceIDs []string                                 `json:"applies_to_price_ids,required"`
	DiscountType      InvoiceDiscountUsageDiscountDiscountType `json:"discount_type,required"`
	// Only available if discount_type is `usage`. Number of usage units that this
	// discount is for
	UsageDiscount float64 `json:"usage_discount,required"`
	JSON          invoiceDiscountUsageDiscountJSON
}

func (*InvoiceDiscountUsageDiscount) UnmarshalJSON

func (r *InvoiceDiscountUsageDiscount) UnmarshalJSON(data []byte) (err error)

type InvoiceDiscountUsageDiscountDiscountType

type InvoiceDiscountUsageDiscountDiscountType string
const (
	InvoiceDiscountUsageDiscountDiscountTypeUsage InvoiceDiscountUsageDiscountDiscountType = "usage"
)

type InvoiceFetchUpcomingParams

type InvoiceFetchUpcomingParams struct {
	SubscriptionID param.Field[string] `query:"subscription_id"`
}

func (InvoiceFetchUpcomingParams) URLQuery

func (r InvoiceFetchUpcomingParams) URLQuery() (v url.Values)

URLQuery serializes InvoiceFetchUpcomingParams's query parameters as `url.Values`.

type InvoiceFetchUpcomingResponse

type InvoiceFetchUpcomingResponse struct {
	ID string `json:"id,required"`
	// This is the final amount required to be charged to the customer and reflects the
	// application of the customer balance to the `total` of the invoice.
	AmountDue      string                                     `json:"amount_due,required"`
	AutoCollection InvoiceFetchUpcomingResponseAutoCollection `json:"auto_collection,required"`
	BillingAddress InvoiceFetchUpcomingResponseBillingAddress `json:"billing_address,required,nullable"`
	// The creation time of the resource in Orb.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// A list of credit notes associated with the invoice
	CreditNotes []InvoiceFetchUpcomingResponseCreditNote `json:"credit_notes,required"`
	// An ISO 4217 currency string or `credits`
	Currency                    string                                                   `json:"currency,required"`
	Customer                    InvoiceFetchUpcomingResponseCustomer                     `json:"customer,required"`
	CustomerBalanceTransactions []InvoiceFetchUpcomingResponseCustomerBalanceTransaction `json:"customer_balance_transactions,required"`
	CustomerTaxID               InvoiceFetchUpcomingResponseCustomerTaxID                `json:"customer_tax_id,required,nullable"`
	Discount                    InvoiceDiscount                                          `json:"discount,required,nullable"`
	Discounts                   []InvoiceDiscount                                        `json:"discounts,required"`
	// When the invoice payment is due.
	DueDate time.Time `json:"due_date,required" format:"date-time"`
	// If the invoice has a status of `draft`, this will be the time that the invoice
	// will be eligible to be issued, otherwise it will be `null`. If `auto-issue` is
	// true, the invoice will automatically begin issuing at this time.
	EligibleToIssueAt time.Time `json:"eligible_to_issue_at,required,nullable" format:"date-time"`
	// A URL for the invoice portal.
	HostedInvoiceURL string `json:"hosted_invoice_url,required,nullable"`
	// Automatically generated invoice number to help track and reconcile invoices.
	// Invoice numbers have a prefix such as `RFOBWG`. These can be sequential per
	// account or customer.
	InvoiceNumber string `json:"invoice_number,required"`
	// The link to download the PDF representation of the `Invoice`.
	InvoicePdf string `json:"invoice_pdf,required,nullable"`
	// If the invoice failed to issue, this will be the last time it failed to issue
	// (even if it is now in a different state.)
	IssueFailedAt time.Time `json:"issue_failed_at,required,nullable" format:"date-time"`
	// If the invoice has been issued, this will be the time it transitioned to
	// `issued` (even if it is now in a different state.)
	IssuedAt time.Time `json:"issued_at,required,nullable" format:"date-time"`
	// The breakdown of prices in this invoice.
	LineItems     []InvoiceFetchUpcomingResponseLineItem `json:"line_items,required"`
	Maximum       InvoiceFetchUpcomingResponseMaximum    `json:"maximum,required,nullable"`
	MaximumAmount string                                 `json:"maximum_amount,required,nullable"`
	// Free-form text which is available on the invoice PDF and the Orb invoice portal.
	Memo          string                              `json:"memo,required,nullable"`
	Metadata      interface{}                         `json:"metadata,required"`
	Minimum       InvoiceFetchUpcomingResponseMinimum `json:"minimum,required,nullable"`
	MinimumAmount string                              `json:"minimum_amount,required,nullable"`
	// If the invoice has a status of `paid`, this gives a timestamp when the invoice
	// was paid.
	PaidAt time.Time `json:"paid_at,required,nullable" format:"date-time"`
	// If payment was attempted on this invoice but failed, this will be the time of
	// the most recent attempt.
	PaymentFailedAt time.Time `json:"payment_failed_at,required,nullable" format:"date-time"`
	// If payment was attempted on this invoice, this will be the start time of the
	// most recent attempt. This field is especially useful for delayed-notification
	// payment mechanisms (like bank transfers), where payment can take 3 days or more.
	PaymentStartedAt time.Time `json:"payment_started_at,required,nullable" format:"date-time"`
	// If the invoice is in draft, this timestamp will reflect when the invoice is
	// scheduled to be issued.
	ScheduledIssueAt time.Time                                   `json:"scheduled_issue_at,required,nullable" format:"date-time"`
	ShippingAddress  InvoiceFetchUpcomingResponseShippingAddress `json:"shipping_address,required,nullable"`
	Status           InvoiceFetchUpcomingResponseStatus          `json:"status,required"`
	Subscription     InvoiceFetchUpcomingResponseSubscription    `json:"subscription,required,nullable"`
	// The total before any discounts and minimums are applied.
	Subtotal string `json:"subtotal,required"`
	// If the invoice failed to sync, this will be the last time an external invoicing
	// provider sync was attempted. This field will always be `null` for invoices using
	// Orb Invoicing.
	SyncFailedAt time.Time `json:"sync_failed_at,required,nullable" format:"date-time"`
	// The scheduled date of the invoice
	TargetDate time.Time `json:"target_date,required" format:"date-time"`
	// The total after any minimums and discounts have been applied.
	Total string `json:"total,required"`
	// If the invoice has a status of `void`, this gives a timestamp when the invoice
	// was voided.
	VoidedAt time.Time `json:"voided_at,required,nullable" format:"date-time"`
	// This is true if the invoice will be automatically issued in the future, and
	// false otherwise.
	WillAutoIssue bool `json:"will_auto_issue,required"`
	JSON          invoiceFetchUpcomingResponseJSON
}

func (*InvoiceFetchUpcomingResponse) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponse) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseAutoCollection

type InvoiceFetchUpcomingResponseAutoCollection struct {
	// True only if auto-collection is enabled for this invoice.
	Enabled bool `json:"enabled,required,nullable"`
	// If the invoice is scheduled for auto-collection, this field will reflect when
	// the next attempt will occur. If dunning has been exhausted, or auto-collection
	// is not enabled for this invoice, this field will be `null`.
	NextAttemptAt time.Time `json:"next_attempt_at,required,nullable" format:"date-time"`
	// If Orb has ever attempted payment auto-collection for this invoice, this field
	// will reflect when that attempt occurred. In conjunction with `next_attempt_at`,
	// this can be used to tell whether the invoice is currently in dunning (that is,
	// `previously_attempted_at` is non-null, and `next_attempt_time` is non-null), or
	// if dunning has been exhausted (`previously_attempted_at` is non-null, but
	// `next_attempt_time` is null).
	PreviouslyAttemptedAt time.Time `json:"previously_attempted_at,required,nullable" format:"date-time"`
	JSON                  invoiceFetchUpcomingResponseAutoCollectionJSON
}

func (*InvoiceFetchUpcomingResponseAutoCollection) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseAutoCollection) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseBillingAddress

type InvoiceFetchUpcomingResponseBillingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       invoiceFetchUpcomingResponseBillingAddressJSON
}

func (*InvoiceFetchUpcomingResponseBillingAddress) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseBillingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseCreditNote

type InvoiceFetchUpcomingResponseCreditNote struct {
	ID               string `json:"id,required"`
	CreditNoteNumber string `json:"credit_note_number,required"`
	Reason           string `json:"reason,required"`
	Total            string `json:"total,required"`
	Type             string `json:"type,required"`
	// If the credit note has a status of `void`, this gives a timestamp when the
	// credit note was voided.
	VoidedAt time.Time `json:"voided_at,required,nullable" format:"date-time"`
	JSON     invoiceFetchUpcomingResponseCreditNoteJSON
}

func (*InvoiceFetchUpcomingResponseCreditNote) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseCreditNote) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseCustomer

type InvoiceFetchUpcomingResponseCustomer struct {
	ID                 string `json:"id,required"`
	ExternalCustomerID string `json:"external_customer_id,required,nullable"`
	JSON               invoiceFetchUpcomingResponseCustomerJSON
}

func (*InvoiceFetchUpcomingResponseCustomer) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseCustomer) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseCustomerBalanceTransaction

type InvoiceFetchUpcomingResponseCustomerBalanceTransaction struct {
	// A unique id for this transaction.
	ID     string                                                        `json:"id,required"`
	Action InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction `json:"action,required"`
	// The value of the amount changed in the transaction.
	Amount string `json:"amount,required"`
	// The creation time of this transaction.
	CreatedAt  time.Time                                                         `json:"created_at,required" format:"date-time"`
	CreditNote InvoiceFetchUpcomingResponseCustomerBalanceTransactionsCreditNote `json:"credit_note,required,nullable"`
	// An optional description provided for manual customer balance adjustments.
	Description string `json:"description,required,nullable"`
	// The new value of the customer's balance prior to the transaction, in the
	// customer's currency.
	EndingBalance string                                                         `json:"ending_balance,required"`
	Invoice       InvoiceFetchUpcomingResponseCustomerBalanceTransactionsInvoice `json:"invoice,required,nullable"`
	// The original value of the customer's balance prior to the transaction, in the
	// customer's currency.
	StartingBalance string                                                      `json:"starting_balance,required"`
	Type            InvoiceFetchUpcomingResponseCustomerBalanceTransactionsType `json:"type,required"`
	JSON            invoiceFetchUpcomingResponseCustomerBalanceTransactionJSON
}

func (*InvoiceFetchUpcomingResponseCustomerBalanceTransaction) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseCustomerBalanceTransaction) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction string
const (
	InvoiceFetchUpcomingResponseCustomerBalanceTransactionsActionAppliedToInvoice InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction = "applied_to_invoice"
	InvoiceFetchUpcomingResponseCustomerBalanceTransactionsActionProratedRefund   InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction = "prorated_refund"
	InvoiceFetchUpcomingResponseCustomerBalanceTransactionsActionManualAdjustment InvoiceFetchUpcomingResponseCustomerBalanceTransactionsAction = "manual_adjustment"
)

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsCreditNote

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsCreditNote struct {
	// The id of the Credit note
	ID   string `json:"id,required"`
	JSON invoiceFetchUpcomingResponseCustomerBalanceTransactionsCreditNoteJSON
}

func (*InvoiceFetchUpcomingResponseCustomerBalanceTransactionsCreditNote) UnmarshalJSON

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsInvoice

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsInvoice struct {
	// The Invoice id
	ID   string `json:"id,required"`
	JSON invoiceFetchUpcomingResponseCustomerBalanceTransactionsInvoiceJSON
}

func (*InvoiceFetchUpcomingResponseCustomerBalanceTransactionsInvoice) UnmarshalJSON

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsType

type InvoiceFetchUpcomingResponseCustomerBalanceTransactionsType string
const (
	InvoiceFetchUpcomingResponseCustomerBalanceTransactionsTypeIncrement InvoiceFetchUpcomingResponseCustomerBalanceTransactionsType = "increment"
	InvoiceFetchUpcomingResponseCustomerBalanceTransactionsTypeDecrement InvoiceFetchUpcomingResponseCustomerBalanceTransactionsType = "decrement"
)

type InvoiceFetchUpcomingResponseCustomerTaxID

type InvoiceFetchUpcomingResponseCustomerTaxID struct {
	Country string `json:"country,required"`
	Type    string `json:"type,required"`
	Value   string `json:"value,required"`
	JSON    invoiceFetchUpcomingResponseCustomerTaxIDJSON
}

func (*InvoiceFetchUpcomingResponseCustomerTaxID) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseCustomerTaxID) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseLineItem

type InvoiceFetchUpcomingResponseLineItem struct {
	// A unique ID for this line item.
	ID string `json:"id,required"`
	// The final amount after any discounts or minimums.
	Amount   string          `json:"amount,required"`
	Discount InvoiceDiscount `json:"discount,required,nullable"`
	// The end date of the range of time applied for this line item's price.
	EndDate time.Time `json:"end_date,required" format:"date-time"`
	// [DEPRECATED] For configured prices that are split by a grouping key, this will
	// be populated with the key and a value. The `amount` and `subtotal` will be the
	// values for this particular grouping.
	Grouping      string                                       `json:"grouping,required,nullable"`
	Maximum       InvoiceFetchUpcomingResponseLineItemsMaximum `json:"maximum,required,nullable"`
	MaximumAmount string                                       `json:"maximum_amount,required,nullable"`
	Minimum       InvoiceFetchUpcomingResponseLineItemsMinimum `json:"minimum,required,nullable"`
	MinimumAmount string                                       `json:"minimum_amount,required,nullable"`
	// The name of the price associated with this line item.
	Name string `json:"name,required"`
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price    Price   `json:"price,required,nullable"`
	Quantity float64 `json:"quantity,required"`
	// The start date of the range of time applied for this line item's price.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	// For complex pricing structures, the line item can be broken down further in
	// `sub_line_items`.
	SubLineItems []InvoiceFetchUpcomingResponseLineItemsSubLineItem `json:"sub_line_items,required"`
	// The line amount before any line item-specific discounts or minimums.
	Subtotal string `json:"subtotal,required"`
	// An array of tax rates and their incurred tax amounts. Empty if no tax
	// integration is configured.
	TaxAmounts []InvoiceFetchUpcomingResponseLineItemsTaxAmount `json:"tax_amounts,required"`
	JSON       invoiceFetchUpcomingResponseLineItemJSON
}

func (*InvoiceFetchUpcomingResponseLineItem) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseLineItemsMaximum

type InvoiceFetchUpcomingResponseLineItemsMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          invoiceFetchUpcomingResponseLineItemsMaximumJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsMaximum) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseLineItemsMaximum) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseLineItemsMinimum

type InvoiceFetchUpcomingResponseLineItemsMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          invoiceFetchUpcomingResponseLineItemsMinimumJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsMinimum) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseLineItemsMinimum) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItem

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItem struct {
	// The total amount for this sub line item.
	Amount       string                                                                         `json:"amount,required"`
	Grouping     InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemGrouping     `json:"grouping,required,nullable"`
	MatrixConfig InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemMatrixConfig `json:"matrix_config,required"`
	Name         string                                                                         `json:"name,required"`
	Quantity     float64                                                                        `json:"quantity,required"`
	Type         InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemType         `json:"type,required"`
	JSON         invoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItem) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemGrouping

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemGroupingJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemGrouping) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemMatrixConfig

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemMatrixConfig struct {
	// The ordered dimension values for this line item.
	DimensionValues []string `json:"dimension_values,required"`
	JSON            invoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemMatrixConfigJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemMatrixConfig) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemType

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemType string
const (
	InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemTypeMatrix InvoiceFetchUpcomingResponseLineItemsSubLineItemsMatrixSubLineItemType = "matrix"
)

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItem

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItem struct {
	// The total amount for this sub line item.
	Amount   string                                                                    `json:"amount,required"`
	Grouping InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemGrouping `json:"grouping,required,nullable"`
	Name     string                                                                    `json:"name,required"`
	Quantity float64                                                                   `json:"quantity,required"`
	Type     InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemType     `json:"type,required"`
	JSON     invoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItem) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemGrouping

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemGroupingJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemGrouping) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemType

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemType string
const (
	InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemTypeNull InvoiceFetchUpcomingResponseLineItemsSubLineItemsOtherSubLineItemType = "'null'"
)

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItem

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItem struct {
	// The total amount for this sub line item.
	Amount     string                                                                     `json:"amount,required"`
	Grouping   InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemGrouping   `json:"grouping,required,nullable"`
	Name       string                                                                     `json:"name,required"`
	Quantity   float64                                                                    `json:"quantity,required"`
	TierConfig InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTierConfig `json:"tier_config,required"`
	Type       InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemType       `json:"type,required"`
	JSON       invoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItem) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemGrouping

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemGroupingJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemGrouping) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTierConfig

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTierConfig struct {
	FirstUnit  float64 `json:"first_unit,required"`
	LastUnit   float64 `json:"last_unit,required,nullable"`
	UnitAmount string  `json:"unit_amount,required"`
	JSON       invoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTierConfigJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTierConfig) UnmarshalJSON

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemType

type InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemType string
const (
	InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemTypeTier InvoiceFetchUpcomingResponseLineItemsSubLineItemsTierSubLineItemType = "tier"
)

type InvoiceFetchUpcomingResponseLineItemsTaxAmount

type InvoiceFetchUpcomingResponseLineItemsTaxAmount struct {
	// The amount of additional tax incurred by this tax rate.
	Amount string `json:"amount,required"`
	// The human-readable description of the applied tax rate.
	TaxRateDescription string `json:"tax_rate_description,required"`
	// The tax rate percentage, out of 100.
	TaxRatePercentage string `json:"tax_rate_percentage,required,nullable"`
	JSON              invoiceFetchUpcomingResponseLineItemsTaxAmountJSON
}

func (*InvoiceFetchUpcomingResponseLineItemsTaxAmount) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseLineItemsTaxAmount) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseMaximum

type InvoiceFetchUpcomingResponseMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          invoiceFetchUpcomingResponseMaximumJSON
}

func (*InvoiceFetchUpcomingResponseMaximum) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseMaximum) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseMinimum

type InvoiceFetchUpcomingResponseMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          invoiceFetchUpcomingResponseMinimumJSON
}

func (*InvoiceFetchUpcomingResponseMinimum) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseMinimum) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseShippingAddress

type InvoiceFetchUpcomingResponseShippingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       invoiceFetchUpcomingResponseShippingAddressJSON
}

func (*InvoiceFetchUpcomingResponseShippingAddress) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseShippingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceFetchUpcomingResponseStatus

type InvoiceFetchUpcomingResponseStatus string
const (
	InvoiceFetchUpcomingResponseStatusIssued InvoiceFetchUpcomingResponseStatus = "issued"
	InvoiceFetchUpcomingResponseStatusPaid   InvoiceFetchUpcomingResponseStatus = "paid"
	InvoiceFetchUpcomingResponseStatusSynced InvoiceFetchUpcomingResponseStatus = "synced"
	InvoiceFetchUpcomingResponseStatusVoid   InvoiceFetchUpcomingResponseStatus = "void"
	InvoiceFetchUpcomingResponseStatusDraft  InvoiceFetchUpcomingResponseStatus = "draft"
)

type InvoiceFetchUpcomingResponseSubscription

type InvoiceFetchUpcomingResponseSubscription struct {
	ID   string `json:"id,required"`
	JSON invoiceFetchUpcomingResponseSubscriptionJSON
}

func (*InvoiceFetchUpcomingResponseSubscription) UnmarshalJSON

func (r *InvoiceFetchUpcomingResponseSubscription) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItem

type InvoiceLineItem struct {
	// A unique ID for this line item.
	ID string `json:"id,required"`
	// The final amount after any discounts or minimums.
	Amount   string          `json:"amount,required"`
	Discount InvoiceDiscount `json:"discount,required,nullable"`
	// The end date of the range of time applied for this line item's price.
	EndDate time.Time `json:"end_date,required" format:"date-time"`
	// [DEPRECATED] For configured prices that are split by a grouping key, this will
	// be populated with the key and a value. The `amount` and `subtotal` will be the
	// values for this particular grouping.
	Grouping      string                  `json:"grouping,required,nullable"`
	Maximum       InvoiceLineItemsMaximum `json:"maximum,required,nullable"`
	MaximumAmount string                  `json:"maximum_amount,required,nullable"`
	Minimum       InvoiceLineItemsMinimum `json:"minimum,required,nullable"`
	MinimumAmount string                  `json:"minimum_amount,required,nullable"`
	// The name of the price associated with this line item.
	Name string `json:"name,required"`
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price    Price   `json:"price,required,nullable"`
	Quantity float64 `json:"quantity,required"`
	// The start date of the range of time applied for this line item's price.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	// For complex pricing structures, the line item can be broken down further in
	// `sub_line_items`.
	SubLineItems []InvoiceLineItemsSubLineItem `json:"sub_line_items,required"`
	// The line amount before any line item-specific discounts or minimums.
	Subtotal string `json:"subtotal,required"`
	// An array of tax rates and their incurred tax amounts. Empty if no tax
	// integration is configured.
	TaxAmounts []InvoiceLineItemsTaxAmount `json:"tax_amounts,required"`
	JSON       invoiceLineItemJSON
}

func (*InvoiceLineItem) UnmarshalJSON

func (r *InvoiceLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewParams

type InvoiceLineItemNewParams struct {
	// The total amount in the invoice's currency to add to the line item.
	Amount param.Field[string] `json:"amount,required"`
	// A date string to specify the line item's end date in the customer's timezone.
	EndDate param.Field[time.Time] `json:"end_date,required" format:"date"`
	// The id of the Invoice to add this line item.
	InvoiceID param.Field[string] `json:"invoice_id,required"`
	// The item name associated with this line item. If an item with the same name
	// exists in Orb, that item will be associated with the line item.
	Name param.Field[string] `json:"name,required"`
	// The number of units on the line item
	Quantity param.Field[float64] `json:"quantity,required"`
	// A date string to specify the line item's start date in the customer's timezone.
	StartDate param.Field[time.Time] `json:"start_date,required" format:"date"`
}

func (InvoiceLineItemNewParams) MarshalJSON

func (r InvoiceLineItemNewParams) MarshalJSON() (data []byte, err error)

type InvoiceLineItemNewResponse

type InvoiceLineItemNewResponse struct {
	// A unique ID for this line item.
	ID string `json:"id,required"`
	// The final amount after any discounts or minimums.
	Amount   string          `json:"amount,required"`
	Discount InvoiceDiscount `json:"discount,required,nullable"`
	// The end date of the range of time applied for this line item's price.
	EndDate time.Time `json:"end_date,required" format:"date-time"`
	// [DEPRECATED] For configured prices that are split by a grouping key, this will
	// be populated with the key and a value. The `amount` and `subtotal` will be the
	// values for this particular grouping.
	Grouping      string                            `json:"grouping,required,nullable"`
	Maximum       InvoiceLineItemNewResponseMaximum `json:"maximum,required,nullable"`
	MaximumAmount string                            `json:"maximum_amount,required,nullable"`
	Minimum       InvoiceLineItemNewResponseMinimum `json:"minimum,required,nullable"`
	MinimumAmount string                            `json:"minimum_amount,required,nullable"`
	// The name of the price associated with this line item.
	Name string `json:"name,required"`
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price    Price   `json:"price,required,nullable"`
	Quantity float64 `json:"quantity,required"`
	// The start date of the range of time applied for this line item's price.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	// For complex pricing structures, the line item can be broken down further in
	// `sub_line_items`.
	SubLineItems []InvoiceLineItemNewResponseSubLineItem `json:"sub_line_items,required"`
	// The line amount before any line item-specific discounts or minimums.
	Subtotal string `json:"subtotal,required"`
	// An array of tax rates and their incurred tax amounts. Empty if no tax
	// integration is configured.
	TaxAmounts []InvoiceLineItemNewResponseTaxAmount `json:"tax_amounts,required"`
	JSON       invoiceLineItemNewResponseJSON
}

func (*InvoiceLineItemNewResponse) UnmarshalJSON

func (r *InvoiceLineItemNewResponse) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewResponseMaximum

type InvoiceLineItemNewResponseMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          invoiceLineItemNewResponseMaximumJSON
}

func (*InvoiceLineItemNewResponseMaximum) UnmarshalJSON

func (r *InvoiceLineItemNewResponseMaximum) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewResponseMinimum

type InvoiceLineItemNewResponseMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          invoiceLineItemNewResponseMinimumJSON
}

func (*InvoiceLineItemNewResponseMinimum) UnmarshalJSON

func (r *InvoiceLineItemNewResponseMinimum) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewResponseSubLineItem

type InvoiceLineItemNewResponseSubLineItem interface {
	// contains filtered or unexported methods
}

Union satisfied by InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItem, InvoiceLineItemNewResponseSubLineItemsTierSubLineItem or InvoiceLineItemNewResponseSubLineItemsOtherSubLineItem.

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItem

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItem struct {
	// The total amount for this sub line item.
	Amount       string                                                              `json:"amount,required"`
	Grouping     InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemGrouping     `json:"grouping,required,nullable"`
	MatrixConfig InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemMatrixConfig `json:"matrix_config,required"`
	Name         string                                                              `json:"name,required"`
	Quantity     float64                                                             `json:"quantity,required"`
	Type         InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemType         `json:"type,required"`
	JSON         invoiceLineItemNewResponseSubLineItemsMatrixSubLineItemJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItem) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemGrouping

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemNewResponseSubLineItemsMatrixSubLineItemGroupingJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemGrouping) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemMatrixConfig

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemMatrixConfig struct {
	// The ordered dimension values for this line item.
	DimensionValues []string `json:"dimension_values,required"`
	JSON            invoiceLineItemNewResponseSubLineItemsMatrixSubLineItemMatrixConfigJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemMatrixConfig) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemType

type InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemType string
const (
	InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemTypeMatrix InvoiceLineItemNewResponseSubLineItemsMatrixSubLineItemType = "matrix"
)

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItem

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItem struct {
	// The total amount for this sub line item.
	Amount   string                                                         `json:"amount,required"`
	Grouping InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemGrouping `json:"grouping,required,nullable"`
	Name     string                                                         `json:"name,required"`
	Quantity float64                                                        `json:"quantity,required"`
	Type     InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemType     `json:"type,required"`
	JSON     invoiceLineItemNewResponseSubLineItemsOtherSubLineItemJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsOtherSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemNewResponseSubLineItemsOtherSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemGrouping

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemNewResponseSubLineItemsOtherSubLineItemGroupingJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemGrouping) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemType

type InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemType string
const (
	InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemTypeNull InvoiceLineItemNewResponseSubLineItemsOtherSubLineItemType = "'null'"
)

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItem

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItem struct {
	// The total amount for this sub line item.
	Amount     string                                                          `json:"amount,required"`
	Grouping   InvoiceLineItemNewResponseSubLineItemsTierSubLineItemGrouping   `json:"grouping,required,nullable"`
	Name       string                                                          `json:"name,required"`
	Quantity   float64                                                         `json:"quantity,required"`
	TierConfig InvoiceLineItemNewResponseSubLineItemsTierSubLineItemTierConfig `json:"tier_config,required"`
	Type       InvoiceLineItemNewResponseSubLineItemsTierSubLineItemType       `json:"type,required"`
	JSON       invoiceLineItemNewResponseSubLineItemsTierSubLineItemJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsTierSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemNewResponseSubLineItemsTierSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemGrouping

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemNewResponseSubLineItemsTierSubLineItemGroupingJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsTierSubLineItemGrouping) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemTierConfig

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemTierConfig struct {
	FirstUnit  float64 `json:"first_unit,required"`
	LastUnit   float64 `json:"last_unit,required,nullable"`
	UnitAmount string  `json:"unit_amount,required"`
	JSON       invoiceLineItemNewResponseSubLineItemsTierSubLineItemTierConfigJSON
}

func (*InvoiceLineItemNewResponseSubLineItemsTierSubLineItemTierConfig) UnmarshalJSON

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemType

type InvoiceLineItemNewResponseSubLineItemsTierSubLineItemType string
const (
	InvoiceLineItemNewResponseSubLineItemsTierSubLineItemTypeTier InvoiceLineItemNewResponseSubLineItemsTierSubLineItemType = "tier"
)

type InvoiceLineItemNewResponseTaxAmount

type InvoiceLineItemNewResponseTaxAmount struct {
	// The amount of additional tax incurred by this tax rate.
	Amount string `json:"amount,required"`
	// The human-readable description of the applied tax rate.
	TaxRateDescription string `json:"tax_rate_description,required"`
	// The tax rate percentage, out of 100.
	TaxRatePercentage string `json:"tax_rate_percentage,required,nullable"`
	JSON              invoiceLineItemNewResponseTaxAmountJSON
}

func (*InvoiceLineItemNewResponseTaxAmount) UnmarshalJSON

func (r *InvoiceLineItemNewResponseTaxAmount) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemService

type InvoiceLineItemService struct {
	Options []option.RequestOption
}

InvoiceLineItemService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInvoiceLineItemService method instead.

func NewInvoiceLineItemService

func NewInvoiceLineItemService(opts ...option.RequestOption) (r *InvoiceLineItemService)

NewInvoiceLineItemService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InvoiceLineItemService) New

This creates a one-off fixed fee invoice line item on an Invoice. This can only be done for invoices that are in a `draft` status.

type InvoiceLineItemsMaximum

type InvoiceLineItemsMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          invoiceLineItemsMaximumJSON
}

func (*InvoiceLineItemsMaximum) UnmarshalJSON

func (r *InvoiceLineItemsMaximum) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsMinimum

type InvoiceLineItemsMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          invoiceLineItemsMinimumJSON
}

func (*InvoiceLineItemsMinimum) UnmarshalJSON

func (r *InvoiceLineItemsMinimum) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItem

type InvoiceLineItemsSubLineItem interface {
	// contains filtered or unexported methods
}

Union satisfied by InvoiceLineItemsSubLineItemsMatrixSubLineItem, InvoiceLineItemsSubLineItemsTierSubLineItem or InvoiceLineItemsSubLineItemsOtherSubLineItem.

type InvoiceLineItemsSubLineItemsMatrixSubLineItem

type InvoiceLineItemsSubLineItemsMatrixSubLineItem struct {
	// The total amount for this sub line item.
	Amount       string                                                    `json:"amount,required"`
	Grouping     InvoiceLineItemsSubLineItemsMatrixSubLineItemGrouping     `json:"grouping,required,nullable"`
	MatrixConfig InvoiceLineItemsSubLineItemsMatrixSubLineItemMatrixConfig `json:"matrix_config,required"`
	Name         string                                                    `json:"name,required"`
	Quantity     float64                                                   `json:"quantity,required"`
	Type         InvoiceLineItemsSubLineItemsMatrixSubLineItemType         `json:"type,required"`
	JSON         invoiceLineItemsSubLineItemsMatrixSubLineItemJSON
}

func (*InvoiceLineItemsSubLineItemsMatrixSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsMatrixSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsMatrixSubLineItemGrouping

type InvoiceLineItemsSubLineItemsMatrixSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemsSubLineItemsMatrixSubLineItemGroupingJSON
}

func (*InvoiceLineItemsSubLineItemsMatrixSubLineItemGrouping) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsMatrixSubLineItemGrouping) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsMatrixSubLineItemMatrixConfig

type InvoiceLineItemsSubLineItemsMatrixSubLineItemMatrixConfig struct {
	// The ordered dimension values for this line item.
	DimensionValues []string `json:"dimension_values,required"`
	JSON            invoiceLineItemsSubLineItemsMatrixSubLineItemMatrixConfigJSON
}

func (*InvoiceLineItemsSubLineItemsMatrixSubLineItemMatrixConfig) UnmarshalJSON

type InvoiceLineItemsSubLineItemsMatrixSubLineItemType

type InvoiceLineItemsSubLineItemsMatrixSubLineItemType string
const (
	InvoiceLineItemsSubLineItemsMatrixSubLineItemTypeMatrix InvoiceLineItemsSubLineItemsMatrixSubLineItemType = "matrix"
)

type InvoiceLineItemsSubLineItemsOtherSubLineItem

type InvoiceLineItemsSubLineItemsOtherSubLineItem struct {
	// The total amount for this sub line item.
	Amount   string                                               `json:"amount,required"`
	Grouping InvoiceLineItemsSubLineItemsOtherSubLineItemGrouping `json:"grouping,required,nullable"`
	Name     string                                               `json:"name,required"`
	Quantity float64                                              `json:"quantity,required"`
	Type     InvoiceLineItemsSubLineItemsOtherSubLineItemType     `json:"type,required"`
	JSON     invoiceLineItemsSubLineItemsOtherSubLineItemJSON
}

func (*InvoiceLineItemsSubLineItemsOtherSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsOtherSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsOtherSubLineItemGrouping

type InvoiceLineItemsSubLineItemsOtherSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemsSubLineItemsOtherSubLineItemGroupingJSON
}

func (*InvoiceLineItemsSubLineItemsOtherSubLineItemGrouping) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsOtherSubLineItemGrouping) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsOtherSubLineItemType

type InvoiceLineItemsSubLineItemsOtherSubLineItemType string
const (
	InvoiceLineItemsSubLineItemsOtherSubLineItemTypeNull InvoiceLineItemsSubLineItemsOtherSubLineItemType = "'null'"
)

type InvoiceLineItemsSubLineItemsTierSubLineItem

type InvoiceLineItemsSubLineItemsTierSubLineItem struct {
	// The total amount for this sub line item.
	Amount     string                                                `json:"amount,required"`
	Grouping   InvoiceLineItemsSubLineItemsTierSubLineItemGrouping   `json:"grouping,required,nullable"`
	Name       string                                                `json:"name,required"`
	Quantity   float64                                               `json:"quantity,required"`
	TierConfig InvoiceLineItemsSubLineItemsTierSubLineItemTierConfig `json:"tier_config,required"`
	Type       InvoiceLineItemsSubLineItemsTierSubLineItemType       `json:"type,required"`
	JSON       invoiceLineItemsSubLineItemsTierSubLineItemJSON
}

func (*InvoiceLineItemsSubLineItemsTierSubLineItem) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsTierSubLineItem) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsTierSubLineItemGrouping

type InvoiceLineItemsSubLineItemsTierSubLineItemGrouping struct {
	Key string `json:"key,required"`
	// No value indicates the default group
	Value string `json:"value,required,nullable"`
	JSON  invoiceLineItemsSubLineItemsTierSubLineItemGroupingJSON
}

func (*InvoiceLineItemsSubLineItemsTierSubLineItemGrouping) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsTierSubLineItemGrouping) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsTierSubLineItemTierConfig

type InvoiceLineItemsSubLineItemsTierSubLineItemTierConfig struct {
	FirstUnit  float64 `json:"first_unit,required"`
	LastUnit   float64 `json:"last_unit,required,nullable"`
	UnitAmount string  `json:"unit_amount,required"`
	JSON       invoiceLineItemsSubLineItemsTierSubLineItemTierConfigJSON
}

func (*InvoiceLineItemsSubLineItemsTierSubLineItemTierConfig) UnmarshalJSON

func (r *InvoiceLineItemsSubLineItemsTierSubLineItemTierConfig) UnmarshalJSON(data []byte) (err error)

type InvoiceLineItemsSubLineItemsTierSubLineItemType

type InvoiceLineItemsSubLineItemsTierSubLineItemType string
const (
	InvoiceLineItemsSubLineItemsTierSubLineItemTypeTier InvoiceLineItemsSubLineItemsTierSubLineItemType = "tier"
)

type InvoiceLineItemsTaxAmount

type InvoiceLineItemsTaxAmount struct {
	// The amount of additional tax incurred by this tax rate.
	Amount string `json:"amount,required"`
	// The human-readable description of the applied tax rate.
	TaxRateDescription string `json:"tax_rate_description,required"`
	// The tax rate percentage, out of 100.
	TaxRatePercentage string `json:"tax_rate_percentage,required,nullable"`
	JSON              invoiceLineItemsTaxAmountJSON
}

func (*InvoiceLineItemsTaxAmount) UnmarshalJSON

func (r *InvoiceLineItemsTaxAmount) UnmarshalJSON(data []byte) (err error)

type InvoiceListParams

type InvoiceListParams struct {
	Amount   param.Field[string] `query:"amount"`
	AmountGt param.Field[string] `query:"amount[gt]"`
	AmountLt param.Field[string] `query:"amount[lt]"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor             param.Field[string]                    `query:"cursor"`
	CustomerID         param.Field[string]                    `query:"customer_id"`
	DateType           param.Field[InvoiceListParamsDateType] `query:"date_type"`
	DueDate            param.Field[time.Time]                 `query:"due_date" format:"date"`
	DueDateWindow      param.Field[string]                    `query:"due_date_window"`
	DueDateGt          param.Field[time.Time]                 `query:"due_date[gt]" format:"date"`
	DueDateLt          param.Field[time.Time]                 `query:"due_date[lt]" format:"date"`
	ExternalCustomerID param.Field[string]                    `query:"external_customer_id"`
	InvoiceDateGt      param.Field[time.Time]                 `query:"invoice_date[gt]" format:"date-time"`
	InvoiceDateGte     param.Field[time.Time]                 `query:"invoice_date[gte]" format:"date-time"`
	InvoiceDateLt      param.Field[time.Time]                 `query:"invoice_date[lt]" format:"date-time"`
	InvoiceDateLte     param.Field[time.Time]                 `query:"invoice_date[lte]" format:"date-time"`
	IsRecurring        param.Field[bool]                      `query:"is_recurring"`
	// The number of items to fetch. Defaults to 20.
	Limit          param.Field[int64]                   `query:"limit"`
	Status         param.Field[InvoiceListParamsStatus] `query:"status"`
	SubscriptionID param.Field[string]                  `query:"subscription_id"`
}

func (InvoiceListParams) URLQuery

func (r InvoiceListParams) URLQuery() (v url.Values)

URLQuery serializes InvoiceListParams's query parameters as `url.Values`.

type InvoiceListParamsDateType

type InvoiceListParamsDateType string
const (
	InvoiceListParamsDateTypeDueDate     InvoiceListParamsDateType = "due_date"
	InvoiceListParamsDateTypeInvoiceDate InvoiceListParamsDateType = "invoice_date"
)

type InvoiceListParamsStatus

type InvoiceListParamsStatus string
const (
	InvoiceListParamsStatusDraft  InvoiceListParamsStatus = "draft"
	InvoiceListParamsStatusIssued InvoiceListParamsStatus = "issued"
	InvoiceListParamsStatusPaid   InvoiceListParamsStatus = "paid"
	InvoiceListParamsStatusSynced InvoiceListParamsStatus = "synced"
	InvoiceListParamsStatusVoid   InvoiceListParamsStatus = "void"
)

type InvoiceMarkPaidParams

type InvoiceMarkPaidParams struct {
	// An optional external ID to associate with the payment.
	ExternalID param.Field[string] `json:"external_id,required"`
	// An optional note to associate with the payment.
	Notes param.Field[string] `json:"notes,required"`
	// A date string to specify the date of the payment.
	PaymentReceivedDate param.Field[time.Time] `json:"payment_received_date,required" format:"date"`
}

func (InvoiceMarkPaidParams) MarshalJSON

func (r InvoiceMarkPaidParams) MarshalJSON() (data []byte, err error)

type InvoiceMaximum

type InvoiceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          invoiceMaximumJSON
}

func (*InvoiceMaximum) UnmarshalJSON

func (r *InvoiceMaximum) UnmarshalJSON(data []byte) (err error)

type InvoiceMinimum

type InvoiceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          invoiceMinimumJSON
}

func (*InvoiceMinimum) UnmarshalJSON

func (r *InvoiceMinimum) UnmarshalJSON(data []byte) (err error)

type InvoiceNewParams

type InvoiceNewParams struct {
	// An ISO 4217 currency string. Must be the same as the customer's currency if it
	// is set.
	Currency param.Field[string] `json:"currency,required"`
	// Optional invoice date to set. Must be in the past, if not set, `invoice_date` is
	// set to the current time in the customer's timezone.
	InvoiceDate param.Field[time.Time]                  `json:"invoice_date,required" format:"date-time"`
	LineItems   param.Field[[]InvoiceNewParamsLineItem] `json:"line_items,required"`
	// Determines the difference between the invoice issue date for subscription
	// invoices as the date that they are due. A value of '0' here represents that the
	// invoice is due on issue, whereas a value of 30 represents that the customer has
	// 30 days to pay the invoice.
	NetTerms param.Field[int64] `json:"net_terms,required"`
	// The id of the `Customer` to create this invoice for. One of `customer_id` and
	// `external_customer_id` are required.
	CustomerID param.Field[string] `json:"customer_id"`
	// The `external_customer_id` of the `Customer` to create this invoice for. One of
	// `customer_id` and `external_customer_id` are required.
	ExternalCustomerID param.Field[string] `json:"external_customer_id"`
	// An optional memo to attach to the invoice.
	Memo param.Field[string] `json:"memo"`
	// When true, this invoice will automatically be issued upon creation. When false,
	// the resulting invoice will require manual review to issue. Defaulted to false.
	WillAutoIssue param.Field[bool] `json:"will_auto_issue"`
}

func (InvoiceNewParams) MarshalJSON

func (r InvoiceNewParams) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsLineItem

type InvoiceNewParamsLineItem struct {
	// A date string to specify the line item's end date in the customer's timezone.
	EndDate   param.Field[time.Time]                          `json:"end_date,required" format:"date"`
	ItemID    param.Field[string]                             `json:"item_id,required"`
	ModelType param.Field[InvoiceNewParamsLineItemsModelType] `json:"model_type,required"`
	// The name of the line item.
	Name param.Field[string] `json:"name,required"`
	// The number of units on the line item
	Quantity param.Field[float64] `json:"quantity,required"`
	// A date string to specify the line item's start date in the customer's timezone.
	StartDate  param.Field[time.Time]                           `json:"start_date,required" format:"date"`
	UnitConfig param.Field[InvoiceNewParamsLineItemsUnitConfig] `json:"unit_config,required"`
}

func (InvoiceNewParamsLineItem) MarshalJSON

func (r InvoiceNewParamsLineItem) MarshalJSON() (data []byte, err error)

type InvoiceNewParamsLineItemsModelType

type InvoiceNewParamsLineItemsModelType string
const (
	InvoiceNewParamsLineItemsModelTypeUnit InvoiceNewParamsLineItemsModelType = "unit"
)

type InvoiceNewParamsLineItemsUnitConfig

type InvoiceNewParamsLineItemsUnitConfig struct {
	// Rate per unit of usage
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (InvoiceNewParamsLineItemsUnitConfig) MarshalJSON

func (r InvoiceNewParamsLineItemsUnitConfig) MarshalJSON() (data []byte, err error)

type InvoiceService

type InvoiceService struct {
	Options []option.RequestOption
}

InvoiceService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInvoiceService method instead.

func NewInvoiceService

func NewInvoiceService(opts ...option.RequestOption) (r *InvoiceService)

NewInvoiceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InvoiceService) Fetch

func (r *InvoiceService) Fetch(ctx context.Context, invoiceID string, opts ...option.RequestOption) (res *Invoice, err error)

This endpoint is used to fetch an [`Invoice`](../guides/concepts#invoice) given an identifier.

func (*InvoiceService) FetchUpcoming

This endpoint can be used to fetch the upcoming [invoice](../guides/concepts#invoice) for the current billing period given a subscription.

func (*InvoiceService) Issue

func (r *InvoiceService) Issue(ctx context.Context, invoiceID string, opts ...option.RequestOption) (res *Invoice, err error)

This endpoint allows an eligible invoice to be issued manually. This is only possible with invoices where status is `draft`, `will_auto_issue` is true, and an `eligible_to_issue_at` is a time in the past. Issuing an invoice could possibly trigger side effects, some of which could be customer-visible (e.g. sending emails, auto-collecting payment, syncing the invoice to external providers, etc).

func (*InvoiceService) List

func (r *InvoiceService) List(ctx context.Context, query InvoiceListParams, opts ...option.RequestOption) (res *shared.Page[Invoice], err error)

This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for an account in a list format.

The list of invoices is ordered starting from the most recently issued invoice date. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.

By default, this only returns invoices that are `issued`, `paid`, or `synced`.

func (*InvoiceService) ListAutoPaging

This endpoint returns a list of all [`Invoice`](../guides/concepts#invoice)s for an account in a list format.

The list of invoices is ordered starting from the most recently issued invoice date. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.

By default, this only returns invoices that are `issued`, `paid`, or `synced`.

func (*InvoiceService) MarkPaid

func (r *InvoiceService) MarkPaid(ctx context.Context, invoiceID string, body InvoiceMarkPaidParams, opts ...option.RequestOption) (res *Invoice, err error)

This endpoint allows an invoice's status to be set the `paid` status. This can only be done to invoices that are in the `issued` status.

func (*InvoiceService) New

func (r *InvoiceService) New(ctx context.Context, body InvoiceNewParams, opts ...option.RequestOption) (res *Invoice, err error)

This endpoint is used to create a one-off invoice for a customer.

func (*InvoiceService) Void

func (r *InvoiceService) Void(ctx context.Context, invoiceID string, opts ...option.RequestOption) (res *Invoice, err error)

This endpoint allows an invoice's status to be set the `void` status. This can only be done to invoices that are in the `issued` status.

If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding.

type InvoiceShippingAddress

type InvoiceShippingAddress struct {
	City       string `json:"city,required,nullable"`
	Country    string `json:"country,required,nullable"`
	Line1      string `json:"line1,required,nullable"`
	Line2      string `json:"line2,required,nullable"`
	PostalCode string `json:"postal_code,required,nullable"`
	State      string `json:"state,required,nullable"`
	JSON       invoiceShippingAddressJSON
}

func (*InvoiceShippingAddress) UnmarshalJSON

func (r *InvoiceShippingAddress) UnmarshalJSON(data []byte) (err error)

type InvoiceStatus

type InvoiceStatus string
const (
	InvoiceStatusIssued InvoiceStatus = "issued"
	InvoiceStatusPaid   InvoiceStatus = "paid"
	InvoiceStatusSynced InvoiceStatus = "synced"
	InvoiceStatusVoid   InvoiceStatus = "void"
	InvoiceStatusDraft  InvoiceStatus = "draft"
)

type InvoiceSubscription

type InvoiceSubscription struct {
	ID   string `json:"id,required"`
	JSON invoiceSubscriptionJSON
}

func (*InvoiceSubscription) UnmarshalJSON

func (r *InvoiceSubscription) UnmarshalJSON(data []byte) (err error)

type ItemFetchResponse

type ItemFetchResponse struct {
	ID                  string                                `json:"id,required"`
	CreatedAt           time.Time                             `json:"created_at,required" format:"date-time"`
	ExternalConnections []ItemFetchResponseExternalConnection `json:"external_connections,required"`
	Name                string                                `json:"name,required"`
	JSON                itemFetchResponseJSON
}

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

func (*ItemFetchResponse) UnmarshalJSON

func (r *ItemFetchResponse) UnmarshalJSON(data []byte) (err error)

type ItemFetchResponseExternalConnection

type ItemFetchResponseExternalConnection struct {
	ExternalConnectionName ItemFetchResponseExternalConnectionsExternalConnectionName `json:"external_connection_name,required"`
	ExternalEntityID       string                                                     `json:"external_entity_id,required"`
	JSON                   itemFetchResponseExternalConnectionJSON
}

func (*ItemFetchResponseExternalConnection) UnmarshalJSON

func (r *ItemFetchResponseExternalConnection) UnmarshalJSON(data []byte) (err error)

type ItemFetchResponseExternalConnectionsExternalConnectionName

type ItemFetchResponseExternalConnectionsExternalConnectionName string
const (
	ItemFetchResponseExternalConnectionsExternalConnectionNameStripe     ItemFetchResponseExternalConnectionsExternalConnectionName = "stripe"
	ItemFetchResponseExternalConnectionsExternalConnectionNameQuickbooks ItemFetchResponseExternalConnectionsExternalConnectionName = "quickbooks"
	ItemFetchResponseExternalConnectionsExternalConnectionNameBillCom    ItemFetchResponseExternalConnectionsExternalConnectionName = "bill.com"
	ItemFetchResponseExternalConnectionsExternalConnectionNameNetsuite   ItemFetchResponseExternalConnectionsExternalConnectionName = "netsuite"
	ItemFetchResponseExternalConnectionsExternalConnectionNameTaxjar     ItemFetchResponseExternalConnectionsExternalConnectionName = "taxjar"
	ItemFetchResponseExternalConnectionsExternalConnectionNameAvalara    ItemFetchResponseExternalConnectionsExternalConnectionName = "avalara"
	ItemFetchResponseExternalConnectionsExternalConnectionNameAnrok      ItemFetchResponseExternalConnectionsExternalConnectionName = "anrok"
)

type ItemListParams

type ItemListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (ItemListParams) URLQuery

func (r ItemListParams) URLQuery() (v url.Values)

URLQuery serializes ItemListParams's query parameters as `url.Values`.

type ItemListResponse

type ItemListResponse struct {
	ID                  string                               `json:"id,required"`
	CreatedAt           time.Time                            `json:"created_at,required" format:"date-time"`
	ExternalConnections []ItemListResponseExternalConnection `json:"external_connections,required"`
	Name                string                               `json:"name,required"`
	JSON                itemListResponseJSON
}

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

func (*ItemListResponse) UnmarshalJSON

func (r *ItemListResponse) UnmarshalJSON(data []byte) (err error)

type ItemListResponseExternalConnection

type ItemListResponseExternalConnection struct {
	ExternalConnectionName ItemListResponseExternalConnectionsExternalConnectionName `json:"external_connection_name,required"`
	ExternalEntityID       string                                                    `json:"external_entity_id,required"`
	JSON                   itemListResponseExternalConnectionJSON
}

func (*ItemListResponseExternalConnection) UnmarshalJSON

func (r *ItemListResponseExternalConnection) UnmarshalJSON(data []byte) (err error)

type ItemListResponseExternalConnectionsExternalConnectionName

type ItemListResponseExternalConnectionsExternalConnectionName string
const (
	ItemListResponseExternalConnectionsExternalConnectionNameStripe     ItemListResponseExternalConnectionsExternalConnectionName = "stripe"
	ItemListResponseExternalConnectionsExternalConnectionNameQuickbooks ItemListResponseExternalConnectionsExternalConnectionName = "quickbooks"
	ItemListResponseExternalConnectionsExternalConnectionNameBillCom    ItemListResponseExternalConnectionsExternalConnectionName = "bill.com"
	ItemListResponseExternalConnectionsExternalConnectionNameNetsuite   ItemListResponseExternalConnectionsExternalConnectionName = "netsuite"
	ItemListResponseExternalConnectionsExternalConnectionNameTaxjar     ItemListResponseExternalConnectionsExternalConnectionName = "taxjar"
	ItemListResponseExternalConnectionsExternalConnectionNameAvalara    ItemListResponseExternalConnectionsExternalConnectionName = "avalara"
	ItemListResponseExternalConnectionsExternalConnectionNameAnrok      ItemListResponseExternalConnectionsExternalConnectionName = "anrok"
)

type ItemService

type ItemService struct {
	Options []option.RequestOption
}

ItemService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewItemService method instead.

func NewItemService

func NewItemService(opts ...option.RequestOption) (r *ItemService)

NewItemService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ItemService) Fetch

func (r *ItemService) Fetch(ctx context.Context, itemID string, opts ...option.RequestOption) (res *ItemFetchResponse, err error)

This endpoint returns an item identified by its item_id.

func (*ItemService) List

func (r *ItemService) List(ctx context.Context, query ItemListParams, opts ...option.RequestOption) (res *shared.Page[ItemListResponse], err error)

This endpoint returns a list of all Items, ordered in descending order by creation time.

func (*ItemService) ListAutoPaging

This endpoint returns a list of all Items, ordered in descending order by creation time.

type MetricFetchResponse

type MetricFetchResponse struct {
	ID          string `json:"id,required"`
	Description string `json:"description,required,nullable"`
	// The Item resource represents a sellable product or good. Items are associated
	// with all line items, billable metrics, and prices and are used for defining
	// external sync behavior for invoices and tax calculation purposes.
	Item     MetricFetchResponseItem   `json:"item,required"`
	Metadata map[string]string         `json:"metadata,required"`
	Name     string                    `json:"name,required"`
	Status   MetricFetchResponseStatus `json:"status,required"`
	JSON     metricFetchResponseJSON
}

The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.

func (*MetricFetchResponse) UnmarshalJSON

func (r *MetricFetchResponse) UnmarshalJSON(data []byte) (err error)

type MetricFetchResponseItem

type MetricFetchResponseItem struct {
	ID                  string                                      `json:"id,required"`
	CreatedAt           time.Time                                   `json:"created_at,required" format:"date-time"`
	ExternalConnections []MetricFetchResponseItemExternalConnection `json:"external_connections,required"`
	Name                string                                      `json:"name,required"`
	JSON                metricFetchResponseItemJSON
}

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

func (*MetricFetchResponseItem) UnmarshalJSON

func (r *MetricFetchResponseItem) UnmarshalJSON(data []byte) (err error)

type MetricFetchResponseItemExternalConnection

type MetricFetchResponseItemExternalConnection struct {
	ExternalConnectionName MetricFetchResponseItemExternalConnectionsExternalConnectionName `json:"external_connection_name,required"`
	ExternalEntityID       string                                                           `json:"external_entity_id,required"`
	JSON                   metricFetchResponseItemExternalConnectionJSON
}

func (*MetricFetchResponseItemExternalConnection) UnmarshalJSON

func (r *MetricFetchResponseItemExternalConnection) UnmarshalJSON(data []byte) (err error)

type MetricFetchResponseItemExternalConnectionsExternalConnectionName

type MetricFetchResponseItemExternalConnectionsExternalConnectionName string
const (
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameStripe     MetricFetchResponseItemExternalConnectionsExternalConnectionName = "stripe"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameQuickbooks MetricFetchResponseItemExternalConnectionsExternalConnectionName = "quickbooks"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameBillCom    MetricFetchResponseItemExternalConnectionsExternalConnectionName = "bill.com"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameNetsuite   MetricFetchResponseItemExternalConnectionsExternalConnectionName = "netsuite"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameTaxjar     MetricFetchResponseItemExternalConnectionsExternalConnectionName = "taxjar"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameAvalara    MetricFetchResponseItemExternalConnectionsExternalConnectionName = "avalara"
	MetricFetchResponseItemExternalConnectionsExternalConnectionNameAnrok      MetricFetchResponseItemExternalConnectionsExternalConnectionName = "anrok"
)

type MetricFetchResponseStatus

type MetricFetchResponseStatus string
const (
	MetricFetchResponseStatusActive   MetricFetchResponseStatus = "active"
	MetricFetchResponseStatusDraft    MetricFetchResponseStatus = "draft"
	MetricFetchResponseStatusArchived MetricFetchResponseStatus = "archived"
)

type MetricListParams

type MetricListParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (MetricListParams) URLQuery

func (r MetricListParams) URLQuery() (v url.Values)

URLQuery serializes MetricListParams's query parameters as `url.Values`.

type MetricListResponse

type MetricListResponse struct {
	ID          string `json:"id,required"`
	Description string `json:"description,required,nullable"`
	// The Item resource represents a sellable product or good. Items are associated
	// with all line items, billable metrics, and prices and are used for defining
	// external sync behavior for invoices and tax calculation purposes.
	Item     MetricListResponseItem   `json:"item,required"`
	Metadata map[string]string        `json:"metadata,required"`
	Name     string                   `json:"name,required"`
	Status   MetricListResponseStatus `json:"status,required"`
	JSON     metricListResponseJSON
}

The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.

func (*MetricListResponse) UnmarshalJSON

func (r *MetricListResponse) UnmarshalJSON(data []byte) (err error)

type MetricListResponseItem

type MetricListResponseItem struct {
	ID                  string                                     `json:"id,required"`
	CreatedAt           time.Time                                  `json:"created_at,required" format:"date-time"`
	ExternalConnections []MetricListResponseItemExternalConnection `json:"external_connections,required"`
	Name                string                                     `json:"name,required"`
	JSON                metricListResponseItemJSON
}

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

func (*MetricListResponseItem) UnmarshalJSON

func (r *MetricListResponseItem) UnmarshalJSON(data []byte) (err error)

type MetricListResponseItemExternalConnection

type MetricListResponseItemExternalConnection struct {
	ExternalConnectionName MetricListResponseItemExternalConnectionsExternalConnectionName `json:"external_connection_name,required"`
	ExternalEntityID       string                                                          `json:"external_entity_id,required"`
	JSON                   metricListResponseItemExternalConnectionJSON
}

func (*MetricListResponseItemExternalConnection) UnmarshalJSON

func (r *MetricListResponseItemExternalConnection) UnmarshalJSON(data []byte) (err error)

type MetricListResponseItemExternalConnectionsExternalConnectionName

type MetricListResponseItemExternalConnectionsExternalConnectionName string
const (
	MetricListResponseItemExternalConnectionsExternalConnectionNameStripe     MetricListResponseItemExternalConnectionsExternalConnectionName = "stripe"
	MetricListResponseItemExternalConnectionsExternalConnectionNameQuickbooks MetricListResponseItemExternalConnectionsExternalConnectionName = "quickbooks"
	MetricListResponseItemExternalConnectionsExternalConnectionNameBillCom    MetricListResponseItemExternalConnectionsExternalConnectionName = "bill.com"
	MetricListResponseItemExternalConnectionsExternalConnectionNameNetsuite   MetricListResponseItemExternalConnectionsExternalConnectionName = "netsuite"
	MetricListResponseItemExternalConnectionsExternalConnectionNameTaxjar     MetricListResponseItemExternalConnectionsExternalConnectionName = "taxjar"
	MetricListResponseItemExternalConnectionsExternalConnectionNameAvalara    MetricListResponseItemExternalConnectionsExternalConnectionName = "avalara"
	MetricListResponseItemExternalConnectionsExternalConnectionNameAnrok      MetricListResponseItemExternalConnectionsExternalConnectionName = "anrok"
)

type MetricListResponseStatus

type MetricListResponseStatus string
const (
	MetricListResponseStatusActive   MetricListResponseStatus = "active"
	MetricListResponseStatusDraft    MetricListResponseStatus = "draft"
	MetricListResponseStatusArchived MetricListResponseStatus = "archived"
)

type MetricNewParams

type MetricNewParams struct {
	// A description of the metric.
	Description param.Field[string] `json:"description,required"`
	// The id of the item
	ItemID param.Field[string] `json:"item_id,required"`
	// The name of the metric.
	Name param.Field[string] `json:"name,required"`
	// A sql string defining the metric.
	Sql param.Field[string] `json:"sql,required"`
	// User-specified key value pairs, often useful for referencing internal resources
	// or IDs. Returned as-is in the metric resource.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (MetricNewParams) MarshalJSON

func (r MetricNewParams) MarshalJSON() (data []byte, err error)

type MetricNewResponse

type MetricNewResponse struct {
	ID          string `json:"id,required"`
	Description string `json:"description,required,nullable"`
	// The Item resource represents a sellable product or good. Items are associated
	// with all line items, billable metrics, and prices and are used for defining
	// external sync behavior for invoices and tax calculation purposes.
	Item     MetricNewResponseItem   `json:"item,required"`
	Metadata map[string]string       `json:"metadata,required"`
	Name     string                  `json:"name,required"`
	Status   MetricNewResponseStatus `json:"status,required"`
	JSON     metricNewResponseJSON
}

The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.

func (*MetricNewResponse) UnmarshalJSON

func (r *MetricNewResponse) UnmarshalJSON(data []byte) (err error)

type MetricNewResponseItem

type MetricNewResponseItem struct {
	ID                  string                                    `json:"id,required"`
	CreatedAt           time.Time                                 `json:"created_at,required" format:"date-time"`
	ExternalConnections []MetricNewResponseItemExternalConnection `json:"external_connections,required"`
	Name                string                                    `json:"name,required"`
	JSON                metricNewResponseItemJSON
}

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

func (*MetricNewResponseItem) UnmarshalJSON

func (r *MetricNewResponseItem) UnmarshalJSON(data []byte) (err error)

type MetricNewResponseItemExternalConnection

type MetricNewResponseItemExternalConnection struct {
	ExternalConnectionName MetricNewResponseItemExternalConnectionsExternalConnectionName `json:"external_connection_name,required"`
	ExternalEntityID       string                                                         `json:"external_entity_id,required"`
	JSON                   metricNewResponseItemExternalConnectionJSON
}

func (*MetricNewResponseItemExternalConnection) UnmarshalJSON

func (r *MetricNewResponseItemExternalConnection) UnmarshalJSON(data []byte) (err error)

type MetricNewResponseItemExternalConnectionsExternalConnectionName

type MetricNewResponseItemExternalConnectionsExternalConnectionName string
const (
	MetricNewResponseItemExternalConnectionsExternalConnectionNameStripe     MetricNewResponseItemExternalConnectionsExternalConnectionName = "stripe"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameQuickbooks MetricNewResponseItemExternalConnectionsExternalConnectionName = "quickbooks"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameBillCom    MetricNewResponseItemExternalConnectionsExternalConnectionName = "bill.com"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameNetsuite   MetricNewResponseItemExternalConnectionsExternalConnectionName = "netsuite"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameTaxjar     MetricNewResponseItemExternalConnectionsExternalConnectionName = "taxjar"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameAvalara    MetricNewResponseItemExternalConnectionsExternalConnectionName = "avalara"
	MetricNewResponseItemExternalConnectionsExternalConnectionNameAnrok      MetricNewResponseItemExternalConnectionsExternalConnectionName = "anrok"
)

type MetricNewResponseStatus

type MetricNewResponseStatus string
const (
	MetricNewResponseStatusActive   MetricNewResponseStatus = "active"
	MetricNewResponseStatusDraft    MetricNewResponseStatus = "draft"
	MetricNewResponseStatusArchived MetricNewResponseStatus = "archived"
)

type MetricService

type MetricService struct {
	Options []option.RequestOption
}

MetricService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMetricService method instead.

func NewMetricService

func NewMetricService(opts ...option.RequestOption) (r *MetricService)

NewMetricService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*MetricService) Fetch

func (r *MetricService) Fetch(ctx context.Context, metricID string, opts ...option.RequestOption) (res *MetricFetchResponse, err error)

This endpoint is used to list [metrics](../guides/concepts##metric). It returns information about the metrics including its name, description, and item.

func (*MetricService) List

This endpoint is used to fetch [metric](../guides/concepts#metric) details given a metric identifier. It returns information about the metrics including its name, description, and item.

func (*MetricService) ListAutoPaging

This endpoint is used to fetch [metric](../guides/concepts#metric) details given a metric identifier. It returns information about the metrics including its name, description, and item.

func (*MetricService) New

This endpoint is used to create a [metric](../guides/concepts##metric) using a SQL string. See [SQL support](../guides/extensibility/advanced-metrics#sql-support) for a description of constructing SQL queries with examples.

type Plan

type Plan struct {
	ID       string       `json:"id,required"`
	BasePlan PlanBasePlan `json:"base_plan,required,nullable"`
	// The parent plan id if the given plan was created by overriding one or more of
	// the parent's prices
	BasePlanID string    `json:"base_plan_id,required,nullable"`
	CreatedAt  time.Time `json:"created_at,required" format:"date-time"`
	// An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's
	// prices.
	Currency string `json:"currency,required"`
	// The default memo text on the invoices corresponding to subscriptions on this
	// plan. Note that each subscription may configure its own memo.
	DefaultInvoiceMemo string          `json:"default_invoice_memo,required,nullable"`
	Description        string          `json:"description,required"`
	Discount           InvoiceDiscount `json:"discount,required,nullable"`
	// An optional user-defined ID for this plan resource, used throughout the system
	// as an alias for this Plan. Use this field to identify a plan by an existing
	// identifier in your system.
	ExternalPlanID string `json:"external_plan_id,required,nullable"`
	// An ISO 4217 currency string for which this plan is billed in. Matches `currency`
	// unless `currency` is a custom pricing unit.
	InvoicingCurrency string      `json:"invoicing_currency,required"`
	Maximum           PlanMaximum `json:"maximum,required,nullable"`
	MaximumAmount     string      `json:"maximum_amount,required,nullable"`
	Metadata          interface{} `json:"metadata,required"`
	Minimum           PlanMinimum `json:"minimum,required,nullable"`
	MinimumAmount     string      `json:"minimum_amount,required,nullable"`
	Name              string      `json:"name,required"`
	// Determines the difference between the invoice issue date and the due date. A
	// value of "0" here signifies that invoices are due on issue, whereas a value of
	// "30" means that the customer has a month to pay the invoice before its overdue.
	// Note that individual subscriptions or invoices may set a different net terms
	// configuration.
	NetTerms   int64           `json:"net_terms,required,nullable"`
	PlanPhases []PlanPlanPhase `json:"plan_phases,required,nullable"`
	// Prices for this plan. If the plan has phases, this includes prices across all
	// phases of the plan.
	Prices      []Price         `json:"prices,required"`
	Product     PlanProduct     `json:"product,required"`
	Status      PlanStatus      `json:"status,required"`
	TrialConfig PlanTrialConfig `json:"trial_config,required"`
	JSON        planJSON
}

The Plan(../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be subscribed to by a customer. Plans define the billing behavior of the subscription. You can see more about how to configure prices in the [Price resource](/reference/price).

func (*Plan) UnmarshalJSON

func (r *Plan) UnmarshalJSON(data []byte) (err error)

type PlanBasePlan

type PlanBasePlan struct {
	ID string `json:"id,required,nullable"`
	// An optional user-defined ID for this plan resource, used throughout the system
	// as an alias for this Plan. Use this field to identify a plan by an existing
	// identifier in your system.
	ExternalPlanID string `json:"external_plan_id,required,nullable"`
	Name           string `json:"name,required,nullable"`
	JSON           planBasePlanJSON
}

func (*PlanBasePlan) UnmarshalJSON

func (r *PlanBasePlan) UnmarshalJSON(data []byte) (err error)

type PlanExternalPlanIDService

type PlanExternalPlanIDService struct {
	Options []option.RequestOption
}

PlanExternalPlanIDService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPlanExternalPlanIDService method instead.

func NewPlanExternalPlanIDService

func NewPlanExternalPlanIDService(opts ...option.RequestOption) (r *PlanExternalPlanIDService)

NewPlanExternalPlanIDService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PlanExternalPlanIDService) Fetch

func (r *PlanExternalPlanIDService) Fetch(ctx context.Context, externalPlanID string, opts ...option.RequestOption) (res *Plan, err error)

This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) details given an external_plan_id identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.

## Serialized prices

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price(../guides/concepts#plan-and-price) object. The `model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](../guides/concepts#plan-and-price). "

func (*PlanExternalPlanIDService) Update

func (r *PlanExternalPlanIDService) Update(ctx context.Context, otherExternalPlanID string, body PlanExternalPlanIDUpdateParams, opts ...option.RequestOption) (res *Plan, err error)

This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) details given an external_plan_id identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.

## Serialized prices

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price(../guides/concepts#plan-and-price) object. The `model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](../guides/concepts#plan-and-price).

type PlanExternalPlanIDUpdateParams

type PlanExternalPlanIDUpdateParams struct {
	// An optional user-defined ID for this plan resource, used throughout the system
	// as an alias for this Plan. Use this field to identify a plan by an existing
	// identifier in your system.
	ExternalPlanID param.Field[string]      `json:"external_plan_id"`
	Metadata       param.Field[interface{}] `json:"metadata"`
}

func (PlanExternalPlanIDUpdateParams) MarshalJSON

func (r PlanExternalPlanIDUpdateParams) MarshalJSON() (data []byte, err error)

type PlanListParams

type PlanListParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
	// The plan status to filter to ('active', 'archived', or 'draft').
	Status param.Field[PlanListParamsStatus] `query:"status"`
}

func (PlanListParams) URLQuery

func (r PlanListParams) URLQuery() (v url.Values)

URLQuery serializes PlanListParams's query parameters as `url.Values`.

type PlanListParamsStatus

type PlanListParamsStatus string

The plan status to filter to ('active', 'archived', or 'draft').

const (
	PlanListParamsStatusActive   PlanListParamsStatus = "active"
	PlanListParamsStatusArchived PlanListParamsStatus = "archived"
	PlanListParamsStatusDraft    PlanListParamsStatus = "draft"
)

type PlanMaximum

type PlanMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          planMaximumJSON
}

func (*PlanMaximum) UnmarshalJSON

func (r *PlanMaximum) UnmarshalJSON(data []byte) (err error)

type PlanMinimum

type PlanMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          planMinimumJSON
}

func (*PlanMinimum) UnmarshalJSON

func (r *PlanMinimum) UnmarshalJSON(data []byte) (err error)

type PlanNewParams

type PlanNewParams struct {
	// An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's
	// prices.
	Currency param.Field[string] `json:"currency,required"`
	Name     param.Field[string] `json:"name,required"`
	// Prices for this plan. If the plan has phases, this includes prices across all
	// phases of the plan.
	Prices param.Field[[]interface{}] `json:"prices,required"`
	// Free-form text which is available on the invoice PDF and the Orb invoice portal.
	DefaultInvoiceMemo param.Field[string]      `json:"default_invoice_memo"`
	ExternalPlanID     param.Field[string]      `json:"external_plan_id"`
	Metadata           param.Field[interface{}] `json:"metadata"`
	// The net terms determines the difference between the invoice date and the issue
	// date for the invoice. If you intend the invoice to be due on issue, set this
	// to 0.
	NetTerms param.Field[int64] `json:"net_terms"`
}

func (PlanNewParams) MarshalJSON

func (r PlanNewParams) MarshalJSON() (data []byte, err error)

type PlanPlanPhase

type PlanPlanPhase struct {
	ID          string          `json:"id,required"`
	Description string          `json:"description,required,nullable"`
	Discount    InvoiceDiscount `json:"discount,required,nullable"`
	// How many terms of length `duration_unit` this phase is active for. If null, this
	// phase is evergreen and active indefinitely
	Duration      int64                      `json:"duration,required,nullable"`
	DurationUnit  PlanPlanPhasesDurationUnit `json:"duration_unit,required,nullable"`
	Maximum       PlanPlanPhasesMaximum      `json:"maximum,required,nullable"`
	MaximumAmount string                     `json:"maximum_amount,required,nullable"`
	Minimum       PlanPlanPhasesMinimum      `json:"minimum,required,nullable"`
	MinimumAmount string                     `json:"minimum_amount,required,nullable"`
	Name          string                     `json:"name,required"`
	// Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
	Order int64 `json:"order,required"`
	JSON  planPlanPhaseJSON
}

func (*PlanPlanPhase) UnmarshalJSON

func (r *PlanPlanPhase) UnmarshalJSON(data []byte) (err error)

type PlanPlanPhasesDurationUnit

type PlanPlanPhasesDurationUnit string
const (
	PlanPlanPhasesDurationUnitDaily     PlanPlanPhasesDurationUnit = "daily"
	PlanPlanPhasesDurationUnitMonthly   PlanPlanPhasesDurationUnit = "monthly"
	PlanPlanPhasesDurationUnitQuarterly PlanPlanPhasesDurationUnit = "quarterly"
	PlanPlanPhasesDurationUnitAnnual    PlanPlanPhasesDurationUnit = "annual"
)

type PlanPlanPhasesMaximum

type PlanPlanPhasesMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          planPlanPhasesMaximumJSON
}

func (*PlanPlanPhasesMaximum) UnmarshalJSON

func (r *PlanPlanPhasesMaximum) UnmarshalJSON(data []byte) (err error)

type PlanPlanPhasesMinimum

type PlanPlanPhasesMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          planPlanPhasesMinimumJSON
}

func (*PlanPlanPhasesMinimum) UnmarshalJSON

func (r *PlanPlanPhasesMinimum) UnmarshalJSON(data []byte) (err error)

type PlanProduct

type PlanProduct struct {
	ID        string    `json:"id,required"`
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	Name      string    `json:"name,required"`
	JSON      planProductJSON
}

func (*PlanProduct) UnmarshalJSON

func (r *PlanProduct) UnmarshalJSON(data []byte) (err error)

type PlanService

type PlanService struct {
	Options        []option.RequestOption
	ExternalPlanID *PlanExternalPlanIDService
}

PlanService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPlanService method instead.

func NewPlanService

func NewPlanService(opts ...option.RequestOption) (r *PlanService)

NewPlanService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PlanService) Fetch

func (r *PlanService) Fetch(ctx context.Context, planID string, opts ...option.RequestOption) (res *Plan, err error)

This endpoint is used to fetch [plan](../guides/concepts##plan-and-price) details given a plan identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.

## Serialized prices

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price(../guides/concepts#plan-and-price) object. The `model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](../guides/concepts#plan-and-price).

## Phases

Orb supports plan phases, also known as contract ramps. For plans with phases, the serialized prices refer to all prices across all phases.

func (*PlanService) List

func (r *PlanService) List(ctx context.Context, query PlanListParams, opts ...option.RequestOption) (res *shared.Page[Plan], err error)

This endpoint returns a list of all [plans](../guides/concepts##plan-and-price) for an account in a list format. The list of plans is ordered starting from the most recently created plan. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.

func (*PlanService) ListAutoPaging

func (r *PlanService) ListAutoPaging(ctx context.Context, query PlanListParams, opts ...option.RequestOption) *shared.PageAutoPager[Plan]

This endpoint returns a list of all [plans](../guides/concepts##plan-and-price) for an account in a list format. The list of plans is ordered starting from the most recently created plan. The response also includes [`pagination_metadata`](../reference/pagination), which lets the caller retrieve the next page of results if they exist.

func (*PlanService) New

func (r *PlanService) New(ctx context.Context, body PlanNewParams, opts ...option.RequestOption) (res *Plan, err error)

This endpoint allows creation of plans including their prices.

func (*PlanService) Update

func (r *PlanService) Update(ctx context.Context, planID string, body PlanUpdateParams, opts ...option.RequestOption) (res *Plan, err error)

This endpoint can be used to update the `external_plan_id`, and `metadata` of an existing plan.

Other fields on a customer are currently immutable.

type PlanStatus

type PlanStatus string
const (
	PlanStatusActive   PlanStatus = "active"
	PlanStatusArchived PlanStatus = "archived"
	PlanStatusDraft    PlanStatus = "draft"
)

type PlanTrialConfig

type PlanTrialConfig struct {
	TrialPeriod     int64                          `json:"trial_period,required,nullable"`
	TrialPeriodUnit PlanTrialConfigTrialPeriodUnit `json:"trial_period_unit,required"`
	JSON            planTrialConfigJSON
}

func (*PlanTrialConfig) UnmarshalJSON

func (r *PlanTrialConfig) UnmarshalJSON(data []byte) (err error)

type PlanTrialConfigTrialPeriodUnit

type PlanTrialConfigTrialPeriodUnit string
const (
	PlanTrialConfigTrialPeriodUnitDays PlanTrialConfigTrialPeriodUnit = "days"
)

type PlanUpdateParams

type PlanUpdateParams struct {
	// An optional user-defined ID for this plan resource, used throughout the system
	// as an alias for this Plan. Use this field to identify a plan by an existing
	// identifier in your system.
	ExternalPlanID param.Field[string]      `json:"external_plan_id"`
	Metadata       param.Field[interface{}] `json:"metadata"`
}

func (PlanUpdateParams) MarshalJSON

func (r PlanUpdateParams) MarshalJSON() (data []byte, err error)

type Price

type Price interface {
	// contains filtered or unexported methods
}

The Price resource represents a price that can be billed on a subscription, resulting in a charge on an invoice in the form of an invoice line item. Prices take a quantity and determine an amount to bill.

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price object. The model_type field determines the key for the configuration object that is present.

## Unit pricing

With unit pricing, each unit costs a fixed amount.

```json

{
    ...
    "model_type": "unit",
    "unit_config": {
        "unit_amount": "0.50"
    }
    ...
}

```

## Tiered pricing

In tiered pricing, the cost of a given unit depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first ten units may cost $0.50 each and all units thereafter may cost $0.10 each.

```json

{
    ...
    "model_type": "tiered",
    "tiered_config": {
        "tiers": [
            {
                "first_unit": 1,
                "last_unit": 10,
                "unit_amount": "0.50"
            },
            {
                "first_unit": 11,
                "last_unit": null,
                "unit_amount": "0.10"
            }
        ]
    }
    ...

```

## Bulk pricing

Bulk pricing applies when the number of units determine the cost of all units. For example, if you've bought less than 10 units, they may each be $0.50 for a total of $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 (i.e. 101 units total would be $40.40).

```json

{
    ...
    "model_type": "bulk",
    "bulk_config": {
        "tiers": [
            {
                "maximum_units": 10,
                "unit_amount": "0.50"
            },
            {
                "maximum_units": 1000,
                "unit_amount": "0.40"
            }
        ]
    }
    ...
}

```

## Package pricing

Package pricing defines the size or granularity of a unit for billing purposes. For example, if the package size is set to 5, then 4 units will be billed as 5 and 6 units will be billed at 10.

```json

{
    ...
    "model_type": "package",
    "package_config": {
        "package_amount": "0.80",
        "package_size": 10
    }
    ...
}

```

## BPS pricing

BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a percent (the number of basis points to charge), as well as a cap per event to assess. For example, this would allow you to assess a fee of 0.25% on every payment you process, with a maximum charge of $25 per payment.

```json

{
    ...
    "model_type": "bps",
    "bps_config": {
       "bps": 125,
       "per_unit_maximum": "11.00"
    }
    ...
 }

```

## Bulk BPS pricing

Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total quantity across all events. Similar to bulk pricing, the BPS parameters of a given event depends on the tier range that the billing period falls into. Each tier range is defined by an upper bound. For example, after $1.5M of payment volume is reached, each individual payment may have a lower cap or a smaller take-rate.

```json

    ...
    "model_type": "bulk_bps",
    "bulk_bps_config": {
        "tiers": [
           {
                "maximum_amount": "1000000.00",
                "bps": 125,
                "per_unit_maximum": "19.00"
           },
          {
                "maximum_amount": null,
                "bps": 115,
                "per_unit_maximum": "4.00"
            }
        ]
    }
    ...
}

```

## Tiered BPS pricing

Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's applicable parameter is a function of its marginal addition to the period total. Similar to tiered pricing, the BPS parameters of a given event depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first few payments may have a 0.8 BPS take-rate and all payments after a specific volume may incur a take-rate of 0.5 BPS each.

```json

    ...
    "model_type": "tiered_bps",
    "tiered_bps_config": {
        "tiers": [
           {
                "minimum_amount": "0",
                "maximum_amount": "1000000.00",
                "bps": 125,
                "per_unit_maximum": "19.00"
           },
          {
                "minimum_amount": "1000000.00",
                "maximum_amount": null,
                "bps": 115,
                "per_unit_maximum": "4.00"
            }
        ]
    }
    ...
}

```

## Matrix pricing

Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. `dimensions` defines the two event property values evaluated in this pricing model. In a one-dimensional matrix, the second value is `null`. Every configuration has a list of `matrix_values` which give the unit prices for specified property values. In a one-dimensional matrix, the matrix values will have `dimension_values` where the second value of the pair is null. If an event does not match any of the dimension values in the matrix, it will resort to the `default_unit_amount`.

```json

{
    "model_type": "matrix"
    "matrix_config": {
        "default_unit_amount": "3.00",
        "dimensions": [
            "cluster_name",
            "region"
        ],
        "matrix_values": [
            {
                "dimension_values": [
                    "alpha",
                    "west"
                ],
                "unit_amount": "2.00"
            },
            ...
        ]
    }
}

```

### Fixed fees

Fixed fees are prices that are applied independent of usage quantities, and follow unit pricing. They also have an additional parameter `fixed_price_quantity`. If the Price represents a fixed cost, this represents the quantity of units applied.

```json

{
    ...
    "id": "price_id",
    "model_type": "unit",
    "unit_config": {
       "unit_amount": "2.00"
    },
    "fixed_price_quantity": 3.0
    ...
}

```

Union satisfied by PriceUnitPrice, PricePackagePrice, PriceMatrixPrice, PriceTieredPrice, PriceTieredBpsPrice, PriceBpsPrice, PriceBulkBpsPrice, PriceBulkPrice, PriceTestRatingFunctionPrice, PriceFivetranExamplePrice, PriceThresholdTotalAmountPrice, PriceTieredPackagePrice, PriceTieredWithMinimumPrice or PricePackageWithAllocationPrice.

type PriceBpsPrice

type PriceBpsPrice struct {
	ID                 string                      `json:"id,required"`
	BillableMetric     PriceBpsPriceBillableMetric `json:"billable_metric,required,nullable"`
	BpsConfig          PriceBpsPriceBpsConfig      `json:"bps_config,required"`
	Cadence            PriceBpsPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                   `json:"created_at,required" format:"date-time"`
	Currency           string                      `json:"currency,required"`
	ExternalPriceID    string                      `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                     `json:"fixed_price_quantity,required,nullable"`
	Item               PriceBpsPriceItem           `json:"item,required"`
	ModelType          PriceBpsPriceModelType      `json:"model_type,required"`
	Name               string                      `json:"name,required"`
	PlanPhaseOrder     int64                       `json:"plan_phase_order,required,nullable"`
	PriceType          PriceBpsPricePriceType      `json:"price_type,required"`
	Discount           InvoiceDiscount             `json:"discount,nullable"`
	Maximum            PriceBpsPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                      `json:"maximum_amount,nullable"`
	Minimum            PriceBpsPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                      `json:"minimum_amount,nullable"`
	JSON               priceBpsPriceJSON
}

func (*PriceBpsPrice) UnmarshalJSON

func (r *PriceBpsPrice) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceBillableMetric

type PriceBpsPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceBpsPriceBillableMetricJSON
}

func (*PriceBpsPriceBillableMetric) UnmarshalJSON

func (r *PriceBpsPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceBpsConfig

type PriceBpsPriceBpsConfig struct {
	// Basis point take rate per event
	Bps float64 `json:"bps,required"`
	// Optional currency amount maximum to cap spend per event
	PerUnitMaximum string `json:"per_unit_maximum,nullable"`
	JSON           priceBpsPriceBpsConfigJSON
}

func (*PriceBpsPriceBpsConfig) UnmarshalJSON

func (r *PriceBpsPriceBpsConfig) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceCadence

type PriceBpsPriceCadence string
const (
	PriceBpsPriceCadenceOneTime   PriceBpsPriceCadence = "one_time"
	PriceBpsPriceCadenceMonthly   PriceBpsPriceCadence = "monthly"
	PriceBpsPriceCadenceQuarterly PriceBpsPriceCadence = "quarterly"
	PriceBpsPriceCadenceAnnual    PriceBpsPriceCadence = "annual"
)

type PriceBpsPriceItem

type PriceBpsPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceBpsPriceItemJSON
}

func (*PriceBpsPriceItem) UnmarshalJSON

func (r *PriceBpsPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceMaximum

type PriceBpsPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceBpsPriceMaximumJSON
}

func (*PriceBpsPriceMaximum) UnmarshalJSON

func (r *PriceBpsPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceMinimum

type PriceBpsPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceBpsPriceMinimumJSON
}

func (*PriceBpsPriceMinimum) UnmarshalJSON

func (r *PriceBpsPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceBpsPriceModelType

type PriceBpsPriceModelType string
const (
	PriceBpsPriceModelTypeBps PriceBpsPriceModelType = "bps"
)

type PriceBpsPricePriceType

type PriceBpsPricePriceType string
const (
	PriceBpsPricePriceTypeUsagePrice PriceBpsPricePriceType = "usage_price"
	PriceBpsPricePriceTypeFixedPrice PriceBpsPricePriceType = "fixed_price"
)

type PriceBulkBpsPrice

type PriceBulkBpsPrice struct {
	ID                 string                          `json:"id,required"`
	BillableMetric     PriceBulkBpsPriceBillableMetric `json:"billable_metric,required,nullable"`
	BulkBpsConfig      PriceBulkBpsPriceBulkBpsConfig  `json:"bulk_bps_config,required"`
	Cadence            PriceBulkBpsPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                       `json:"created_at,required" format:"date-time"`
	Currency           string                          `json:"currency,required"`
	ExternalPriceID    string                          `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                         `json:"fixed_price_quantity,required,nullable"`
	Item               PriceBulkBpsPriceItem           `json:"item,required"`
	ModelType          PriceBulkBpsPriceModelType      `json:"model_type,required"`
	Name               string                          `json:"name,required"`
	PlanPhaseOrder     int64                           `json:"plan_phase_order,required,nullable"`
	PriceType          PriceBulkBpsPricePriceType      `json:"price_type,required"`
	Discount           InvoiceDiscount                 `json:"discount,nullable"`
	Maximum            PriceBulkBpsPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                          `json:"maximum_amount,nullable"`
	Minimum            PriceBulkBpsPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                          `json:"minimum_amount,nullable"`
	JSON               priceBulkBpsPriceJSON
}

func (*PriceBulkBpsPrice) UnmarshalJSON

func (r *PriceBulkBpsPrice) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceBillableMetric

type PriceBulkBpsPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceBulkBpsPriceBillableMetricJSON
}

func (*PriceBulkBpsPriceBillableMetric) UnmarshalJSON

func (r *PriceBulkBpsPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceBulkBpsConfig

type PriceBulkBpsPriceBulkBpsConfig struct {
	// Tiers for a bulk BPS pricing model where all usage is aggregated to a single
	// tier based on total volume
	Tiers []PriceBulkBpsPriceBulkBpsConfigTier `json:"tiers,required"`
	JSON  priceBulkBpsPriceBulkBpsConfigJSON
}

func (*PriceBulkBpsPriceBulkBpsConfig) UnmarshalJSON

func (r *PriceBulkBpsPriceBulkBpsConfig) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceBulkBpsConfigTier

type PriceBulkBpsPriceBulkBpsConfigTier struct {
	// Basis points to rate on
	Bps float64 `json:"bps,required"`
	// Upper bound for tier
	MaximumAmount string `json:"maximum_amount,nullable"`
	// The maximum amount to charge for any one event
	PerUnitMaximum string `json:"per_unit_maximum,nullable"`
	JSON           priceBulkBpsPriceBulkBpsConfigTierJSON
}

func (*PriceBulkBpsPriceBulkBpsConfigTier) UnmarshalJSON

func (r *PriceBulkBpsPriceBulkBpsConfigTier) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceCadence

type PriceBulkBpsPriceCadence string
const (
	PriceBulkBpsPriceCadenceOneTime   PriceBulkBpsPriceCadence = "one_time"
	PriceBulkBpsPriceCadenceMonthly   PriceBulkBpsPriceCadence = "monthly"
	PriceBulkBpsPriceCadenceQuarterly PriceBulkBpsPriceCadence = "quarterly"
	PriceBulkBpsPriceCadenceAnnual    PriceBulkBpsPriceCadence = "annual"
)

type PriceBulkBpsPriceItem

type PriceBulkBpsPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceBulkBpsPriceItemJSON
}

func (*PriceBulkBpsPriceItem) UnmarshalJSON

func (r *PriceBulkBpsPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceMaximum

type PriceBulkBpsPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceBulkBpsPriceMaximumJSON
}

func (*PriceBulkBpsPriceMaximum) UnmarshalJSON

func (r *PriceBulkBpsPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceMinimum

type PriceBulkBpsPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceBulkBpsPriceMinimumJSON
}

func (*PriceBulkBpsPriceMinimum) UnmarshalJSON

func (r *PriceBulkBpsPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceBulkBpsPriceModelType

type PriceBulkBpsPriceModelType string
const (
	PriceBulkBpsPriceModelTypeBulkBps PriceBulkBpsPriceModelType = "bulk_bps"
)

type PriceBulkBpsPricePriceType

type PriceBulkBpsPricePriceType string
const (
	PriceBulkBpsPricePriceTypeUsagePrice PriceBulkBpsPricePriceType = "usage_price"
	PriceBulkBpsPricePriceTypeFixedPrice PriceBulkBpsPricePriceType = "fixed_price"
)

type PriceBulkPrice

type PriceBulkPrice struct {
	ID                 string                       `json:"id,required"`
	BillableMetric     PriceBulkPriceBillableMetric `json:"billable_metric,required,nullable"`
	BulkConfig         PriceBulkPriceBulkConfig     `json:"bulk_config,required"`
	Cadence            PriceBulkPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                    `json:"created_at,required" format:"date-time"`
	Currency           string                       `json:"currency,required"`
	ExternalPriceID    string                       `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                      `json:"fixed_price_quantity,required,nullable"`
	Item               PriceBulkPriceItem           `json:"item,required"`
	ModelType          PriceBulkPriceModelType      `json:"model_type,required"`
	Name               string                       `json:"name,required"`
	PlanPhaseOrder     int64                        `json:"plan_phase_order,required,nullable"`
	PriceType          PriceBulkPricePriceType      `json:"price_type,required"`
	Discount           InvoiceDiscount              `json:"discount,nullable"`
	Maximum            PriceBulkPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                       `json:"maximum_amount,nullable"`
	Minimum            PriceBulkPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                       `json:"minimum_amount,nullable"`
	JSON               priceBulkPriceJSON
}

func (*PriceBulkPrice) UnmarshalJSON

func (r *PriceBulkPrice) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceBillableMetric

type PriceBulkPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceBulkPriceBillableMetricJSON
}

func (*PriceBulkPriceBillableMetric) UnmarshalJSON

func (r *PriceBulkPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceBulkConfig

type PriceBulkPriceBulkConfig struct {
	// Bulk tiers for rating based on total usage volume
	Tiers []PriceBulkPriceBulkConfigTier `json:"tiers,required"`
	JSON  priceBulkPriceBulkConfigJSON
}

func (*PriceBulkPriceBulkConfig) UnmarshalJSON

func (r *PriceBulkPriceBulkConfig) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceBulkConfigTier

type PriceBulkPriceBulkConfigTier struct {
	// Amount per unit
	UnitAmount string `json:"unit_amount,required"`
	// Upper bound for this tier
	MaximumUnits float64 `json:"maximum_units,nullable"`
	JSON         priceBulkPriceBulkConfigTierJSON
}

func (*PriceBulkPriceBulkConfigTier) UnmarshalJSON

func (r *PriceBulkPriceBulkConfigTier) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceCadence

type PriceBulkPriceCadence string
const (
	PriceBulkPriceCadenceOneTime   PriceBulkPriceCadence = "one_time"
	PriceBulkPriceCadenceMonthly   PriceBulkPriceCadence = "monthly"
	PriceBulkPriceCadenceQuarterly PriceBulkPriceCadence = "quarterly"
	PriceBulkPriceCadenceAnnual    PriceBulkPriceCadence = "annual"
)

type PriceBulkPriceItem

type PriceBulkPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceBulkPriceItemJSON
}

func (*PriceBulkPriceItem) UnmarshalJSON

func (r *PriceBulkPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceMaximum

type PriceBulkPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceBulkPriceMaximumJSON
}

func (*PriceBulkPriceMaximum) UnmarshalJSON

func (r *PriceBulkPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceMinimum

type PriceBulkPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceBulkPriceMinimumJSON
}

func (*PriceBulkPriceMinimum) UnmarshalJSON

func (r *PriceBulkPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceBulkPriceModelType

type PriceBulkPriceModelType string
const (
	PriceBulkPriceModelTypeBulk PriceBulkPriceModelType = "bulk"
)

type PriceBulkPricePriceType

type PriceBulkPricePriceType string
const (
	PriceBulkPricePriceTypeUsagePrice PriceBulkPricePriceType = "usage_price"
	PriceBulkPricePriceTypeFixedPrice PriceBulkPricePriceType = "fixed_price"
)

type PriceExternalPriceIDService

type PriceExternalPriceIDService struct {
	Options []option.RequestOption
}

PriceExternalPriceIDService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPriceExternalPriceIDService method instead.

func NewPriceExternalPriceIDService

func NewPriceExternalPriceIDService(opts ...option.RequestOption) (r *PriceExternalPriceIDService)

NewPriceExternalPriceIDService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PriceExternalPriceIDService) Fetch

func (r *PriceExternalPriceIDService) Fetch(ctx context.Context, externalPriceID string, opts ...option.RequestOption) (res *Price, err error)

This endpoint returns a price given an external price id. See the [price creation API](../reference/create-price) for more information about external price aliases.

type PriceFivetranExamplePrice

type PriceFivetranExamplePrice struct {
	ID                    string                                  `json:"id,required"`
	BillableMetric        PriceFivetranExamplePriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence               PriceFivetranExamplePriceCadence        `json:"cadence,required"`
	CreatedAt             time.Time                               `json:"created_at,required" format:"date-time"`
	Currency              string                                  `json:"currency,required"`
	ExternalPriceID       string                                  `json:"external_price_id,required,nullable"`
	FivetranExampleConfig map[string]interface{}                  `json:"fivetran_example_config,required"`
	FixedPriceQuantity    float64                                 `json:"fixed_price_quantity,required,nullable"`
	Item                  PriceFivetranExamplePriceItem           `json:"item,required"`
	ModelType             PriceFivetranExamplePriceModelType      `json:"model_type,required"`
	Name                  string                                  `json:"name,required"`
	PlanPhaseOrder        int64                                   `json:"plan_phase_order,required,nullable"`
	PriceType             PriceFivetranExamplePricePriceType      `json:"price_type,required"`
	Discount              InvoiceDiscount                         `json:"discount,nullable"`
	Maximum               PriceFivetranExamplePriceMaximum        `json:"maximum,nullable"`
	MaximumAmount         string                                  `json:"maximum_amount,nullable"`
	Minimum               PriceFivetranExamplePriceMinimum        `json:"minimum,nullable"`
	MinimumAmount         string                                  `json:"minimum_amount,nullable"`
	JSON                  priceFivetranExamplePriceJSON
}

func (*PriceFivetranExamplePrice) UnmarshalJSON

func (r *PriceFivetranExamplePrice) UnmarshalJSON(data []byte) (err error)

type PriceFivetranExamplePriceBillableMetric

type PriceFivetranExamplePriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceFivetranExamplePriceBillableMetricJSON
}

func (*PriceFivetranExamplePriceBillableMetric) UnmarshalJSON

func (r *PriceFivetranExamplePriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceFivetranExamplePriceCadence

type PriceFivetranExamplePriceCadence string
const (
	PriceFivetranExamplePriceCadenceOneTime   PriceFivetranExamplePriceCadence = "one_time"
	PriceFivetranExamplePriceCadenceMonthly   PriceFivetranExamplePriceCadence = "monthly"
	PriceFivetranExamplePriceCadenceQuarterly PriceFivetranExamplePriceCadence = "quarterly"
	PriceFivetranExamplePriceCadenceAnnual    PriceFivetranExamplePriceCadence = "annual"
)

type PriceFivetranExamplePriceItem

type PriceFivetranExamplePriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceFivetranExamplePriceItemJSON
}

func (*PriceFivetranExamplePriceItem) UnmarshalJSON

func (r *PriceFivetranExamplePriceItem) UnmarshalJSON(data []byte) (err error)

type PriceFivetranExamplePriceMaximum

type PriceFivetranExamplePriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceFivetranExamplePriceMaximumJSON
}

func (*PriceFivetranExamplePriceMaximum) UnmarshalJSON

func (r *PriceFivetranExamplePriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceFivetranExamplePriceMinimum

type PriceFivetranExamplePriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceFivetranExamplePriceMinimumJSON
}

func (*PriceFivetranExamplePriceMinimum) UnmarshalJSON

func (r *PriceFivetranExamplePriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceFivetranExamplePriceModelType

type PriceFivetranExamplePriceModelType string
const (
	PriceFivetranExamplePriceModelTypeFivetranExample PriceFivetranExamplePriceModelType = "fivetran_example"
)

type PriceFivetranExamplePricePriceType

type PriceFivetranExamplePricePriceType string
const (
	PriceFivetranExamplePricePriceTypeUsagePrice PriceFivetranExamplePricePriceType = "usage_price"
	PriceFivetranExamplePricePriceTypeFixedPrice PriceFivetranExamplePricePriceType = "fixed_price"
)

type PriceListParams

type PriceListParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit param.Field[int64] `query:"limit"`
}

func (PriceListParams) URLQuery

func (r PriceListParams) URLQuery() (v url.Values)

URLQuery serializes PriceListParams's query parameters as `url.Values`.

type PriceMatrixPrice

type PriceMatrixPrice struct {
	ID                 string                         `json:"id,required"`
	BillableMetric     PriceMatrixPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence            PriceMatrixPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                      `json:"created_at,required" format:"date-time"`
	Currency           string                         `json:"currency,required"`
	ExternalPriceID    string                         `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                        `json:"fixed_price_quantity,required,nullable"`
	Item               PriceMatrixPriceItem           `json:"item,required"`
	MatrixConfig       PriceMatrixPriceMatrixConfig   `json:"matrix_config,required"`
	ModelType          PriceMatrixPriceModelType      `json:"model_type,required"`
	Name               string                         `json:"name,required"`
	PlanPhaseOrder     int64                          `json:"plan_phase_order,required,nullable"`
	PriceType          PriceMatrixPricePriceType      `json:"price_type,required"`
	Discount           InvoiceDiscount                `json:"discount,nullable"`
	Maximum            PriceMatrixPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                         `json:"maximum_amount,nullable"`
	Minimum            PriceMatrixPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                         `json:"minimum_amount,nullable"`
	JSON               priceMatrixPriceJSON
}

func (*PriceMatrixPrice) UnmarshalJSON

func (r *PriceMatrixPrice) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceBillableMetric

type PriceMatrixPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceMatrixPriceBillableMetricJSON
}

func (*PriceMatrixPriceBillableMetric) UnmarshalJSON

func (r *PriceMatrixPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceCadence

type PriceMatrixPriceCadence string
const (
	PriceMatrixPriceCadenceOneTime   PriceMatrixPriceCadence = "one_time"
	PriceMatrixPriceCadenceMonthly   PriceMatrixPriceCadence = "monthly"
	PriceMatrixPriceCadenceQuarterly PriceMatrixPriceCadence = "quarterly"
	PriceMatrixPriceCadenceAnnual    PriceMatrixPriceCadence = "annual"
)

type PriceMatrixPriceItem

type PriceMatrixPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceMatrixPriceItemJSON
}

func (*PriceMatrixPriceItem) UnmarshalJSON

func (r *PriceMatrixPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceMatrixConfig

type PriceMatrixPriceMatrixConfig struct {
	// Default per unit rate for any usage not bucketed into a specified matrix_value
	DefaultUnitAmount string `json:"default_unit_amount,required"`
	// One or two event property values to evaluate matrix groups by
	Dimensions []string `json:"dimensions,required"`
	// Matrix values for specified matrix grouping keys
	MatrixValues []PriceMatrixPriceMatrixConfigMatrixValue `json:"matrix_values,required"`
	// Default optional multiplier to scale rated quantities that fall into the default
	// bucket by
	ScalingFactor float64 `json:"scaling_factor,nullable"`
	JSON          priceMatrixPriceMatrixConfigJSON
}

func (*PriceMatrixPriceMatrixConfig) UnmarshalJSON

func (r *PriceMatrixPriceMatrixConfig) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceMatrixConfigMatrixValue

type PriceMatrixPriceMatrixConfigMatrixValue struct {
	// One or two matrix keys to filter usage to this Matrix value by. For example,
	// ["region", "tier"] could be used to filter cloud usage by a cloud region and an
	// instance tier.
	DimensionValues []string `json:"dimension_values,required"`
	// Unit price for the specified dimension_values
	UnitAmount string `json:"unit_amount,required"`
	// Optional multiplier to scale rated quantities by
	ScalingFactor float64 `json:"scaling_factor,nullable"`
	JSON          priceMatrixPriceMatrixConfigMatrixValueJSON
}

func (*PriceMatrixPriceMatrixConfigMatrixValue) UnmarshalJSON

func (r *PriceMatrixPriceMatrixConfigMatrixValue) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceMaximum

type PriceMatrixPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceMatrixPriceMaximumJSON
}

func (*PriceMatrixPriceMaximum) UnmarshalJSON

func (r *PriceMatrixPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceMinimum

type PriceMatrixPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceMatrixPriceMinimumJSON
}

func (*PriceMatrixPriceMinimum) UnmarshalJSON

func (r *PriceMatrixPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceMatrixPriceModelType

type PriceMatrixPriceModelType string
const (
	PriceMatrixPriceModelTypeMatrix PriceMatrixPriceModelType = "matrix"
)

type PriceMatrixPricePriceType

type PriceMatrixPricePriceType string
const (
	PriceMatrixPricePriceTypeUsagePrice PriceMatrixPricePriceType = "usage_price"
	PriceMatrixPricePriceTypeFixedPrice PriceMatrixPricePriceType = "fixed_price"
)

type PriceNewParamsNewBpsPrice

type PriceNewParamsNewBpsPrice struct {
	BpsConfig param.Field[PriceNewParamsNewBpsPriceBpsConfig] `json:"bps_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                             `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewBpsPrice) ImplementsPriceNewParams

func (PriceNewParamsNewBpsPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewBpsPrice) MarshalJSON

func (r PriceNewParamsNewBpsPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBpsPriceBpsConfig

type PriceNewParamsNewBpsPriceBpsConfig struct {
	// Basis point take rate per event
	Bps param.Field[float64] `json:"bps,required"`
	// Optional currency amount maximum to cap spend per event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (PriceNewParamsNewBpsPriceBpsConfig) MarshalJSON

func (r PriceNewParamsNewBpsPriceBpsConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBpsPriceCadence

type PriceNewParamsNewBpsPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewBpsPriceCadenceAnnual    PriceNewParamsNewBpsPriceCadence = "annual"
	PriceNewParamsNewBpsPriceCadenceMonthly   PriceNewParamsNewBpsPriceCadence = "monthly"
	PriceNewParamsNewBpsPriceCadenceQuarterly PriceNewParamsNewBpsPriceCadence = "quarterly"
)

type PriceNewParamsNewBpsPriceModelType

type PriceNewParamsNewBpsPriceModelType string
const (
	PriceNewParamsNewBpsPriceModelTypeBps PriceNewParamsNewBpsPriceModelType = "bps"
)

type PriceNewParamsNewBulkBpsPrice

type PriceNewParamsNewBulkBpsPrice struct {
	BulkBpsConfig param.Field[PriceNewParamsNewBulkBpsPriceBulkBpsConfig] `json:"bulk_bps_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewBulkBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                 `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewBulkBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewBulkBpsPrice) ImplementsPriceNewParams

func (PriceNewParamsNewBulkBpsPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewBulkBpsPrice) MarshalJSON

func (r PriceNewParamsNewBulkBpsPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkBpsPriceBulkBpsConfig

type PriceNewParamsNewBulkBpsPriceBulkBpsConfig struct {
	// Tiers for a bulk BPS pricing model where all usage is aggregated to a single
	// tier based on total volume
	Tiers param.Field[[]PriceNewParamsNewBulkBpsPriceBulkBpsConfigTier] `json:"tiers,required"`
}

func (PriceNewParamsNewBulkBpsPriceBulkBpsConfig) MarshalJSON

func (r PriceNewParamsNewBulkBpsPriceBulkBpsConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkBpsPriceBulkBpsConfigTier

type PriceNewParamsNewBulkBpsPriceBulkBpsConfigTier struct {
	// Basis points to rate on
	Bps param.Field[float64] `json:"bps,required"`
	// Upper bound for tier
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The maximum amount to charge for any one event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (PriceNewParamsNewBulkBpsPriceBulkBpsConfigTier) MarshalJSON

func (r PriceNewParamsNewBulkBpsPriceBulkBpsConfigTier) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkBpsPriceCadence

type PriceNewParamsNewBulkBpsPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewBulkBpsPriceCadenceAnnual    PriceNewParamsNewBulkBpsPriceCadence = "annual"
	PriceNewParamsNewBulkBpsPriceCadenceMonthly   PriceNewParamsNewBulkBpsPriceCadence = "monthly"
	PriceNewParamsNewBulkBpsPriceCadenceQuarterly PriceNewParamsNewBulkBpsPriceCadence = "quarterly"
)

type PriceNewParamsNewBulkBpsPriceModelType

type PriceNewParamsNewBulkBpsPriceModelType string
const (
	PriceNewParamsNewBulkBpsPriceModelTypeBulkBps PriceNewParamsNewBulkBpsPriceModelType = "bulk_bps"
)

type PriceNewParamsNewBulkPrice

type PriceNewParamsNewBulkPrice struct {
	BulkConfig param.Field[PriceNewParamsNewBulkPriceBulkConfig] `json:"bulk_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewBulkPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                              `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewBulkPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewBulkPrice) ImplementsPriceNewParams

func (PriceNewParamsNewBulkPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewBulkPrice) MarshalJSON

func (r PriceNewParamsNewBulkPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkPriceBulkConfig

type PriceNewParamsNewBulkPriceBulkConfig struct {
	// Bulk tiers for rating based on total usage volume
	Tiers param.Field[[]PriceNewParamsNewBulkPriceBulkConfigTier] `json:"tiers,required"`
}

func (PriceNewParamsNewBulkPriceBulkConfig) MarshalJSON

func (r PriceNewParamsNewBulkPriceBulkConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkPriceBulkConfigTier

type PriceNewParamsNewBulkPriceBulkConfigTier struct {
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Upper bound for this tier
	MaximumUnits param.Field[float64] `json:"maximum_units"`
}

func (PriceNewParamsNewBulkPriceBulkConfigTier) MarshalJSON

func (r PriceNewParamsNewBulkPriceBulkConfigTier) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewBulkPriceCadence

type PriceNewParamsNewBulkPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewBulkPriceCadenceAnnual    PriceNewParamsNewBulkPriceCadence = "annual"
	PriceNewParamsNewBulkPriceCadenceMonthly   PriceNewParamsNewBulkPriceCadence = "monthly"
	PriceNewParamsNewBulkPriceCadenceQuarterly PriceNewParamsNewBulkPriceCadence = "quarterly"
)

type PriceNewParamsNewBulkPriceModelType

type PriceNewParamsNewBulkPriceModelType string
const (
	PriceNewParamsNewBulkPriceModelTypeBulk PriceNewParamsNewBulkPriceModelType = "bulk"
)

type PriceNewParamsNewMatrixPrice

type PriceNewParamsNewMatrixPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewMatrixPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID       param.Field[string]                                   `json:"item_id,required"`
	MatrixConfig param.Field[PriceNewParamsNewMatrixPriceMatrixConfig] `json:"matrix_config,required"`
	ModelType    param.Field[PriceNewParamsNewMatrixPriceModelType]    `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewMatrixPrice) ImplementsPriceNewParams

func (PriceNewParamsNewMatrixPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewMatrixPrice) MarshalJSON

func (r PriceNewParamsNewMatrixPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewMatrixPriceCadence

type PriceNewParamsNewMatrixPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewMatrixPriceCadenceAnnual    PriceNewParamsNewMatrixPriceCadence = "annual"
	PriceNewParamsNewMatrixPriceCadenceMonthly   PriceNewParamsNewMatrixPriceCadence = "monthly"
	PriceNewParamsNewMatrixPriceCadenceQuarterly PriceNewParamsNewMatrixPriceCadence = "quarterly"
)

type PriceNewParamsNewMatrixPriceMatrixConfig

type PriceNewParamsNewMatrixPriceMatrixConfig struct {
	// Default per unit rate for any usage not bucketed into a specified matrix_value
	DefaultUnitAmount param.Field[string] `json:"default_unit_amount,required"`
	// One or two event property values to evaluate matrix groups by
	Dimensions param.Field[[]string] `json:"dimensions,required"`
	// Matrix values for specified matrix grouping keys
	MatrixValues param.Field[[]PriceNewParamsNewMatrixPriceMatrixConfigMatrixValue] `json:"matrix_values,required"`
	// Default optional multiplier to scale rated quantities that fall into the default
	// bucket by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (PriceNewParamsNewMatrixPriceMatrixConfig) MarshalJSON

func (r PriceNewParamsNewMatrixPriceMatrixConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewMatrixPriceMatrixConfigMatrixValue

type PriceNewParamsNewMatrixPriceMatrixConfigMatrixValue struct {
	// One or two matrix keys to filter usage to this Matrix value by. For example,
	// ["region", "tier"] could be used to filter cloud usage by a cloud region and an
	// instance tier.
	DimensionValues param.Field[[]string] `json:"dimension_values,required"`
	// Unit price for the specified dimension_values
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Optional multiplier to scale rated quantities by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (PriceNewParamsNewMatrixPriceMatrixConfigMatrixValue) MarshalJSON

func (r PriceNewParamsNewMatrixPriceMatrixConfigMatrixValue) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewMatrixPriceModelType

type PriceNewParamsNewMatrixPriceModelType string
const (
	PriceNewParamsNewMatrixPriceModelTypeMatrix PriceNewParamsNewMatrixPriceModelType = "matrix"
)

type PriceNewParamsNewPackagePrice

type PriceNewParamsNewPackagePrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewPackagePriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                 `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewPackagePriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name          param.Field[string]                                     `json:"name,required"`
	PackageConfig param.Field[PriceNewParamsNewPackagePricePackageConfig] `json:"package_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewPackagePrice) ImplementsPriceNewParams

func (PriceNewParamsNewPackagePrice) ImplementsPriceNewParams()

func (PriceNewParamsNewPackagePrice) MarshalJSON

func (r PriceNewParamsNewPackagePrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewPackagePriceCadence

type PriceNewParamsNewPackagePriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewPackagePriceCadenceAnnual    PriceNewParamsNewPackagePriceCadence = "annual"
	PriceNewParamsNewPackagePriceCadenceMonthly   PriceNewParamsNewPackagePriceCadence = "monthly"
	PriceNewParamsNewPackagePriceCadenceQuarterly PriceNewParamsNewPackagePriceCadence = "quarterly"
)

type PriceNewParamsNewPackagePriceModelType

type PriceNewParamsNewPackagePriceModelType string
const (
	PriceNewParamsNewPackagePriceModelTypePackage PriceNewParamsNewPackagePriceModelType = "package"
)

type PriceNewParamsNewPackagePricePackageConfig

type PriceNewParamsNewPackagePricePackageConfig struct {
	// A currency amount to rate usage by
	PackageAmount param.Field[string] `json:"package_amount,required"`
	// An integer amount to represent package size. For example, 1000 here would divide
	// usage by 1000 before multiplying by package_amount in rating
	PackageSize param.Field[int64] `json:"package_size"`
}

func (PriceNewParamsNewPackagePricePackageConfig) MarshalJSON

func (r PriceNewParamsNewPackagePricePackageConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewPackageWithAllocationPrice

type PriceNewParamsNewPackageWithAllocationPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewPackageWithAllocationPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                               `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewPackageWithAllocationPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                        param.Field[string]                 `json:"name,required"`
	PackageWithAllocationConfig param.Field[map[string]interface{}] `json:"package_with_allocation_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewPackageWithAllocationPrice) ImplementsPriceNewParams

func (PriceNewParamsNewPackageWithAllocationPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewPackageWithAllocationPrice) MarshalJSON

func (r PriceNewParamsNewPackageWithAllocationPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewPackageWithAllocationPriceCadence

type PriceNewParamsNewPackageWithAllocationPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewPackageWithAllocationPriceCadenceAnnual    PriceNewParamsNewPackageWithAllocationPriceCadence = "annual"
	PriceNewParamsNewPackageWithAllocationPriceCadenceMonthly   PriceNewParamsNewPackageWithAllocationPriceCadence = "monthly"
	PriceNewParamsNewPackageWithAllocationPriceCadenceQuarterly PriceNewParamsNewPackageWithAllocationPriceCadence = "quarterly"
)

type PriceNewParamsNewPackageWithAllocationPriceModelType

type PriceNewParamsNewPackageWithAllocationPriceModelType string
const (
	PriceNewParamsNewPackageWithAllocationPriceModelTypePackageWithAllocation PriceNewParamsNewPackageWithAllocationPriceModelType = "package_with_allocation"
)

type PriceNewParamsNewThresholdTotalAmountPrice

type PriceNewParamsNewThresholdTotalAmountPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewThresholdTotalAmountPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                              `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewThresholdTotalAmountPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                       param.Field[string]                 `json:"name,required"`
	ThresholdTotalAmountConfig param.Field[map[string]interface{}] `json:"threshold_total_amount_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewThresholdTotalAmountPrice) ImplementsPriceNewParams

func (PriceNewParamsNewThresholdTotalAmountPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewThresholdTotalAmountPrice) MarshalJSON

func (r PriceNewParamsNewThresholdTotalAmountPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewThresholdTotalAmountPriceCadence

type PriceNewParamsNewThresholdTotalAmountPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewThresholdTotalAmountPriceCadenceAnnual    PriceNewParamsNewThresholdTotalAmountPriceCadence = "annual"
	PriceNewParamsNewThresholdTotalAmountPriceCadenceMonthly   PriceNewParamsNewThresholdTotalAmountPriceCadence = "monthly"
	PriceNewParamsNewThresholdTotalAmountPriceCadenceQuarterly PriceNewParamsNewThresholdTotalAmountPriceCadence = "quarterly"
)

type PriceNewParamsNewThresholdTotalAmountPriceModelType

type PriceNewParamsNewThresholdTotalAmountPriceModelType string
const (
	PriceNewParamsNewThresholdTotalAmountPriceModelTypeThresholdTotalAmount PriceNewParamsNewThresholdTotalAmountPriceModelType = "threshold_total_amount"
)

type PriceNewParamsNewTieredBpsPrice

type PriceNewParamsNewTieredBpsPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewTieredBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                   `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewTieredBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name            param.Field[string]                                         `json:"name,required"`
	TieredBpsConfig param.Field[PriceNewParamsNewTieredBpsPriceTieredBpsConfig] `json:"tiered_bps_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewTieredBpsPrice) ImplementsPriceNewParams

func (PriceNewParamsNewTieredBpsPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewTieredBpsPrice) MarshalJSON

func (r PriceNewParamsNewTieredBpsPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredBpsPriceCadence

type PriceNewParamsNewTieredBpsPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewTieredBpsPriceCadenceAnnual    PriceNewParamsNewTieredBpsPriceCadence = "annual"
	PriceNewParamsNewTieredBpsPriceCadenceMonthly   PriceNewParamsNewTieredBpsPriceCadence = "monthly"
	PriceNewParamsNewTieredBpsPriceCadenceQuarterly PriceNewParamsNewTieredBpsPriceCadence = "quarterly"
)

type PriceNewParamsNewTieredBpsPriceModelType

type PriceNewParamsNewTieredBpsPriceModelType string
const (
	PriceNewParamsNewTieredBpsPriceModelTypeTieredBps PriceNewParamsNewTieredBpsPriceModelType = "tiered_bps"
)

type PriceNewParamsNewTieredBpsPriceTieredBpsConfig

type PriceNewParamsNewTieredBpsPriceTieredBpsConfig struct {
	// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified
	// tiers
	Tiers param.Field[[]PriceNewParamsNewTieredBpsPriceTieredBpsConfigTier] `json:"tiers,required"`
}

func (PriceNewParamsNewTieredBpsPriceTieredBpsConfig) MarshalJSON

func (r PriceNewParamsNewTieredBpsPriceTieredBpsConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredBpsPriceTieredBpsConfigTier

type PriceNewParamsNewTieredBpsPriceTieredBpsConfigTier struct {
	// Per-event basis point rate
	Bps param.Field[float64] `json:"bps,required"`
	// Inclusive tier starting value
	MinimumAmount param.Field[string] `json:"minimum_amount,required"`
	// Exclusive tier ending value
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// Per unit maximum to charge
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (PriceNewParamsNewTieredBpsPriceTieredBpsConfigTier) MarshalJSON

func (r PriceNewParamsNewTieredBpsPriceTieredBpsConfigTier) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredPackagePrice

type PriceNewParamsNewTieredPackagePrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewTieredPackagePriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                       `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewTieredPackagePriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                param.Field[string]                 `json:"name,required"`
	TieredPackageConfig param.Field[map[string]interface{}] `json:"tiered_package_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewTieredPackagePrice) ImplementsPriceNewParams

func (PriceNewParamsNewTieredPackagePrice) ImplementsPriceNewParams()

func (PriceNewParamsNewTieredPackagePrice) MarshalJSON

func (r PriceNewParamsNewTieredPackagePrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredPackagePriceCadence

type PriceNewParamsNewTieredPackagePriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewTieredPackagePriceCadenceAnnual    PriceNewParamsNewTieredPackagePriceCadence = "annual"
	PriceNewParamsNewTieredPackagePriceCadenceMonthly   PriceNewParamsNewTieredPackagePriceCadence = "monthly"
	PriceNewParamsNewTieredPackagePriceCadenceQuarterly PriceNewParamsNewTieredPackagePriceCadence = "quarterly"
)

type PriceNewParamsNewTieredPackagePriceModelType

type PriceNewParamsNewTieredPackagePriceModelType string
const (
	PriceNewParamsNewTieredPackagePriceModelTypeTieredPackage PriceNewParamsNewTieredPackagePriceModelType = "tiered_package"
)

type PriceNewParamsNewTieredPrice

type PriceNewParamsNewTieredPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewTieredPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewTieredPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name         param.Field[string]                                   `json:"name,required"`
	TieredConfig param.Field[PriceNewParamsNewTieredPriceTieredConfig] `json:"tiered_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewTieredPrice) ImplementsPriceNewParams

func (PriceNewParamsNewTieredPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewTieredPrice) MarshalJSON

func (r PriceNewParamsNewTieredPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredPriceCadence

type PriceNewParamsNewTieredPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewTieredPriceCadenceAnnual    PriceNewParamsNewTieredPriceCadence = "annual"
	PriceNewParamsNewTieredPriceCadenceMonthly   PriceNewParamsNewTieredPriceCadence = "monthly"
	PriceNewParamsNewTieredPriceCadenceQuarterly PriceNewParamsNewTieredPriceCadence = "quarterly"
)

type PriceNewParamsNewTieredPriceModelType

type PriceNewParamsNewTieredPriceModelType string
const (
	PriceNewParamsNewTieredPriceModelTypeTiered PriceNewParamsNewTieredPriceModelType = "tiered"
)

type PriceNewParamsNewTieredPriceTieredConfig

type PriceNewParamsNewTieredPriceTieredConfig struct {
	// Tiers for rating based on total usage quantities into the specified tier
	Tiers param.Field[[]PriceNewParamsNewTieredPriceTieredConfigTier] `json:"tiers,required"`
}

func (PriceNewParamsNewTieredPriceTieredConfig) MarshalJSON

func (r PriceNewParamsNewTieredPriceTieredConfig) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredPriceTieredConfigTier

type PriceNewParamsNewTieredPriceTieredConfigTier struct {
	// Inclusive tier starting value
	FirstUnit param.Field[float64] `json:"first_unit,required"`
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Exclusive tier ending value. If null, this is treated as the last tier
	LastUnit param.Field[float64] `json:"last_unit"`
}

func (PriceNewParamsNewTieredPriceTieredConfigTier) MarshalJSON

func (r PriceNewParamsNewTieredPriceTieredConfigTier) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredWithMinimumPrice

type PriceNewParamsNewTieredWithMinimumPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewTieredWithMinimumPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                           `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewTieredWithMinimumPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                    param.Field[string]                 `json:"name,required"`
	TieredWithMinimumConfig param.Field[map[string]interface{}] `json:"tiered_with_minimum_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewTieredWithMinimumPrice) ImplementsPriceNewParams

func (PriceNewParamsNewTieredWithMinimumPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewTieredWithMinimumPrice) MarshalJSON

func (r PriceNewParamsNewTieredWithMinimumPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewTieredWithMinimumPriceCadence

type PriceNewParamsNewTieredWithMinimumPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewTieredWithMinimumPriceCadenceAnnual    PriceNewParamsNewTieredWithMinimumPriceCadence = "annual"
	PriceNewParamsNewTieredWithMinimumPriceCadenceMonthly   PriceNewParamsNewTieredWithMinimumPriceCadence = "monthly"
	PriceNewParamsNewTieredWithMinimumPriceCadenceQuarterly PriceNewParamsNewTieredWithMinimumPriceCadence = "quarterly"
)

type PriceNewParamsNewTieredWithMinimumPriceModelType

type PriceNewParamsNewTieredWithMinimumPriceModelType string
const (
	PriceNewParamsNewTieredWithMinimumPriceModelTypeTieredWithMinimum PriceNewParamsNewTieredWithMinimumPriceModelType = "tiered_with_minimum"
)

type PriceNewParamsNewUnitPrice

type PriceNewParamsNewUnitPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[PriceNewParamsNewUnitPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                              `json:"item_id,required"`
	ModelType param.Field[PriceNewParamsNewUnitPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name       param.Field[string]                               `json:"name,required"`
	UnitConfig param.Field[PriceNewParamsNewUnitPriceUnitConfig] `json:"unit_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (PriceNewParamsNewUnitPrice) ImplementsPriceNewParams

func (PriceNewParamsNewUnitPrice) ImplementsPriceNewParams()

func (PriceNewParamsNewUnitPrice) MarshalJSON

func (r PriceNewParamsNewUnitPrice) MarshalJSON() (data []byte, err error)

type PriceNewParamsNewUnitPriceCadence

type PriceNewParamsNewUnitPriceCadence string

The cadence to bill for this price on.

const (
	PriceNewParamsNewUnitPriceCadenceAnnual    PriceNewParamsNewUnitPriceCadence = "annual"
	PriceNewParamsNewUnitPriceCadenceMonthly   PriceNewParamsNewUnitPriceCadence = "monthly"
	PriceNewParamsNewUnitPriceCadenceQuarterly PriceNewParamsNewUnitPriceCadence = "quarterly"
)

type PriceNewParamsNewUnitPriceModelType

type PriceNewParamsNewUnitPriceModelType string
const (
	PriceNewParamsNewUnitPriceModelTypeUnit PriceNewParamsNewUnitPriceModelType = "unit"
)

type PriceNewParamsNewUnitPriceUnitConfig

type PriceNewParamsNewUnitPriceUnitConfig struct {
	// Rate per unit of usage
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (PriceNewParamsNewUnitPriceUnitConfig) MarshalJSON

func (r PriceNewParamsNewUnitPriceUnitConfig) MarshalJSON() (data []byte, err error)

type PricePackagePrice

type PricePackagePrice struct {
	ID                 string                          `json:"id,required"`
	BillableMetric     PricePackagePriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence            PricePackagePriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                       `json:"created_at,required" format:"date-time"`
	Currency           string                          `json:"currency,required"`
	ExternalPriceID    string                          `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                         `json:"fixed_price_quantity,required,nullable"`
	Item               PricePackagePriceItem           `json:"item,required"`
	ModelType          PricePackagePriceModelType      `json:"model_type,required"`
	Name               string                          `json:"name,required"`
	PackageConfig      PricePackagePricePackageConfig  `json:"package_config,required"`
	PlanPhaseOrder     int64                           `json:"plan_phase_order,required,nullable"`
	PriceType          PricePackagePricePriceType      `json:"price_type,required"`
	Discount           InvoiceDiscount                 `json:"discount,nullable"`
	Maximum            PricePackagePriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                          `json:"maximum_amount,nullable"`
	Minimum            PricePackagePriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                          `json:"minimum_amount,nullable"`
	JSON               pricePackagePriceJSON
}

func (*PricePackagePrice) UnmarshalJSON

func (r *PricePackagePrice) UnmarshalJSON(data []byte) (err error)

type PricePackagePriceBillableMetric

type PricePackagePriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON pricePackagePriceBillableMetricJSON
}

func (*PricePackagePriceBillableMetric) UnmarshalJSON

func (r *PricePackagePriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PricePackagePriceCadence

type PricePackagePriceCadence string
const (
	PricePackagePriceCadenceOneTime   PricePackagePriceCadence = "one_time"
	PricePackagePriceCadenceMonthly   PricePackagePriceCadence = "monthly"
	PricePackagePriceCadenceQuarterly PricePackagePriceCadence = "quarterly"
	PricePackagePriceCadenceAnnual    PricePackagePriceCadence = "annual"
)

type PricePackagePriceItem

type PricePackagePriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON pricePackagePriceItemJSON
}

func (*PricePackagePriceItem) UnmarshalJSON

func (r *PricePackagePriceItem) UnmarshalJSON(data []byte) (err error)

type PricePackagePriceMaximum

type PricePackagePriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          pricePackagePriceMaximumJSON
}

func (*PricePackagePriceMaximum) UnmarshalJSON

func (r *PricePackagePriceMaximum) UnmarshalJSON(data []byte) (err error)

type PricePackagePriceMinimum

type PricePackagePriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          pricePackagePriceMinimumJSON
}

func (*PricePackagePriceMinimum) UnmarshalJSON

func (r *PricePackagePriceMinimum) UnmarshalJSON(data []byte) (err error)

type PricePackagePriceModelType

type PricePackagePriceModelType string
const (
	PricePackagePriceModelTypePackage PricePackagePriceModelType = "package"
)

type PricePackagePricePackageConfig

type PricePackagePricePackageConfig struct {
	// A currency amount to rate usage by
	PackageAmount string `json:"package_amount,required"`
	// An integer amount to represent package size. For example, 1000 here would divide
	// usage by 1000 before multiplying by package_amount in rating
	PackageSize int64 `json:"package_size,nullable"`
	JSON        pricePackagePricePackageConfigJSON
}

func (*PricePackagePricePackageConfig) UnmarshalJSON

func (r *PricePackagePricePackageConfig) UnmarshalJSON(data []byte) (err error)

type PricePackagePricePriceType

type PricePackagePricePriceType string
const (
	PricePackagePricePriceTypeUsagePrice PricePackagePricePriceType = "usage_price"
	PricePackagePricePriceTypeFixedPrice PricePackagePricePriceType = "fixed_price"
)

type PricePackageWithAllocationPrice

type PricePackageWithAllocationPrice struct {
	ID                          string                                        `json:"id,required"`
	BillableMetric              PricePackageWithAllocationPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence                     PricePackageWithAllocationPriceCadence        `json:"cadence,required"`
	CreatedAt                   time.Time                                     `json:"created_at,required" format:"date-time"`
	Currency                    string                                        `json:"currency,required"`
	ExternalPriceID             string                                        `json:"external_price_id,required,nullable"`
	FixedPriceQuantity          float64                                       `json:"fixed_price_quantity,required,nullable"`
	Item                        PricePackageWithAllocationPriceItem           `json:"item,required"`
	ModelType                   PricePackageWithAllocationPriceModelType      `json:"model_type,required"`
	Name                        string                                        `json:"name,required"`
	PackageWithAllocationConfig map[string]interface{}                        `json:"package_with_allocation_config,required"`
	PlanPhaseOrder              int64                                         `json:"plan_phase_order,required,nullable"`
	PriceType                   PricePackageWithAllocationPricePriceType      `json:"price_type,required"`
	Discount                    InvoiceDiscount                               `json:"discount,nullable"`
	Maximum                     PricePackageWithAllocationPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount               string                                        `json:"maximum_amount,nullable"`
	Minimum                     PricePackageWithAllocationPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount               string                                        `json:"minimum_amount,nullable"`
	JSON                        pricePackageWithAllocationPriceJSON
}

func (*PricePackageWithAllocationPrice) UnmarshalJSON

func (r *PricePackageWithAllocationPrice) UnmarshalJSON(data []byte) (err error)

type PricePackageWithAllocationPriceBillableMetric

type PricePackageWithAllocationPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON pricePackageWithAllocationPriceBillableMetricJSON
}

func (*PricePackageWithAllocationPriceBillableMetric) UnmarshalJSON

func (r *PricePackageWithAllocationPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PricePackageWithAllocationPriceCadence

type PricePackageWithAllocationPriceCadence string
const (
	PricePackageWithAllocationPriceCadenceOneTime   PricePackageWithAllocationPriceCadence = "one_time"
	PricePackageWithAllocationPriceCadenceMonthly   PricePackageWithAllocationPriceCadence = "monthly"
	PricePackageWithAllocationPriceCadenceQuarterly PricePackageWithAllocationPriceCadence = "quarterly"
	PricePackageWithAllocationPriceCadenceAnnual    PricePackageWithAllocationPriceCadence = "annual"
)

type PricePackageWithAllocationPriceItem

type PricePackageWithAllocationPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON pricePackageWithAllocationPriceItemJSON
}

func (*PricePackageWithAllocationPriceItem) UnmarshalJSON

func (r *PricePackageWithAllocationPriceItem) UnmarshalJSON(data []byte) (err error)

type PricePackageWithAllocationPriceMaximum

type PricePackageWithAllocationPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          pricePackageWithAllocationPriceMaximumJSON
}

func (*PricePackageWithAllocationPriceMaximum) UnmarshalJSON

func (r *PricePackageWithAllocationPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PricePackageWithAllocationPriceMinimum

type PricePackageWithAllocationPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          pricePackageWithAllocationPriceMinimumJSON
}

func (*PricePackageWithAllocationPriceMinimum) UnmarshalJSON

func (r *PricePackageWithAllocationPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PricePackageWithAllocationPriceModelType

type PricePackageWithAllocationPriceModelType string
const (
	PricePackageWithAllocationPriceModelTypePackageWithAllocation PricePackageWithAllocationPriceModelType = "package_with_allocation"
)

type PricePackageWithAllocationPricePriceType

type PricePackageWithAllocationPricePriceType string
const (
	PricePackageWithAllocationPricePriceTypeUsagePrice PricePackageWithAllocationPricePriceType = "usage_price"
	PricePackageWithAllocationPricePriceTypeFixedPrice PricePackageWithAllocationPricePriceType = "fixed_price"
)

type PriceService

type PriceService struct {
	Options         []option.RequestOption
	ExternalPriceID *PriceExternalPriceIDService
}

PriceService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPriceService method instead.

func NewPriceService

func NewPriceService(opts ...option.RequestOption) (r *PriceService)

NewPriceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PriceService) Fetch

func (r *PriceService) Fetch(ctx context.Context, priceID string, opts ...option.RequestOption) (res *Price, err error)

This endpoint returns a price given an identifier.

func (*PriceService) List

func (r *PriceService) List(ctx context.Context, query PriceListParams, opts ...option.RequestOption) (res *shared.Page[Price], err error)

This endpoint is used to list all add-on prices created using the [price creation endpoint](../reference/create-price).

func (*PriceService) ListAutoPaging

func (r *PriceService) ListAutoPaging(ctx context.Context, query PriceListParams, opts ...option.RequestOption) *shared.PageAutoPager[Price]

This endpoint is used to list all add-on prices created using the [price creation endpoint](../reference/create-price).

func (*PriceService) New

func (r *PriceService) New(ctx context.Context, body PriceNewParams, opts ...option.RequestOption) (res *Price, err error)

This endpoint is used to create a [price](../reference/price). A price created using this endpoint is always an add-on, meaning that it’s not associated with a specific plan and can instead be individually added to subscriptions, including subscriptions on different plans.

An `external_price_id` can be optionally specified as an alias to allow ergonomic interaction with prices in the Orb API.

See the [Price resource](../reference/price) for the specification of different price model configurations possible in this endpoint.

type PriceTestRatingFunctionPrice

type PriceTestRatingFunctionPrice struct {
	ID                       string                                     `json:"id,required"`
	BillableMetric           PriceTestRatingFunctionPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence                  PriceTestRatingFunctionPriceCadence        `json:"cadence,required"`
	CreatedAt                time.Time                                  `json:"created_at,required" format:"date-time"`
	Currency                 string                                     `json:"currency,required"`
	ExternalPriceID          string                                     `json:"external_price_id,required,nullable"`
	FixedPriceQuantity       float64                                    `json:"fixed_price_quantity,required,nullable"`
	Item                     PriceTestRatingFunctionPriceItem           `json:"item,required"`
	ModelType                PriceTestRatingFunctionPriceModelType      `json:"model_type,required"`
	Name                     string                                     `json:"name,required"`
	PlanPhaseOrder           int64                                      `json:"plan_phase_order,required,nullable"`
	PriceType                PriceTestRatingFunctionPricePriceType      `json:"price_type,required"`
	TestRatingFunctionConfig map[string]interface{}                     `json:"test_rating_function_config,required"`
	Discount                 InvoiceDiscount                            `json:"discount,nullable"`
	Maximum                  PriceTestRatingFunctionPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount            string                                     `json:"maximum_amount,nullable"`
	Minimum                  PriceTestRatingFunctionPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount            string                                     `json:"minimum_amount,nullable"`
	JSON                     priceTestRatingFunctionPriceJSON
}

func (*PriceTestRatingFunctionPrice) UnmarshalJSON

func (r *PriceTestRatingFunctionPrice) UnmarshalJSON(data []byte) (err error)

type PriceTestRatingFunctionPriceBillableMetric

type PriceTestRatingFunctionPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceTestRatingFunctionPriceBillableMetricJSON
}

func (*PriceTestRatingFunctionPriceBillableMetric) UnmarshalJSON

func (r *PriceTestRatingFunctionPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceTestRatingFunctionPriceCadence

type PriceTestRatingFunctionPriceCadence string
const (
	PriceTestRatingFunctionPriceCadenceOneTime   PriceTestRatingFunctionPriceCadence = "one_time"
	PriceTestRatingFunctionPriceCadenceMonthly   PriceTestRatingFunctionPriceCadence = "monthly"
	PriceTestRatingFunctionPriceCadenceQuarterly PriceTestRatingFunctionPriceCadence = "quarterly"
	PriceTestRatingFunctionPriceCadenceAnnual    PriceTestRatingFunctionPriceCadence = "annual"
)

type PriceTestRatingFunctionPriceItem

type PriceTestRatingFunctionPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceTestRatingFunctionPriceItemJSON
}

func (*PriceTestRatingFunctionPriceItem) UnmarshalJSON

func (r *PriceTestRatingFunctionPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceTestRatingFunctionPriceMaximum

type PriceTestRatingFunctionPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceTestRatingFunctionPriceMaximumJSON
}

func (*PriceTestRatingFunctionPriceMaximum) UnmarshalJSON

func (r *PriceTestRatingFunctionPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceTestRatingFunctionPriceMinimum

type PriceTestRatingFunctionPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceTestRatingFunctionPriceMinimumJSON
}

func (*PriceTestRatingFunctionPriceMinimum) UnmarshalJSON

func (r *PriceTestRatingFunctionPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceTestRatingFunctionPriceModelType

type PriceTestRatingFunctionPriceModelType string
const (
	PriceTestRatingFunctionPriceModelTypeTestRatingFunction PriceTestRatingFunctionPriceModelType = "test_rating_function"
)

type PriceTestRatingFunctionPricePriceType

type PriceTestRatingFunctionPricePriceType string
const (
	PriceTestRatingFunctionPricePriceTypeUsagePrice PriceTestRatingFunctionPricePriceType = "usage_price"
	PriceTestRatingFunctionPricePriceTypeFixedPrice PriceTestRatingFunctionPricePriceType = "fixed_price"
)

type PriceThresholdTotalAmountPrice

type PriceThresholdTotalAmountPrice struct {
	ID                         string                                       `json:"id,required"`
	BillableMetric             PriceThresholdTotalAmountPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence                    PriceThresholdTotalAmountPriceCadence        `json:"cadence,required"`
	CreatedAt                  time.Time                                    `json:"created_at,required" format:"date-time"`
	Currency                   string                                       `json:"currency,required"`
	ExternalPriceID            string                                       `json:"external_price_id,required,nullable"`
	FixedPriceQuantity         float64                                      `json:"fixed_price_quantity,required,nullable"`
	Item                       PriceThresholdTotalAmountPriceItem           `json:"item,required"`
	ModelType                  PriceThresholdTotalAmountPriceModelType      `json:"model_type,required"`
	Name                       string                                       `json:"name,required"`
	PlanPhaseOrder             int64                                        `json:"plan_phase_order,required,nullable"`
	PriceType                  PriceThresholdTotalAmountPricePriceType      `json:"price_type,required"`
	ThresholdTotalAmountConfig map[string]interface{}                       `json:"threshold_total_amount_config,required"`
	Discount                   InvoiceDiscount                              `json:"discount,nullable"`
	Maximum                    PriceThresholdTotalAmountPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount              string                                       `json:"maximum_amount,nullable"`
	Minimum                    PriceThresholdTotalAmountPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount              string                                       `json:"minimum_amount,nullable"`
	JSON                       priceThresholdTotalAmountPriceJSON
}

func (*PriceThresholdTotalAmountPrice) UnmarshalJSON

func (r *PriceThresholdTotalAmountPrice) UnmarshalJSON(data []byte) (err error)

type PriceThresholdTotalAmountPriceBillableMetric

type PriceThresholdTotalAmountPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceThresholdTotalAmountPriceBillableMetricJSON
}

func (*PriceThresholdTotalAmountPriceBillableMetric) UnmarshalJSON

func (r *PriceThresholdTotalAmountPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceThresholdTotalAmountPriceCadence

type PriceThresholdTotalAmountPriceCadence string
const (
	PriceThresholdTotalAmountPriceCadenceOneTime   PriceThresholdTotalAmountPriceCadence = "one_time"
	PriceThresholdTotalAmountPriceCadenceMonthly   PriceThresholdTotalAmountPriceCadence = "monthly"
	PriceThresholdTotalAmountPriceCadenceQuarterly PriceThresholdTotalAmountPriceCadence = "quarterly"
	PriceThresholdTotalAmountPriceCadenceAnnual    PriceThresholdTotalAmountPriceCadence = "annual"
)

type PriceThresholdTotalAmountPriceItem

type PriceThresholdTotalAmountPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceThresholdTotalAmountPriceItemJSON
}

func (*PriceThresholdTotalAmountPriceItem) UnmarshalJSON

func (r *PriceThresholdTotalAmountPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceThresholdTotalAmountPriceMaximum

type PriceThresholdTotalAmountPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceThresholdTotalAmountPriceMaximumJSON
}

func (*PriceThresholdTotalAmountPriceMaximum) UnmarshalJSON

func (r *PriceThresholdTotalAmountPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceThresholdTotalAmountPriceMinimum

type PriceThresholdTotalAmountPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceThresholdTotalAmountPriceMinimumJSON
}

func (*PriceThresholdTotalAmountPriceMinimum) UnmarshalJSON

func (r *PriceThresholdTotalAmountPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceThresholdTotalAmountPriceModelType

type PriceThresholdTotalAmountPriceModelType string
const (
	PriceThresholdTotalAmountPriceModelTypeThresholdTotalAmount PriceThresholdTotalAmountPriceModelType = "threshold_total_amount"
)

type PriceThresholdTotalAmountPricePriceType

type PriceThresholdTotalAmountPricePriceType string
const (
	PriceThresholdTotalAmountPricePriceTypeUsagePrice PriceThresholdTotalAmountPricePriceType = "usage_price"
	PriceThresholdTotalAmountPricePriceTypeFixedPrice PriceThresholdTotalAmountPricePriceType = "fixed_price"
)

type PriceTieredBpsPrice

type PriceTieredBpsPrice struct {
	ID                 string                             `json:"id,required"`
	BillableMetric     PriceTieredBpsPriceBillableMetric  `json:"billable_metric,required,nullable"`
	Cadence            PriceTieredBpsPriceCadence         `json:"cadence,required"`
	CreatedAt          time.Time                          `json:"created_at,required" format:"date-time"`
	Currency           string                             `json:"currency,required"`
	ExternalPriceID    string                             `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                            `json:"fixed_price_quantity,required,nullable"`
	Item               PriceTieredBpsPriceItem            `json:"item,required"`
	ModelType          PriceTieredBpsPriceModelType       `json:"model_type,required"`
	Name               string                             `json:"name,required"`
	PlanPhaseOrder     int64                              `json:"plan_phase_order,required,nullable"`
	PriceType          PriceTieredBpsPricePriceType       `json:"price_type,required"`
	TieredBpsConfig    PriceTieredBpsPriceTieredBpsConfig `json:"tiered_bps_config,required"`
	Discount           InvoiceDiscount                    `json:"discount,nullable"`
	Maximum            PriceTieredBpsPriceMaximum         `json:"maximum,nullable"`
	MaximumAmount      string                             `json:"maximum_amount,nullable"`
	Minimum            PriceTieredBpsPriceMinimum         `json:"minimum,nullable"`
	MinimumAmount      string                             `json:"minimum_amount,nullable"`
	JSON               priceTieredBpsPriceJSON
}

func (*PriceTieredBpsPrice) UnmarshalJSON

func (r *PriceTieredBpsPrice) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceBillableMetric

type PriceTieredBpsPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceTieredBpsPriceBillableMetricJSON
}

func (*PriceTieredBpsPriceBillableMetric) UnmarshalJSON

func (r *PriceTieredBpsPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceCadence

type PriceTieredBpsPriceCadence string
const (
	PriceTieredBpsPriceCadenceOneTime   PriceTieredBpsPriceCadence = "one_time"
	PriceTieredBpsPriceCadenceMonthly   PriceTieredBpsPriceCadence = "monthly"
	PriceTieredBpsPriceCadenceQuarterly PriceTieredBpsPriceCadence = "quarterly"
	PriceTieredBpsPriceCadenceAnnual    PriceTieredBpsPriceCadence = "annual"
)

type PriceTieredBpsPriceItem

type PriceTieredBpsPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceTieredBpsPriceItemJSON
}

func (*PriceTieredBpsPriceItem) UnmarshalJSON

func (r *PriceTieredBpsPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceMaximum

type PriceTieredBpsPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceTieredBpsPriceMaximumJSON
}

func (*PriceTieredBpsPriceMaximum) UnmarshalJSON

func (r *PriceTieredBpsPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceMinimum

type PriceTieredBpsPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceTieredBpsPriceMinimumJSON
}

func (*PriceTieredBpsPriceMinimum) UnmarshalJSON

func (r *PriceTieredBpsPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceModelType

type PriceTieredBpsPriceModelType string
const (
	PriceTieredBpsPriceModelTypeTieredBps PriceTieredBpsPriceModelType = "tiered_bps"
)

type PriceTieredBpsPricePriceType

type PriceTieredBpsPricePriceType string
const (
	PriceTieredBpsPricePriceTypeUsagePrice PriceTieredBpsPricePriceType = "usage_price"
	PriceTieredBpsPricePriceTypeFixedPrice PriceTieredBpsPricePriceType = "fixed_price"
)

type PriceTieredBpsPriceTieredBpsConfig

type PriceTieredBpsPriceTieredBpsConfig struct {
	// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified
	// tiers
	Tiers []PriceTieredBpsPriceTieredBpsConfigTier `json:"tiers,required"`
	JSON  priceTieredBpsPriceTieredBpsConfigJSON
}

func (*PriceTieredBpsPriceTieredBpsConfig) UnmarshalJSON

func (r *PriceTieredBpsPriceTieredBpsConfig) UnmarshalJSON(data []byte) (err error)

type PriceTieredBpsPriceTieredBpsConfigTier

type PriceTieredBpsPriceTieredBpsConfigTier struct {
	// Per-event basis point rate
	Bps float64 `json:"bps,required"`
	// Inclusive tier starting value
	MinimumAmount string `json:"minimum_amount,required"`
	// Exclusive tier ending value
	MaximumAmount string `json:"maximum_amount,nullable"`
	// Per unit maximum to charge
	PerUnitMaximum string `json:"per_unit_maximum,nullable"`
	JSON           priceTieredBpsPriceTieredBpsConfigTierJSON
}

func (*PriceTieredBpsPriceTieredBpsConfigTier) UnmarshalJSON

func (r *PriceTieredBpsPriceTieredBpsConfigTier) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePrice

type PriceTieredPackagePrice struct {
	ID                  string                                `json:"id,required"`
	BillableMetric      PriceTieredPackagePriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence             PriceTieredPackagePriceCadence        `json:"cadence,required"`
	CreatedAt           time.Time                             `json:"created_at,required" format:"date-time"`
	Currency            string                                `json:"currency,required"`
	ExternalPriceID     string                                `json:"external_price_id,required,nullable"`
	FixedPriceQuantity  float64                               `json:"fixed_price_quantity,required,nullable"`
	Item                PriceTieredPackagePriceItem           `json:"item,required"`
	ModelType           PriceTieredPackagePriceModelType      `json:"model_type,required"`
	Name                string                                `json:"name,required"`
	PlanPhaseOrder      int64                                 `json:"plan_phase_order,required,nullable"`
	PriceType           PriceTieredPackagePricePriceType      `json:"price_type,required"`
	TieredPackageConfig map[string]interface{}                `json:"tiered_package_config,required"`
	Discount            InvoiceDiscount                       `json:"discount,nullable"`
	Maximum             PriceTieredPackagePriceMaximum        `json:"maximum,nullable"`
	MaximumAmount       string                                `json:"maximum_amount,nullable"`
	Minimum             PriceTieredPackagePriceMinimum        `json:"minimum,nullable"`
	MinimumAmount       string                                `json:"minimum_amount,nullable"`
	JSON                priceTieredPackagePriceJSON
}

func (*PriceTieredPackagePrice) UnmarshalJSON

func (r *PriceTieredPackagePrice) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePriceBillableMetric

type PriceTieredPackagePriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceTieredPackagePriceBillableMetricJSON
}

func (*PriceTieredPackagePriceBillableMetric) UnmarshalJSON

func (r *PriceTieredPackagePriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePriceCadence

type PriceTieredPackagePriceCadence string
const (
	PriceTieredPackagePriceCadenceOneTime   PriceTieredPackagePriceCadence = "one_time"
	PriceTieredPackagePriceCadenceMonthly   PriceTieredPackagePriceCadence = "monthly"
	PriceTieredPackagePriceCadenceQuarterly PriceTieredPackagePriceCadence = "quarterly"
	PriceTieredPackagePriceCadenceAnnual    PriceTieredPackagePriceCadence = "annual"
)

type PriceTieredPackagePriceItem

type PriceTieredPackagePriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceTieredPackagePriceItemJSON
}

func (*PriceTieredPackagePriceItem) UnmarshalJSON

func (r *PriceTieredPackagePriceItem) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePriceMaximum

type PriceTieredPackagePriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceTieredPackagePriceMaximumJSON
}

func (*PriceTieredPackagePriceMaximum) UnmarshalJSON

func (r *PriceTieredPackagePriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePriceMinimum

type PriceTieredPackagePriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceTieredPackagePriceMinimumJSON
}

func (*PriceTieredPackagePriceMinimum) UnmarshalJSON

func (r *PriceTieredPackagePriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceTieredPackagePriceModelType

type PriceTieredPackagePriceModelType string
const (
	PriceTieredPackagePriceModelTypeTieredPackage PriceTieredPackagePriceModelType = "tiered_package"
)

type PriceTieredPackagePricePriceType

type PriceTieredPackagePricePriceType string
const (
	PriceTieredPackagePricePriceTypeUsagePrice PriceTieredPackagePricePriceType = "usage_price"
	PriceTieredPackagePricePriceTypeFixedPrice PriceTieredPackagePricePriceType = "fixed_price"
)

type PriceTieredPrice

type PriceTieredPrice struct {
	ID                 string                         `json:"id,required"`
	BillableMetric     PriceTieredPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence            PriceTieredPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                      `json:"created_at,required" format:"date-time"`
	Currency           string                         `json:"currency,required"`
	ExternalPriceID    string                         `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                        `json:"fixed_price_quantity,required,nullable"`
	Item               PriceTieredPriceItem           `json:"item,required"`
	ModelType          PriceTieredPriceModelType      `json:"model_type,required"`
	Name               string                         `json:"name,required"`
	PlanPhaseOrder     int64                          `json:"plan_phase_order,required,nullable"`
	PriceType          PriceTieredPricePriceType      `json:"price_type,required"`
	TieredConfig       PriceTieredPriceTieredConfig   `json:"tiered_config,required"`
	Discount           InvoiceDiscount                `json:"discount,nullable"`
	Maximum            PriceTieredPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                         `json:"maximum_amount,nullable"`
	Minimum            PriceTieredPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                         `json:"minimum_amount,nullable"`
	JSON               priceTieredPriceJSON
}

func (*PriceTieredPrice) UnmarshalJSON

func (r *PriceTieredPrice) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceBillableMetric

type PriceTieredPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceTieredPriceBillableMetricJSON
}

func (*PriceTieredPriceBillableMetric) UnmarshalJSON

func (r *PriceTieredPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceCadence

type PriceTieredPriceCadence string
const (
	PriceTieredPriceCadenceOneTime   PriceTieredPriceCadence = "one_time"
	PriceTieredPriceCadenceMonthly   PriceTieredPriceCadence = "monthly"
	PriceTieredPriceCadenceQuarterly PriceTieredPriceCadence = "quarterly"
	PriceTieredPriceCadenceAnnual    PriceTieredPriceCadence = "annual"
)

type PriceTieredPriceItem

type PriceTieredPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceTieredPriceItemJSON
}

func (*PriceTieredPriceItem) UnmarshalJSON

func (r *PriceTieredPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceMaximum

type PriceTieredPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceTieredPriceMaximumJSON
}

func (*PriceTieredPriceMaximum) UnmarshalJSON

func (r *PriceTieredPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceMinimum

type PriceTieredPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceTieredPriceMinimumJSON
}

func (*PriceTieredPriceMinimum) UnmarshalJSON

func (r *PriceTieredPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceModelType

type PriceTieredPriceModelType string
const (
	PriceTieredPriceModelTypeTiered PriceTieredPriceModelType = "tiered"
)

type PriceTieredPricePriceType

type PriceTieredPricePriceType string
const (
	PriceTieredPricePriceTypeUsagePrice PriceTieredPricePriceType = "usage_price"
	PriceTieredPricePriceTypeFixedPrice PriceTieredPricePriceType = "fixed_price"
)

type PriceTieredPriceTieredConfig

type PriceTieredPriceTieredConfig struct {
	// Tiers for rating based on total usage quantities into the specified tier
	Tiers []PriceTieredPriceTieredConfigTier `json:"tiers,required"`
	JSON  priceTieredPriceTieredConfigJSON
}

func (*PriceTieredPriceTieredConfig) UnmarshalJSON

func (r *PriceTieredPriceTieredConfig) UnmarshalJSON(data []byte) (err error)

type PriceTieredPriceTieredConfigTier

type PriceTieredPriceTieredConfigTier struct {
	// Inclusive tier starting value
	FirstUnit float64 `json:"first_unit,required"`
	// Amount per unit
	UnitAmount string `json:"unit_amount,required"`
	// Exclusive tier ending value. If null, this is treated as the last tier
	LastUnit float64 `json:"last_unit,nullable"`
	JSON     priceTieredPriceTieredConfigTierJSON
}

func (*PriceTieredPriceTieredConfigTier) UnmarshalJSON

func (r *PriceTieredPriceTieredConfigTier) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPrice

type PriceTieredWithMinimumPrice struct {
	ID                      string                                    `json:"id,required"`
	BillableMetric          PriceTieredWithMinimumPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence                 PriceTieredWithMinimumPriceCadence        `json:"cadence,required"`
	CreatedAt               time.Time                                 `json:"created_at,required" format:"date-time"`
	Currency                string                                    `json:"currency,required"`
	ExternalPriceID         string                                    `json:"external_price_id,required,nullable"`
	FixedPriceQuantity      float64                                   `json:"fixed_price_quantity,required,nullable"`
	Item                    PriceTieredWithMinimumPriceItem           `json:"item,required"`
	ModelType               PriceTieredWithMinimumPriceModelType      `json:"model_type,required"`
	Name                    string                                    `json:"name,required"`
	PlanPhaseOrder          int64                                     `json:"plan_phase_order,required,nullable"`
	PriceType               PriceTieredWithMinimumPricePriceType      `json:"price_type,required"`
	TieredWithMinimumConfig map[string]interface{}                    `json:"tiered_with_minimum_config,required"`
	Discount                InvoiceDiscount                           `json:"discount,nullable"`
	Maximum                 PriceTieredWithMinimumPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount           string                                    `json:"maximum_amount,nullable"`
	Minimum                 PriceTieredWithMinimumPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount           string                                    `json:"minimum_amount,nullable"`
	JSON                    priceTieredWithMinimumPriceJSON
}

func (*PriceTieredWithMinimumPrice) UnmarshalJSON

func (r *PriceTieredWithMinimumPrice) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPriceBillableMetric

type PriceTieredWithMinimumPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceTieredWithMinimumPriceBillableMetricJSON
}

func (*PriceTieredWithMinimumPriceBillableMetric) UnmarshalJSON

func (r *PriceTieredWithMinimumPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPriceCadence

type PriceTieredWithMinimumPriceCadence string
const (
	PriceTieredWithMinimumPriceCadenceOneTime   PriceTieredWithMinimumPriceCadence = "one_time"
	PriceTieredWithMinimumPriceCadenceMonthly   PriceTieredWithMinimumPriceCadence = "monthly"
	PriceTieredWithMinimumPriceCadenceQuarterly PriceTieredWithMinimumPriceCadence = "quarterly"
	PriceTieredWithMinimumPriceCadenceAnnual    PriceTieredWithMinimumPriceCadence = "annual"
)

type PriceTieredWithMinimumPriceItem

type PriceTieredWithMinimumPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceTieredWithMinimumPriceItemJSON
}

func (*PriceTieredWithMinimumPriceItem) UnmarshalJSON

func (r *PriceTieredWithMinimumPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPriceMaximum

type PriceTieredWithMinimumPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceTieredWithMinimumPriceMaximumJSON
}

func (*PriceTieredWithMinimumPriceMaximum) UnmarshalJSON

func (r *PriceTieredWithMinimumPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPriceMinimum

type PriceTieredWithMinimumPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceTieredWithMinimumPriceMinimumJSON
}

func (*PriceTieredWithMinimumPriceMinimum) UnmarshalJSON

func (r *PriceTieredWithMinimumPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceTieredWithMinimumPriceModelType

type PriceTieredWithMinimumPriceModelType string
const (
	PriceTieredWithMinimumPriceModelTypeTieredWithMinimum PriceTieredWithMinimumPriceModelType = "tiered_with_minimum"
)

type PriceTieredWithMinimumPricePriceType

type PriceTieredWithMinimumPricePriceType string
const (
	PriceTieredWithMinimumPricePriceTypeUsagePrice PriceTieredWithMinimumPricePriceType = "usage_price"
	PriceTieredWithMinimumPricePriceTypeFixedPrice PriceTieredWithMinimumPricePriceType = "fixed_price"
)

type PriceUnitPrice

type PriceUnitPrice struct {
	ID                 string                       `json:"id,required"`
	BillableMetric     PriceUnitPriceBillableMetric `json:"billable_metric,required,nullable"`
	Cadence            PriceUnitPriceCadence        `json:"cadence,required"`
	CreatedAt          time.Time                    `json:"created_at,required" format:"date-time"`
	Currency           string                       `json:"currency,required"`
	ExternalPriceID    string                       `json:"external_price_id,required,nullable"`
	FixedPriceQuantity float64                      `json:"fixed_price_quantity,required,nullable"`
	Item               PriceUnitPriceItem           `json:"item,required"`
	ModelType          PriceUnitPriceModelType      `json:"model_type,required"`
	Name               string                       `json:"name,required"`
	PlanPhaseOrder     int64                        `json:"plan_phase_order,required,nullable"`
	PriceType          PriceUnitPricePriceType      `json:"price_type,required"`
	UnitConfig         PriceUnitPriceUnitConfig     `json:"unit_config,required"`
	Discount           InvoiceDiscount              `json:"discount,nullable"`
	Maximum            PriceUnitPriceMaximum        `json:"maximum,nullable"`
	MaximumAmount      string                       `json:"maximum_amount,nullable"`
	Minimum            PriceUnitPriceMinimum        `json:"minimum,nullable"`
	MinimumAmount      string                       `json:"minimum_amount,nullable"`
	JSON               priceUnitPriceJSON
}

func (*PriceUnitPrice) UnmarshalJSON

func (r *PriceUnitPrice) UnmarshalJSON(data []byte) (err error)

type PriceUnitPriceBillableMetric

type PriceUnitPriceBillableMetric struct {
	ID   string `json:"id,required"`
	JSON priceUnitPriceBillableMetricJSON
}

func (*PriceUnitPriceBillableMetric) UnmarshalJSON

func (r *PriceUnitPriceBillableMetric) UnmarshalJSON(data []byte) (err error)

type PriceUnitPriceCadence

type PriceUnitPriceCadence string
const (
	PriceUnitPriceCadenceOneTime   PriceUnitPriceCadence = "one_time"
	PriceUnitPriceCadenceMonthly   PriceUnitPriceCadence = "monthly"
	PriceUnitPriceCadenceQuarterly PriceUnitPriceCadence = "quarterly"
	PriceUnitPriceCadenceAnnual    PriceUnitPriceCadence = "annual"
)

type PriceUnitPriceItem

type PriceUnitPriceItem struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON priceUnitPriceItemJSON
}

func (*PriceUnitPriceItem) UnmarshalJSON

func (r *PriceUnitPriceItem) UnmarshalJSON(data []byte) (err error)

type PriceUnitPriceMaximum

type PriceUnitPriceMaximum struct {
	// List of price_ids that this maximum amount applies to. For plan/plan phase
	// maximums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Maximum amount applied
	MaximumAmount string `json:"maximum_amount,required"`
	JSON          priceUnitPriceMaximumJSON
}

func (*PriceUnitPriceMaximum) UnmarshalJSON

func (r *PriceUnitPriceMaximum) UnmarshalJSON(data []byte) (err error)

type PriceUnitPriceMinimum

type PriceUnitPriceMinimum struct {
	// List of price_ids that this minimum amount applies to. For plan/plan phase
	// minimums, this can be a subset of prices.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// Minimum amount applied
	MinimumAmount string `json:"minimum_amount,required"`
	JSON          priceUnitPriceMinimumJSON
}

func (*PriceUnitPriceMinimum) UnmarshalJSON

func (r *PriceUnitPriceMinimum) UnmarshalJSON(data []byte) (err error)

type PriceUnitPriceModelType

type PriceUnitPriceModelType string
const (
	PriceUnitPriceModelTypeUnit PriceUnitPriceModelType = "unit"
)

type PriceUnitPricePriceType

type PriceUnitPricePriceType string
const (
	PriceUnitPricePriceTypeUsagePrice PriceUnitPricePriceType = "usage_price"
	PriceUnitPricePriceTypeFixedPrice PriceUnitPricePriceType = "fixed_price"
)

type PriceUnitPriceUnitConfig

type PriceUnitPriceUnitConfig struct {
	// Rate per unit of usage
	UnitAmount string `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor float64 `json:"scaling_factor,nullable"`
	JSON          priceUnitPriceUnitConfigJSON
}

func (*PriceUnitPriceUnitConfig) UnmarshalJSON

func (r *PriceUnitPriceUnitConfig) UnmarshalJSON(data []byte) (err error)

type Subscription

type Subscription struct {
	ID string `json:"id,required"`
	// The current plan phase that is active, only if the subscription's plan has
	// phases.
	ActivePlanPhaseOrder int64 `json:"active_plan_phase_order,required,nullable"`
	// Determines whether issued invoices for this subscription will automatically be
	// charged with the saved payment method on the due date. This property defaults to
	// the plan's behavior.
	AutoCollection bool `json:"auto_collection,required,nullable"`
	// The day of the month on which the billing cycle is anchored. If the maximum
	// number of days in a month is greater than this value, the last day of the month
	// is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
	// period begins on the 30th.
	BillingCycleDay int64     `json:"billing_cycle_day,required"`
	CreatedAt       time.Time `json:"created_at,required" format:"date-time"`
	// The end of the current billing period. This is an exclusive timestamp, such that
	// the instant returned is not part of the billing period. Set to null for
	// subscriptions that are not currently active.
	CurrentBillingPeriodEndDate time.Time `json:"current_billing_period_end_date,required,nullable" format:"date-time"`
	// The start date of the current billing period. This is an inclusive timestamp;
	// the instant returned is exactly the beginning of the billing period. Set to null
	// if the subscription is not currently active.
	CurrentBillingPeriodStartDate time.Time `json:"current_billing_period_start_date,required,nullable" format:"date-time"`
	// A customer is a buyer of your products, and the other party to the billing
	// relationship.
	//
	// In Orb, customers are assigned system generated identifiers automatically, but
	// it's often desirable to have these match existing identifiers in your system. To
	// avoid having to denormalize Orb ID information, you can pass in an
	// `external_customer_id` with your own identifier. See
	// [Customer ID Aliases](../guides/events-and-metrics/customer-aliases) for further
	// information about how these aliases work in Orb.
	//
	// In addition to having an identifier in your system, a customer may exist in a
	// payment provider solution like Stripe. Use the `payment_provider_id` and the
	// `payment_provider` enum field to express this mapping.
	//
	// A customer also has a timezone (from the standard
	// [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
	// your account's timezone. See
	// [Timezone localization](../guides/product-catalog/timezones.md) for information
	// on what this timezone parameter influences within Orb.
	Customer Customer `json:"customer,required"`
	// Determines the default memo on this subscriptions' invoices. Note that if this
	// is not provided, it is determined by the plan configuration.
	DefaultInvoiceMemo string `json:"default_invoice_memo,required,nullable"`
	// The discount intervals for this subscription.
	DiscountIntervals []SubscriptionDiscountInterval `json:"discount_intervals,required"`
	// The date Orb stops billing for this subscription.
	EndDate                  time.Time                              `json:"end_date,required,nullable" format:"date-time"`
	FixedFeeQuantitySchedule []SubscriptionFixedFeeQuantitySchedule `json:"fixed_fee_quantity_schedule,required"`
	InvoicingThreshold       string                                 `json:"invoicing_threshold,required,nullable"`
	// The maximum intervals for this subscription.
	MaximumIntervals []SubscriptionMaximumInterval `json:"maximum_intervals,required"`
	// User specified key-value pairs. If no metadata was specified at subscription
	// creation time, this defaults to an empty dictionary.
	Metadata interface{} `json:"metadata,required"`
	// The minimum intervals for this subscription.
	MinimumIntervals []SubscriptionMinimumInterval `json:"minimum_intervals,required"`
	// Determines the difference between the invoice issue date for subscription
	// invoices as the date that they are due. A value of `0` here represents that the
	// invoice is due on issue, whereas a value of `30` represents that the customer
	// has a month to pay the invoice.
	NetTerms int64 `json:"net_terms,required"`
	// The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a
	// plan that can be subscribed to by a customer. Plans define the billing behavior
	// of the subscription. You can see more about how to configure prices in the
	// [Price resource](/reference/price).
	Plan Plan `json:"plan,required"`
	// The price intervals for this subscription.
	PriceIntervals []SubscriptionPriceInterval `json:"price_intervals,required"`
	RedeemedCoupon SubscriptionRedeemedCoupon  `json:"redeemed_coupon,required,nullable"`
	// The date Orb starts billing for this subscription.
	StartDate time.Time             `json:"start_date,required" format:"date-time"`
	Status    SubscriptionStatus    `json:"status,required"`
	TrialInfo SubscriptionTrialInfo `json:"trial_info,required"`
	JSON      subscriptionJSON
}

A [subscription](../guides/core-concepts.mdx#subscription) represents the purchase of a plan by a customer.

By default, subscriptions begin on the day that they're created and renew automatically for each billing cycle at the cadence that's configured in the plan definition.

Subscriptions also default to **beginning of month alignment**, which means the first invoice issued for the subscription will have pro-rated charges between the `start_date` and the first of the following month. Subsequent billing periods will always start and end on a month boundary (e.g. subsequent month starts for monthly billing).

Depending on the plan configuration, any _flat_ recurring fees will be billed either at the beginning (in-advance) or end (in-arrears) of each billing cycle. Plans default to **in-advance billing**. Usage-based fees are billed in arrears as usage is accumulated. In the normal course of events, you can expect an invoice to contain usage-based charges for the previous period, and a recurring fee for the following period.

func (*Subscription) UnmarshalJSON

func (r *Subscription) UnmarshalJSON(data []byte) (err error)

type SubscriptionCancelParams

type SubscriptionCancelParams struct {
	// Determines the timing of subscription cancellation
	CancelOption param.Field[SubscriptionCancelParamsCancelOption] `json:"cancel_option,required"`
	// The date that the cancellation should take effect. This parameter can only be
	// passed if the `cancel_option` is `requested_date`.
	CancellationDate param.Field[time.Time] `json:"cancellation_date" format:"date-time"`
}

func (SubscriptionCancelParams) MarshalJSON

func (r SubscriptionCancelParams) MarshalJSON() (data []byte, err error)

type SubscriptionCancelParamsCancelOption

type SubscriptionCancelParamsCancelOption string

Determines the timing of subscription cancellation

const (
	SubscriptionCancelParamsCancelOptionEndOfSubscriptionTerm SubscriptionCancelParamsCancelOption = "end_of_subscription_term"
	SubscriptionCancelParamsCancelOptionImmediate             SubscriptionCancelParamsCancelOption = "immediate"
	SubscriptionCancelParamsCancelOptionRequestedDate         SubscriptionCancelParamsCancelOption = "requested_date"
)

type SubscriptionDiscountInterval

type SubscriptionDiscountInterval interface {
	// contains filtered or unexported methods
}

Union satisfied by SubscriptionDiscountIntervalsAmountDiscountInterval, SubscriptionDiscountIntervalsPercentageDiscountInterval or SubscriptionDiscountIntervalsUsageDiscountInterval.

type SubscriptionDiscountIntervalsAmountDiscountInterval

type SubscriptionDiscountIntervalsAmountDiscountInterval struct {
	// Only available if discount_type is `amount`.
	AmountDiscount string `json:"amount_discount,required"`
	// The price ids that this discount interval applies to.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// The price interval ids that this discount interval applies to.
	AppliesToPriceIntervalIDs []string                                                        `json:"applies_to_price_interval_ids,required"`
	DiscountType              SubscriptionDiscountIntervalsAmountDiscountIntervalDiscountType `json:"discount_type,required"`
	// The end date of the discount interval.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// The start date of the discount interval.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionDiscountIntervalsAmountDiscountIntervalJSON
}

func (*SubscriptionDiscountIntervalsAmountDiscountInterval) UnmarshalJSON

func (r *SubscriptionDiscountIntervalsAmountDiscountInterval) UnmarshalJSON(data []byte) (err error)

type SubscriptionDiscountIntervalsAmountDiscountIntervalDiscountType

type SubscriptionDiscountIntervalsAmountDiscountIntervalDiscountType string
const (
	SubscriptionDiscountIntervalsAmountDiscountIntervalDiscountTypeAmount SubscriptionDiscountIntervalsAmountDiscountIntervalDiscountType = "amount"
)

type SubscriptionDiscountIntervalsPercentageDiscountInterval

type SubscriptionDiscountIntervalsPercentageDiscountInterval struct {
	// The price ids that this discount interval applies to.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// The price interval ids that this discount interval applies to.
	AppliesToPriceIntervalIDs []string                                                            `json:"applies_to_price_interval_ids,required"`
	DiscountType              SubscriptionDiscountIntervalsPercentageDiscountIntervalDiscountType `json:"discount_type,required"`
	// The end date of the discount interval.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// Only available if discount_type is `percentage`.This is a number between 0
	// and 1.
	PercentageDiscount float64 `json:"percentage_discount,required"`
	// The start date of the discount interval.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionDiscountIntervalsPercentageDiscountIntervalJSON
}

func (*SubscriptionDiscountIntervalsPercentageDiscountInterval) UnmarshalJSON

type SubscriptionDiscountIntervalsPercentageDiscountIntervalDiscountType

type SubscriptionDiscountIntervalsPercentageDiscountIntervalDiscountType string
const (
	SubscriptionDiscountIntervalsPercentageDiscountIntervalDiscountTypePercentage SubscriptionDiscountIntervalsPercentageDiscountIntervalDiscountType = "percentage"
)

type SubscriptionDiscountIntervalsUsageDiscountInterval

type SubscriptionDiscountIntervalsUsageDiscountInterval struct {
	// The price ids that this discount interval applies to.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// The price interval ids that this discount interval applies to.
	AppliesToPriceIntervalIDs []string                                                       `json:"applies_to_price_interval_ids,required"`
	DiscountType              SubscriptionDiscountIntervalsUsageDiscountIntervalDiscountType `json:"discount_type,required"`
	// The end date of the discount interval.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// The start date of the discount interval.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	// Only available if discount_type is `usage`. Number of usage units that this
	// discount is for
	UsageDiscount float64 `json:"usage_discount,required"`
	JSON          subscriptionDiscountIntervalsUsageDiscountIntervalJSON
}

func (*SubscriptionDiscountIntervalsUsageDiscountInterval) UnmarshalJSON

func (r *SubscriptionDiscountIntervalsUsageDiscountInterval) UnmarshalJSON(data []byte) (err error)

type SubscriptionDiscountIntervalsUsageDiscountIntervalDiscountType

type SubscriptionDiscountIntervalsUsageDiscountIntervalDiscountType string
const (
	SubscriptionDiscountIntervalsUsageDiscountIntervalDiscountTypeUsage SubscriptionDiscountIntervalsUsageDiscountIntervalDiscountType = "usage"
)

type SubscriptionFetchCostsParams

type SubscriptionFetchCostsParams struct {
	// Groups per-price costs by the key provided.
	GroupBy param.Field[string] `query:"group_by"`
	// Costs returned are exclusive of `timeframe_end`.
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// Costs returned are inclusive of `timeframe_start`.
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// Controls whether Orb returns cumulative costs since the start of the billing
	// period, or incremental day-by-day costs. If your customer has minimums or
	// discounts, it's strongly recommended that you use the default cumulative
	// behavior.
	ViewMode param.Field[SubscriptionFetchCostsParamsViewMode] `query:"view_mode"`
}

func (SubscriptionFetchCostsParams) URLQuery

func (r SubscriptionFetchCostsParams) URLQuery() (v url.Values)

URLQuery serializes SubscriptionFetchCostsParams's query parameters as `url.Values`.

type SubscriptionFetchCostsParamsViewMode

type SubscriptionFetchCostsParamsViewMode string

Controls whether Orb returns cumulative costs since the start of the billing period, or incremental day-by-day costs. If your customer has minimums or discounts, it's strongly recommended that you use the default cumulative behavior.

const (
	SubscriptionFetchCostsParamsViewModePeriodic   SubscriptionFetchCostsParamsViewMode = "periodic"
	SubscriptionFetchCostsParamsViewModeCumulative SubscriptionFetchCostsParamsViewMode = "cumulative"
)

type SubscriptionFetchCostsResponse

type SubscriptionFetchCostsResponse struct {
	Data []SubscriptionFetchCostsResponseData `json:"data,required"`
	JSON subscriptionFetchCostsResponseJSON
}

func (*SubscriptionFetchCostsResponse) UnmarshalJSON

func (r *SubscriptionFetchCostsResponse) UnmarshalJSON(data []byte) (err error)

type SubscriptionFetchCostsResponseData

type SubscriptionFetchCostsResponseData struct {
	PerPriceCosts []SubscriptionFetchCostsResponseDataPerPriceCost `json:"per_price_costs,required"`
	// Total costs for the timeframe, excluding any minimums and discounts.
	Subtotal       string    `json:"subtotal,required"`
	TimeframeEnd   time.Time `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time `json:"timeframe_start,required" format:"date-time"`
	// Total costs for the timeframe, including any minimums and discounts.
	Total string `json:"total,required"`
	JSON  subscriptionFetchCostsResponseDataJSON
}

func (*SubscriptionFetchCostsResponseData) UnmarshalJSON

func (r *SubscriptionFetchCostsResponseData) UnmarshalJSON(data []byte) (err error)

type SubscriptionFetchCostsResponseDataPerPriceCost

type SubscriptionFetchCostsResponseDataPerPriceCost struct {
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price Price `json:"price,required"`
	// Price's contributions for the timeframe, excluding any minimums and discounts.
	Subtotal string `json:"subtotal,required"`
	// Price's contributions for the timeframe, including minimums and discounts.
	Total string `json:"total,required"`
	// If a `group_by` attribute is passed in, array of costs per `grouping_key`,
	// `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`.
	PriceGroups []SubscriptionFetchCostsResponseDataPerPriceCostsPriceGroup `json:"price_groups,nullable"`
	// The price's quantity for the timeframe
	Quantity float64 `json:"quantity,nullable"`
	JSON     subscriptionFetchCostsResponseDataPerPriceCostJSON
}

func (*SubscriptionFetchCostsResponseDataPerPriceCost) UnmarshalJSON

func (r *SubscriptionFetchCostsResponseDataPerPriceCost) UnmarshalJSON(data []byte) (err error)

type SubscriptionFetchCostsResponseDataPerPriceCostsPriceGroup

type SubscriptionFetchCostsResponseDataPerPriceCostsPriceGroup struct {
	// Grouping key to break down a single price's costs
	GroupingKey   string `json:"grouping_key,required"`
	GroupingValue string `json:"grouping_value,required,nullable"`
	// If the price is a matrix price, this is the second dimension key
	SecondaryGroupingKey   string `json:"secondary_grouping_key,required,nullable"`
	SecondaryGroupingValue string `json:"secondary_grouping_value,required,nullable"`
	// Total costs for this group for the timeframe. Note that this does not account
	// for any minimums or discounts.
	Total string `json:"total,required"`
	JSON  subscriptionFetchCostsResponseDataPerPriceCostsPriceGroupJSON
}

func (*SubscriptionFetchCostsResponseDataPerPriceCostsPriceGroup) UnmarshalJSON

type SubscriptionFetchScheduleParams

type SubscriptionFetchScheduleParams struct {
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor param.Field[string] `query:"cursor"`
	// The number of items to fetch. Defaults to 20.
	Limit        param.Field[int64]     `query:"limit"`
	StartDateGt  param.Field[time.Time] `query:"start_date[gt]" format:"date-time"`
	StartDateGte param.Field[time.Time] `query:"start_date[gte]" format:"date-time"`
	StartDateLt  param.Field[time.Time] `query:"start_date[lt]" format:"date-time"`
	StartDateLte param.Field[time.Time] `query:"start_date[lte]" format:"date-time"`
}

func (SubscriptionFetchScheduleParams) URLQuery

func (r SubscriptionFetchScheduleParams) URLQuery() (v url.Values)

URLQuery serializes SubscriptionFetchScheduleParams's query parameters as `url.Values`.

type SubscriptionFetchScheduleResponse

type SubscriptionFetchScheduleResponse struct {
	EndDate   time.Time                             `json:"end_date,required,nullable" format:"date-time"`
	Plan      SubscriptionFetchScheduleResponsePlan `json:"plan,required"`
	StartDate time.Time                             `json:"start_date,required" format:"date-time"`
	JSON      subscriptionFetchScheduleResponseJSON
}

func (*SubscriptionFetchScheduleResponse) UnmarshalJSON

func (r *SubscriptionFetchScheduleResponse) UnmarshalJSON(data []byte) (err error)

type SubscriptionFetchScheduleResponsePlan

type SubscriptionFetchScheduleResponsePlan struct {
	ID string `json:"id,required,nullable"`
	// An optional user-defined ID for this plan resource, used throughout the system
	// as an alias for this Plan. Use this field to identify a plan by an existing
	// identifier in your system.
	ExternalPlanID string `json:"external_plan_id,required,nullable"`
	Name           string `json:"name,required,nullable"`
	JSON           subscriptionFetchScheduleResponsePlanJSON
}

func (*SubscriptionFetchScheduleResponsePlan) UnmarshalJSON

func (r *SubscriptionFetchScheduleResponsePlan) UnmarshalJSON(data []byte) (err error)

type SubscriptionFetchUsageParams

type SubscriptionFetchUsageParams struct {
	// When specified in conjunction with `group_by`, this parameter filters usage to a
	// single billable metric. Note that both `group_by` and `billable_metric_id` must
	// be specified together.
	BillableMetricID param.Field[string] `query:"billable_metric_id"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor              param.Field[string] `query:"cursor"`
	FirstDimensionKey   param.Field[string] `query:"first_dimension_key"`
	FirstDimensionValue param.Field[string] `query:"first_dimension_value"`
	// This determines the windowing of usage reporting.
	Granularity param.Field[SubscriptionFetchUsageParamsGranularity] `query:"granularity"`
	// Groups per-price usage by the key provided.
	GroupBy param.Field[string] `query:"group_by"`
	// If including a `group_by`, the number of groups to fetch data for. Defaults
	// to 1000.
	Limit                param.Field[int64]  `query:"limit"`
	SecondDimensionKey   param.Field[string] `query:"second_dimension_key"`
	SecondDimensionValue param.Field[string] `query:"second_dimension_value"`
	// Usage returned is exclusive of `timeframe_end`.
	TimeframeEnd param.Field[time.Time] `query:"timeframe_end" format:"date-time"`
	// Usage returned is inclusive of `timeframe_start`.
	TimeframeStart param.Field[time.Time] `query:"timeframe_start" format:"date-time"`
	// Controls whether Orb returns cumulative usage since the start of the billing
	// period, or incremental day-by-day usage. If your customer has minimums or
	// discounts, it's strongly recommended that you use the default cumulative
	// behavior.
	ViewMode param.Field[SubscriptionFetchUsageParamsViewMode] `query:"view_mode"`
}

func (SubscriptionFetchUsageParams) URLQuery

func (r SubscriptionFetchUsageParams) URLQuery() (v url.Values)

URLQuery serializes SubscriptionFetchUsageParams's query parameters as `url.Values`.

type SubscriptionFetchUsageParamsGranularity

type SubscriptionFetchUsageParamsGranularity string

This determines the windowing of usage reporting.

const (
	SubscriptionFetchUsageParamsGranularityDay SubscriptionFetchUsageParamsGranularity = "day"
)

type SubscriptionFetchUsageParamsViewMode

type SubscriptionFetchUsageParamsViewMode string

Controls whether Orb returns cumulative usage since the start of the billing period, or incremental day-by-day usage. If your customer has minimums or discounts, it's strongly recommended that you use the default cumulative behavior.

const (
	SubscriptionFetchUsageParamsViewModePeriodic   SubscriptionFetchUsageParamsViewMode = "periodic"
	SubscriptionFetchUsageParamsViewModeCumulative SubscriptionFetchUsageParamsViewMode = "cumulative"
)

type SubscriptionFixedFeeQuantitySchedule

type SubscriptionFixedFeeQuantitySchedule struct {
	EndDate   time.Time `json:"end_date,required,nullable" format:"date-time"`
	PriceID   string    `json:"price_id,required"`
	Quantity  float64   `json:"quantity,required"`
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionFixedFeeQuantityScheduleJSON
}

func (*SubscriptionFixedFeeQuantitySchedule) UnmarshalJSON

func (r *SubscriptionFixedFeeQuantitySchedule) UnmarshalJSON(data []byte) (err error)

type SubscriptionListParams

type SubscriptionListParams struct {
	CreatedAtGt  param.Field[time.Time] `query:"created_at[gt]" format:"date-time"`
	CreatedAtGte param.Field[time.Time] `query:"created_at[gte]" format:"date-time"`
	CreatedAtLt  param.Field[time.Time] `query:"created_at[lt]" format:"date-time"`
	CreatedAtLte param.Field[time.Time] `query:"created_at[lte]" format:"date-time"`
	// Cursor for pagination. This can be populated by the `next_cursor` value returned
	// from the initial request.
	Cursor             param.Field[string] `query:"cursor"`
	CustomerID         param.Field[string] `query:"customer_id"`
	ExternalCustomerID param.Field[string] `query:"external_customer_id"`
	// The number of items to fetch. Defaults to 20.
	Limit  param.Field[int64]                        `query:"limit"`
	Status param.Field[SubscriptionListParamsStatus] `query:"status"`
}

func (SubscriptionListParams) URLQuery

func (r SubscriptionListParams) URLQuery() (v url.Values)

URLQuery serializes SubscriptionListParams's query parameters as `url.Values`.

type SubscriptionListParamsStatus

type SubscriptionListParamsStatus string
const (
	SubscriptionListParamsStatusActive   SubscriptionListParamsStatus = "active"
	SubscriptionListParamsStatusEnded    SubscriptionListParamsStatus = "ended"
	SubscriptionListParamsStatusUpcoming SubscriptionListParamsStatus = "upcoming"
)

type SubscriptionMaximumInterval

type SubscriptionMaximumInterval struct {
	// The price ids that this maximum interval applies to.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// The price interval ids that this maximum interval applies to.
	AppliesToPriceIntervalIDs []string `json:"applies_to_price_interval_ids,required"`
	// The end date of the maximum interval.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// The maximum amount to charge in a given billing period for the price intervals
	// this transform applies to.
	MaximumAmount string `json:"maximum_amount,required"`
	// The start date of the maximum interval.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionMaximumIntervalJSON
}

func (*SubscriptionMaximumInterval) UnmarshalJSON

func (r *SubscriptionMaximumInterval) UnmarshalJSON(data []byte) (err error)

type SubscriptionMinimumInterval

type SubscriptionMinimumInterval struct {
	// The price ids that this minimum interval applies to.
	AppliesToPriceIDs []string `json:"applies_to_price_ids,required"`
	// The price interval ids that this minimum interval applies to.
	AppliesToPriceIntervalIDs []string `json:"applies_to_price_interval_ids,required"`
	// The end date of the minimum interval.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// The minimum amount to charge in a given billing period for the price intervals
	// this minimum applies to.
	MinimumAmount string `json:"minimum_amount,required"`
	// The start date of the minimum interval.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionMinimumIntervalJSON
}

func (*SubscriptionMinimumInterval) UnmarshalJSON

func (r *SubscriptionMinimumInterval) UnmarshalJSON(data []byte) (err error)

type SubscriptionNewParams

type SubscriptionNewParams struct {
	AlignBillingWithSubscriptionStartDate param.Field[bool]                                     `json:"align_billing_with_subscription_start_date"`
	AutoCollection                        param.Field[bool]                                     `json:"auto_collection"`
	AwsRegion                             param.Field[string]                                   `json:"aws_region"`
	CouponRedemptionCode                  param.Field[string]                                   `json:"coupon_redemption_code"`
	CreditsOverageRate                    param.Field[float64]                                  `json:"credits_overage_rate"`
	CustomerID                            param.Field[string]                                   `json:"customer_id"`
	DefaultInvoiceMemo                    param.Field[string]                                   `json:"default_invoice_memo"`
	EndDate                               param.Field[time.Time]                                `json:"end_date" format:"date-time"`
	ExternalCustomerID                    param.Field[string]                                   `json:"external_customer_id"`
	ExternalMarketplace                   param.Field[SubscriptionNewParamsExternalMarketplace] `json:"external_marketplace"`
	ExternalMarketplaceReportingID        param.Field[string]                                   `json:"external_marketplace_reporting_id"`
	// The external_plan_id of the plan that the given subscription should be switched
	// to. Note that either this property or `plan_id` must be specified.
	ExternalPlanID         param.Field[string]      `json:"external_plan_id"`
	InitialPhaseOrder      param.Field[int64]       `json:"initial_phase_order"`
	InvoicingThreshold     param.Field[string]      `json:"invoicing_threshold"`
	Metadata               param.Field[interface{}] `json:"metadata"`
	NetTerms               param.Field[int64]       `json:"net_terms"`
	PerCreditOverageAmount param.Field[string]      `json:"per_credit_overage_amount"`
	// The plan that the given subscription should be switched to. Note that either
	// this property or `external_plan_id` must be specified.
	PlanID param.Field[string] `json:"plan_id"`
	// Optionally provide a list of overrides for prices on the plan
	PriceOverrides param.Field[[]SubscriptionNewParamsPriceOverride] `json:"price_overrides"`
	StartDate      param.Field[time.Time]                            `json:"start_date" format:"date-time"`
}

func (SubscriptionNewParams) MarshalJSON

func (r SubscriptionNewParams) MarshalJSON() (data []byte, err error)

type SubscriptionNewParamsExternalMarketplace

type SubscriptionNewParamsExternalMarketplace string
const (
	SubscriptionNewParamsExternalMarketplaceGoogle SubscriptionNewParamsExternalMarketplace = "google"
	SubscriptionNewParamsExternalMarketplaceAws    SubscriptionNewParamsExternalMarketplace = "aws"
	SubscriptionNewParamsExternalMarketplaceAzure  SubscriptionNewParamsExternalMarketplace = "azure"
)

type SubscriptionNewParamsPriceOverridesOverrideBpsPrice

type SubscriptionNewParamsPriceOverridesOverrideBpsPrice struct {
	ID        param.Field[string]                                                       `json:"id,required"`
	BpsConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideBpsPriceBpsConfig] `json:"bps_config,required"`
	ModelType param.Field[SubscriptionNewParamsPriceOverridesOverrideBpsPriceModelType] `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBpsPrice) MarshalJSON

func (r SubscriptionNewParamsPriceOverridesOverrideBpsPrice) MarshalJSON() (data []byte, err error)

type SubscriptionNewParamsPriceOverridesOverrideBpsPriceBpsConfig

type SubscriptionNewParamsPriceOverridesOverrideBpsPriceBpsConfig struct {
	// Basis point take rate per event
	Bps param.Field[float64] `json:"bps,required"`
	// Optional currency amount maximum to cap spend per event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBpsPriceBpsConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBpsPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideBpsPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideBpsPriceModelTypeBps SubscriptionNewParamsPriceOverridesOverrideBpsPriceModelType = "bps"
)

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPrice

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPrice struct {
	ID            param.Field[string]                                                               `json:"id,required"`
	BulkBpsConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig] `json:"bulk_bps_config,required"`
	ModelType     param.Field[SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceModelType]     `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkBpsPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig struct {
	// Tiers for a bulk BPS pricing model where all usage is aggregated to a single
	// tier based on total volume
	Tiers param.Field[[]SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier struct {
	// Basis points to rate on
	Bps param.Field[float64] `json:"bps,required"`
	// Upper bound for tier
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The maximum amount to charge for any one event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceModelTypeBulkBps SubscriptionNewParamsPriceOverridesOverrideBulkBpsPriceModelType = "bulk_bps"
)

type SubscriptionNewParamsPriceOverridesOverrideBulkPrice

type SubscriptionNewParamsPriceOverridesOverrideBulkPrice struct {
	ID         param.Field[string]                                                         `json:"id,required"`
	BulkConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfig] `json:"bulk_config,required"`
	ModelType  param.Field[SubscriptionNewParamsPriceOverridesOverrideBulkPriceModelType]  `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkPrice) MarshalJSON

func (r SubscriptionNewParamsPriceOverridesOverrideBulkPrice) MarshalJSON() (data []byte, err error)

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfig

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfig struct {
	// Bulk tiers for rating based on total usage volume
	Tiers param.Field[[]SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfigTier] `json:"tiers,required"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfigTier

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfigTier struct {
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Upper bound for this tier
	MaximumUnits param.Field[float64] `json:"maximum_units"`
}

func (SubscriptionNewParamsPriceOverridesOverrideBulkPriceBulkConfigTier) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideBulkPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideBulkPriceModelTypeBulk SubscriptionNewParamsPriceOverridesOverrideBulkPriceModelType = "bulk"
)

type SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePrice

type SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePrice struct {
	ID                    param.Field[string]                                                                   `json:"id,required"`
	FivetranExampleConfig param.Field[map[string]interface{}]                                                   `json:"fivetran_example_config,required"`
	ModelType             param.Field[SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePriceModelType] `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePriceModelType

type SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePriceModelTypeFivetranExample SubscriptionNewParamsPriceOverridesOverrideFivetranExamplePriceModelType = "fivetran_example"
)

type SubscriptionNewParamsPriceOverridesOverrideMatrixPrice

type SubscriptionNewParamsPriceOverridesOverrideMatrixPrice struct {
	ID           param.Field[string]                                                             `json:"id,required"`
	MatrixConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfig] `json:"matrix_config,required"`
	ModelType    param.Field[SubscriptionNewParamsPriceOverridesOverrideMatrixPriceModelType]    `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideMatrixPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfig

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfig struct {
	// Default per unit rate for any usage not bucketed into a specified matrix_value
	DefaultUnitAmount param.Field[string] `json:"default_unit_amount,required"`
	// One or two event property values to evaluate matrix groups by
	Dimensions param.Field[[]string] `json:"dimensions,required"`
	// Matrix values for specified matrix grouping keys
	MatrixValues param.Field[[]SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue] `json:"matrix_values,required"`
	// Default optional multiplier to scale rated quantities that fall into the default
	// bucket by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue struct {
	// One or two matrix keys to filter usage to this Matrix value by. For example,
	// ["region", "tier"] could be used to filter cloud usage by a cloud region and an
	// instance tier.
	DimensionValues param.Field[[]string] `json:"dimension_values,required"`
	// Unit price for the specified dimension_values
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Optional multiplier to scale rated quantities by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionNewParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideMatrixPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideMatrixPriceModelTypeMatrix SubscriptionNewParamsPriceOverridesOverrideMatrixPriceModelType = "matrix"
)

type SubscriptionNewParamsPriceOverridesOverridePackagePrice

type SubscriptionNewParamsPriceOverridesOverridePackagePrice struct {
	ID            param.Field[string]                                                               `json:"id,required"`
	ModelType     param.Field[SubscriptionNewParamsPriceOverridesOverridePackagePriceModelType]     `json:"model_type,required"`
	PackageConfig param.Field[SubscriptionNewParamsPriceOverridesOverridePackagePricePackageConfig] `json:"package_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverridePackagePrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverridePackagePriceModelType

type SubscriptionNewParamsPriceOverridesOverridePackagePriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverridePackagePriceModelTypePackage SubscriptionNewParamsPriceOverridesOverridePackagePriceModelType = "package"
)

type SubscriptionNewParamsPriceOverridesOverridePackagePricePackageConfig

type SubscriptionNewParamsPriceOverridesOverridePackagePricePackageConfig struct {
	// A currency amount to rate usage by
	PackageAmount param.Field[string] `json:"package_amount,required"`
	// An integer amount to represent package size. For example, 1000 here would divide
	// usage by 1000 before multiplying by package_amount in rating
	PackageSize param.Field[int64] `json:"package_size"`
}

func (SubscriptionNewParamsPriceOverridesOverridePackagePricePackageConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPrice

type SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPrice struct {
	ID                          param.Field[string]                                                                         `json:"id,required"`
	ModelType                   param.Field[SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPriceModelType] `json:"model_type,required"`
	PackageWithAllocationConfig param.Field[map[string]interface{}]                                                         `json:"package_with_allocation_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPriceModelType

type SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPriceModelTypePackageWithAllocation SubscriptionNewParamsPriceOverridesOverridePackageWithAllocationPriceModelType = "package_with_allocation"
)

type SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPrice

type SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPrice struct {
	ID                       param.Field[string]                                                                      `json:"id,required"`
	ModelType                param.Field[SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPriceModelType] `json:"model_type,required"`
	TestRatingFunctionConfig param.Field[map[string]interface{}]                                                      `json:"test_rating_function_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPriceModelTypeTestRatingFunction SubscriptionNewParamsPriceOverridesOverrideTestRatingFunctionPriceModelType = "test_rating_function"
)

type SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPrice

type SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPrice struct {
	ID                         param.Field[string]                                                                        `json:"id,required"`
	ModelType                  param.Field[SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType] `json:"model_type,required"`
	ThresholdTotalAmountConfig param.Field[map[string]interface{}]                                                        `json:"threshold_total_amount_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPriceModelTypeThresholdTotalAmount SubscriptionNewParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType = "threshold_total_amount"
)

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPrice

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPrice struct {
	ID              param.Field[string]                                                                   `json:"id,required"`
	ModelType       param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceModelType]       `json:"model_type,required"`
	TieredBpsConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig] `json:"tiered_bps_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredBpsPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceModelTypeTieredBps SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceModelType = "tiered_bps"
)

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig struct {
	// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified
	// tiers
	Tiers param.Field[[]SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier

type SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier struct {
	// Per-event basis point rate
	Bps param.Field[float64] `json:"bps,required"`
	// Inclusive tier starting value
	MinimumAmount param.Field[string] `json:"minimum_amount,required"`
	// Exclusive tier ending value
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// Per unit maximum to charge
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredPackagePrice

type SubscriptionNewParamsPriceOverridesOverrideTieredPackagePrice struct {
	ID                  param.Field[string]                                                                 `json:"id,required"`
	ModelType           param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredPackagePriceModelType] `json:"model_type,required"`
	TieredPackageConfig param.Field[map[string]interface{}]                                                 `json:"tiered_package_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredPackagePrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredPackagePriceModelType

type SubscriptionNewParamsPriceOverridesOverrideTieredPackagePriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideTieredPackagePriceModelTypeTieredPackage SubscriptionNewParamsPriceOverridesOverrideTieredPackagePriceModelType = "tiered_package"
)

type SubscriptionNewParamsPriceOverridesOverrideTieredPrice

type SubscriptionNewParamsPriceOverridesOverrideTieredPrice struct {
	ID           param.Field[string]                                                             `json:"id,required"`
	ModelType    param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredPriceModelType]    `json:"model_type,required"`
	TieredConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfig] `json:"tiered_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideTieredPriceModelTypeTiered SubscriptionNewParamsPriceOverridesOverrideTieredPriceModelType = "tiered"
)

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfig

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfig struct {
	// Tiers for rating based on total usage quantities into the specified tier
	Tiers param.Field[[]SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfigTier] `json:"tiers,required"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfig) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfigTier

type SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfigTier struct {
	// Inclusive tier starting value
	FirstUnit param.Field[float64] `json:"first_unit,required"`
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Exclusive tier ending value. If null, this is treated as the last tier
	LastUnit param.Field[float64] `json:"last_unit"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredPriceTieredConfigTier) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPrice

type SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPrice struct {
	ID                      param.Field[string]                                                                     `json:"id,required"`
	ModelType               param.Field[SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPriceModelType] `json:"model_type,required"`
	TieredWithMinimumConfig param.Field[map[string]interface{}]                                                     `json:"tiered_with_minimum_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPrice) MarshalJSON

type SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPriceModelTypeTieredWithMinimum SubscriptionNewParamsPriceOverridesOverrideTieredWithMinimumPriceModelType = "tiered_with_minimum"
)

type SubscriptionNewParamsPriceOverridesOverrideUnitPrice

type SubscriptionNewParamsPriceOverridesOverrideUnitPrice struct {
	ID         param.Field[string]                                                         `json:"id,required"`
	ModelType  param.Field[SubscriptionNewParamsPriceOverridesOverrideUnitPriceModelType]  `json:"model_type,required"`
	UnitConfig param.Field[SubscriptionNewParamsPriceOverridesOverrideUnitPriceUnitConfig] `json:"unit_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionNewParamsPriceOverridesOverrideUnitPrice) MarshalJSON

func (r SubscriptionNewParamsPriceOverridesOverrideUnitPrice) MarshalJSON() (data []byte, err error)

type SubscriptionNewParamsPriceOverridesOverrideUnitPriceModelType

type SubscriptionNewParamsPriceOverridesOverrideUnitPriceModelType string
const (
	SubscriptionNewParamsPriceOverridesOverrideUnitPriceModelTypeUnit SubscriptionNewParamsPriceOverridesOverrideUnitPriceModelType = "unit"
)

type SubscriptionNewParamsPriceOverridesOverrideUnitPriceUnitConfig

type SubscriptionNewParamsPriceOverridesOverrideUnitPriceUnitConfig struct {
	// Rate per unit of usage
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionNewParamsPriceOverridesOverrideUnitPriceUnitConfig) MarshalJSON

type SubscriptionPriceInterval

type SubscriptionPriceInterval struct {
	ID string `json:"id,required"`
	// The day of the month that Orb bills for this price
	BillingCycleDay int64 `json:"billing_cycle_day,required"`
	// The end of the current billing period. This is an exclusive timestamp, such that
	// the instant returned is exactly the end of the billing period. Set to null if
	// this price interval is not currently active.
	CurrentBillingPeriodEndDate time.Time `json:"current_billing_period_end_date,required,nullable" format:"date-time"`
	// The start date of the current billing period. This is an inclusive timestamp;
	// the instant returned is exactly the beginning of the billing period. Set to null
	// if this price interval is not currently active.
	CurrentBillingPeriodStartDate time.Time `json:"current_billing_period_start_date,required,nullable" format:"date-time"`
	// The end date of the price interval. This is the date that Orb stops billing for
	// this price.
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	// The fixed fee quantity transitions for this price interval. This is only
	// relevant for fixed fees.
	FixedFeeQuantityTransitions []SubscriptionPriceIntervalsFixedFeeQuantityTransition `json:"fixed_fee_quantity_transitions,required,nullable"`
	// The Price resource represents a price that can be billed on a subscription,
	// resulting in a charge on an invoice in the form of an invoice line item. Prices
	// take a quantity and determine an amount to bill.
	//
	// Orb supports a few different pricing models out of the box. Each of these models
	// is serialized differently in a given Price object. The model_type field
	// determines the key for the configuration object that is present.
	//
	// ## Unit pricing
	//
	// With unit pricing, each unit costs a fixed amount.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	        "unit_amount": "0.50"
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered pricing
	//
	// In tiered pricing, the cost of a given unit depends on the tier range that it
	// falls into, where each tier range is defined by an upper and lower bound. For
	// example, the first ten units may cost $0.50 each and all units thereafter may
	// cost $0.10 each.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "tiered",
	//	    "tiered_config": {
	//	        "tiers": [
	//	            {
	//	                "first_unit": 1,
	//	                "last_unit": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "first_unit": 11,
	//	                "last_unit": null,
	//	                "unit_amount": "0.10"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//
	// “`
	//
	// ## Bulk pricing
	//
	// Bulk pricing applies when the number of units determine the cost of all units.
	// For example, if you've bought less than 10 units, they may each be $0.50 for a
	// total of $5.00. Once you've bought more than 10 units, all units may now be
	// priced at $0.40 (i.e. 101 units total would be $40.40).
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bulk",
	//	    "bulk_config": {
	//	        "tiers": [
	//	            {
	//	                "maximum_units": 10,
	//	                "unit_amount": "0.50"
	//	            },
	//	            {
	//	                "maximum_units": 1000,
	//	                "unit_amount": "0.40"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Package pricing
	//
	// Package pricing defines the size or granularity of a unit for billing purposes.
	// For example, if the package size is set to 5, then 4 units will be billed as 5
	// and 6 units will be billed at 10.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "package",
	//	    "package_config": {
	//	        "package_amount": "0.80",
	//	        "package_size": 10
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## BPS pricing
	//
	// BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a
	// percent (the number of basis points to charge), as well as a cap per event to
	// assess. For example, this would allow you to assess a fee of 0.25% on every
	// payment you process, with a maximum charge of $25 per payment.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "model_type": "bps",
	//	    "bps_config": {
	//	       "bps": 125,
	//	       "per_unit_maximum": "11.00"
	//	    }
	//	    ...
	//	 }
	//
	// “`
	//
	// ## Bulk BPS pricing
	//
	// Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the
	// total quantity across all events. Similar to bulk pricing, the BPS parameters of
	// a given event depends on the tier range that the billing period falls into. Each
	// tier range is defined by an upper bound. For example, after $1.5M of payment
	// volume is reached, each individual payment may have a lower cap or a smaller
	// take-rate.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "bulk_bps",
	//	    "bulk_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Tiered BPS pricing
	//
	// Tiered BPS pricing specifies BPS parameters in a graduated manner, where an
	// event's applicable parameter is a function of its marginal addition to the
	// period total. Similar to tiered pricing, the BPS parameters of a given event
	// depends on the tier range that it falls into, where each tier range is defined
	// by an upper and lower bound. For example, the first few payments may have a 0.8
	// BPS take-rate and all payments after a specific volume may incur a take-rate of
	// 0.5 BPS each.
	//
	// “`json
	//
	//	    ...
	//	    "model_type": "tiered_bps",
	//	    "tiered_bps_config": {
	//	        "tiers": [
	//	           {
	//	                "minimum_amount": "0",
	//	                "maximum_amount": "1000000.00",
	//	                "bps": 125,
	//	                "per_unit_maximum": "19.00"
	//	           },
	//	          {
	//	                "minimum_amount": "1000000.00",
	//	                "maximum_amount": null,
	//	                "bps": 115,
	//	                "per_unit_maximum": "4.00"
	//	            }
	//	        ]
	//	    }
	//	    ...
	//	}
	//
	// “`
	//
	// ## Matrix pricing
	//
	// Matrix pricing defines a set of unit prices in a one or two-dimensional matrix.
	// `dimensions` defines the two event property values evaluated in this pricing
	// model. In a one-dimensional matrix, the second value is `null`. Every
	// configuration has a list of `matrix_values` which give the unit prices for
	// specified property values. In a one-dimensional matrix, the matrix values will
	// have `dimension_values` where the second value of the pair is null. If an event
	// does not match any of the dimension values in the matrix, it will resort to the
	// `default_unit_amount`.
	//
	// “`json
	//
	//	{
	//	    "model_type": "matrix"
	//	    "matrix_config": {
	//	        "default_unit_amount": "3.00",
	//	        "dimensions": [
	//	            "cluster_name",
	//	            "region"
	//	        ],
	//	        "matrix_values": [
	//	            {
	//	                "dimension_values": [
	//	                    "alpha",
	//	                    "west"
	//	                ],
	//	                "unit_amount": "2.00"
	//	            },
	//	            ...
	//	        ]
	//	    }
	//	}
	//
	// “`
	//
	// ### Fixed fees
	//
	// Fixed fees are prices that are applied independent of usage quantities, and
	// follow unit pricing. They also have an additional parameter
	// `fixed_price_quantity`. If the Price represents a fixed cost, this represents
	// the quantity of units applied.
	//
	// “`json
	//
	//	{
	//	    ...
	//	    "id": "price_id",
	//	    "model_type": "unit",
	//	    "unit_config": {
	//	       "unit_amount": "2.00"
	//	    },
	//	    "fixed_price_quantity": 3.0
	//	    ...
	//	}
	//
	// “`
	Price Price `json:"price,required"`
	// The start date of the price interval. This is the date that Orb starts billing
	// for this price.
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionPriceIntervalJSON
}

The Price Interval resource represents a period of time for which a price will bill on a subscription. A subscription’s price intervals define its billing behavior.

func (*SubscriptionPriceInterval) UnmarshalJSON

func (r *SubscriptionPriceInterval) UnmarshalJSON(data []byte) (err error)

type SubscriptionPriceIntervalsFixedFeeQuantityTransition

type SubscriptionPriceIntervalsFixedFeeQuantityTransition struct {
	EffectiveDate time.Time `json:"effective_date,required" format:"date"`
	PriceID       string    `json:"price_id,required"`
	Quantity      int64     `json:"quantity,required"`
	JSON          subscriptionPriceIntervalsFixedFeeQuantityTransitionJSON
}

func (*SubscriptionPriceIntervalsFixedFeeQuantityTransition) UnmarshalJSON

func (r *SubscriptionPriceIntervalsFixedFeeQuantityTransition) UnmarshalJSON(data []byte) (err error)

type SubscriptionPriceIntervalsParams

type SubscriptionPriceIntervalsParams struct {
	// A list of price intervals to add to the subscription.
	Add param.Field[[]SubscriptionPriceIntervalsParamsAdd] `json:"add"`
	// A list of price intervals to edit on the subscription.
	Edit param.Field[[]SubscriptionPriceIntervalsParamsEdit] `json:"edit"`
}

func (SubscriptionPriceIntervalsParams) MarshalJSON

func (r SubscriptionPriceIntervalsParams) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsAdd

type SubscriptionPriceIntervalsParamsAdd struct {
	// The start date of the price interval. This is the date that the price will start
	// billing on the subscription.
	StartDate param.Field[SubscriptionPriceIntervalsParamsAddStartDate] `json:"start_date,required" format:"date-time"`
	// A list of discounts to initialize on the price interval.
	Discounts param.Field[[]SubscriptionPriceIntervalsParamsAddDiscount] `json:"discounts"`
	// The end date of the price interval. This is the date that the price will stop
	// billing on the subscription.
	EndDate param.Field[SubscriptionPriceIntervalsParamsAddEndDate] `json:"end_date" format:"date-time"`
	// The external price id of the price to add to the subscription.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// A list of fixed fee quantity transitions to initialize on the price interval.
	FixedFeeQuantityTransitions param.Field[[]SubscriptionPriceIntervalsParamsAddFixedFeeQuantityTransition] `json:"fixed_fee_quantity_transitions"`
	// The maximum amount that will be billed for this price interval for a given
	// billing period.
	MaximumAmount param.Field[float64] `json:"maximum_amount"`
	// The minimum amount that will be billed for this price interval for a given
	// billing period.
	MinimumAmount param.Field[float64] `json:"minimum_amount"`
	// The definition of a new price to create and add to the subscription.
	Price param.Field[SubscriptionPriceIntervalsParamsAddPrice] `json:"price"`
	// The id of the price to add to the subscription.
	PriceID param.Field[string] `json:"price_id"`
}

func (SubscriptionPriceIntervalsParamsAdd) MarshalJSON

func (r SubscriptionPriceIntervalsParamsAdd) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParams

type SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParams struct {
	// Only available if discount_type is `amount`.
	AmountDiscount param.Field[float64]                                                                              `json:"amount_discount,required"`
	DiscountType   param.Field[SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParamsDiscountType] `json:"discount_type,required"`
}

func (SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParams) MarshalJSON

type SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParamsDiscountType

type SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParamsDiscountType string
const (
	SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParamsDiscountTypeAmount SubscriptionPriceIntervalsParamsAddDiscountsAmountDiscountCreationParamsDiscountType = "amount"
)

type SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParams

type SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParams struct {
	DiscountType param.Field[SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParamsDiscountType] `json:"discount_type,required"`
	// Only available if discount_type is `percentage`. This is a number between 0
	// and 1.
	PercentageDiscount param.Field[float64] `json:"percentage_discount,required"`
}

func (SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParams) MarshalJSON

type SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParamsDiscountType

type SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParamsDiscountType string
const (
	SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParamsDiscountTypePercentage SubscriptionPriceIntervalsParamsAddDiscountsPercentageDiscountCreationParamsDiscountType = "percentage"
)

type SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParams

type SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParams struct {
	DiscountType param.Field[SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParamsDiscountType] `json:"discount_type,required"`
	// Only available if discount_type is `usage`. Number of usage units that this
	// discount is for.
	UsageDiscount param.Field[float64] `json:"usage_discount,required"`
}

func (SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParams) MarshalJSON

type SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParamsDiscountType

type SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParamsDiscountType string
const (
	SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParamsDiscountTypeUsage SubscriptionPriceIntervalsParamsAddDiscountsUsageDiscountCreationParamsDiscountType = "usage"
)

type SubscriptionPriceIntervalsParamsAddEndDate

type SubscriptionPriceIntervalsParamsAddEndDate interface {
	ImplementsSubscriptionPriceIntervalsParamsAddEndDate()
}

The end date of the price interval. This is the date that the price will stop billing on the subscription.

Satisfied by shared.UnionTime, SubscriptionPriceIntervalsParamsAddEndDateString.

type SubscriptionPriceIntervalsParamsAddEndDateString

type SubscriptionPriceIntervalsParamsAddEndDateString string
const (
	SubscriptionPriceIntervalsParamsAddEndDateStringStartOfTerm SubscriptionPriceIntervalsParamsAddEndDateString = "start_of_term"
	SubscriptionPriceIntervalsParamsAddEndDateStringEndOfTerm   SubscriptionPriceIntervalsParamsAddEndDateString = "end_of_term"
)

type SubscriptionPriceIntervalsParamsAddFixedFeeQuantityTransition

type SubscriptionPriceIntervalsParamsAddFixedFeeQuantityTransition struct {
	// The date that the fixed fee quantity transition should take effect.
	EffectiveDate param.Field[time.Time] `json:"effective_date,required" format:"date"`
	// The quantity of the fixed fee quantity transition.
	Quantity param.Field[int64] `json:"quantity,required"`
}

func (SubscriptionPriceIntervalsParamsAddFixedFeeQuantityTransition) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPrice

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPrice struct {
	BpsConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceBpsConfig] `json:"bps_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                       `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBpsPrice) MarshalJSON

func (r SubscriptionPriceIntervalsParamsAddPriceNewBpsPrice) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceBpsConfig

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceBpsConfig struct {
	// Basis point take rate per event
	Bps param.Field[float64] `json:"bps,required"`
	// Optional currency amount maximum to cap spend per event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceBpsConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceModelTypeBps SubscriptionPriceIntervalsParamsAddPriceNewBpsPriceModelType = "bps"
)

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPrice

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPrice struct {
	BulkBpsConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfig] `json:"bulk_bps_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                           `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfig

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfig struct {
	// Tiers for a bulk BPS pricing model where all usage is aggregated to a single
	// tier based on total volume
	Tiers param.Field[[]SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfigTier

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfigTier struct {
	// Basis points to rate on
	Bps param.Field[float64] `json:"bps,required"`
	// Upper bound for tier
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The maximum amount to charge for any one event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceBulkBpsConfigTier) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceModelTypeBulkBps SubscriptionPriceIntervalsParamsAddPriceNewBulkBpsPriceModelType = "bulk_bps"
)

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPrice

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPrice struct {
	BulkConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfig] `json:"bulk_config,required"`
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                        `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkPrice) MarshalJSON

func (r SubscriptionPriceIntervalsParamsAddPriceNewBulkPrice) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfig

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfig struct {
	// Bulk tiers for rating based on total usage volume
	Tiers param.Field[[]SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfigTier] `json:"tiers,required"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfigTier

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfigTier struct {
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Upper bound for this tier
	MaximumUnits param.Field[float64] `json:"maximum_units"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceBulkConfigTier) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceModelTypeBulk SubscriptionPriceIntervalsParamsAddPriceNewBulkPriceModelType = "bulk"
)

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPrice

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID       param.Field[string]                                                             `json:"item_id,required"`
	MatrixConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfig] `json:"matrix_config,required"`
	ModelType    param.Field[SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceModelType]    `json:"model_type,required"`
	// The name of the price.
	Name param.Field[string] `json:"name,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewMatrixPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfig

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfig struct {
	// Default per unit rate for any usage not bucketed into a specified matrix_value
	DefaultUnitAmount param.Field[string] `json:"default_unit_amount,required"`
	// One or two event property values to evaluate matrix groups by
	Dimensions param.Field[[]string] `json:"dimensions,required"`
	// Matrix values for specified matrix grouping keys
	MatrixValues param.Field[[]SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfigMatrixValue] `json:"matrix_values,required"`
	// Default optional multiplier to scale rated quantities that fall into the default
	// bucket by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfigMatrixValue

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfigMatrixValue struct {
	// One or two matrix keys to filter usage to this Matrix value by. For example,
	// ["region", "tier"] could be used to filter cloud usage by a cloud region and an
	// instance tier.
	DimensionValues param.Field[[]string] `json:"dimension_values,required"`
	// Unit price for the specified dimension_values
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Optional multiplier to scale rated quantities by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceMatrixConfigMatrixValue) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceModelTypeMatrix SubscriptionPriceIntervalsParamsAddPriceNewMatrixPriceModelType = "matrix"
)

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePrice

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                           `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name          param.Field[string]                                                               `json:"name,required"`
	PackageConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewPackagePricePackageConfig] `json:"package_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewPackagePrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceModelTypePackage SubscriptionPriceIntervalsParamsAddPriceNewPackagePriceModelType = "package"
)

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePricePackageConfig

type SubscriptionPriceIntervalsParamsAddPriceNewPackagePricePackageConfig struct {
	// A currency amount to rate usage by
	PackageAmount param.Field[string] `json:"package_amount,required"`
	// An integer amount to represent package size. For example, 1000 here would divide
	// usage by 1000 before multiplying by package_amount in rating
	PackageSize param.Field[int64] `json:"package_size"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewPackagePricePackageConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPrice

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                                         `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                        param.Field[string]                 `json:"name,required"`
	PackageWithAllocationConfig param.Field[map[string]interface{}] `json:"package_with_allocation_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceModelTypePackageWithAllocation SubscriptionPriceIntervalsParamsAddPriceNewPackageWithAllocationPriceModelType = "package_with_allocation"
)

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPrice

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                                        `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                       param.Field[string]                 `json:"name,required"`
	ThresholdTotalAmountConfig param.Field[map[string]interface{}] `json:"threshold_total_amount_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceModelTypeThresholdTotalAmount SubscriptionPriceIntervalsParamsAddPriceNewThresholdTotalAmountPriceModelType = "threshold_total_amount"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPrice

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                             `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name            param.Field[string]                                                                   `json:"name,required"`
	TieredBpsConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfig] `json:"tiered_bps_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceModelTypeTieredBps SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceModelType = "tiered_bps"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfig

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfig struct {
	// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified
	// tiers
	Tiers param.Field[[]SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfigTier

type SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfigTier struct {
	// Per-event basis point rate
	Bps param.Field[float64] `json:"bps,required"`
	// Inclusive tier starting value
	MinimumAmount param.Field[string] `json:"minimum_amount,required"`
	// Exclusive tier ending value
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// Per unit maximum to charge
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredBpsPriceTieredBpsConfigTier) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePrice

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                                 `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                param.Field[string]                 `json:"name,required"`
	TieredPackageConfig param.Field[map[string]interface{}] `json:"tiered_package_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceModelTypeTieredPackage SubscriptionPriceIntervalsParamsAddPriceNewTieredPackagePriceModelType = "tiered_package"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPrice

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                          `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name         param.Field[string]                                                             `json:"name,required"`
	TieredConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfig] `json:"tiered_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceModelTypeTiered SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceModelType = "tiered"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfig

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfig struct {
	// Tiers for rating based on total usage quantities into the specified tier
	Tiers param.Field[[]SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfigTier] `json:"tiers,required"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfigTier

type SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfigTier struct {
	// Inclusive tier starting value
	FirstUnit param.Field[float64] `json:"first_unit,required"`
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Exclusive tier ending value. If null, this is treated as the last tier
	LastUnit param.Field[float64] `json:"last_unit"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredPriceTieredConfigTier) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPrice

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                                     `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name                    param.Field[string]                 `json:"name,required"`
	TieredWithMinimumConfig param.Field[map[string]interface{}] `json:"tiered_with_minimum_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPrice) MarshalJSON

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceModelTypeTieredWithMinimum SubscriptionPriceIntervalsParamsAddPriceNewTieredWithMinimumPriceModelType = "tiered_with_minimum"
)

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPrice

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPrice struct {
	// The cadence to bill for this price on.
	Cadence param.Field[SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence] `json:"cadence,required"`
	// An ISO 4217 currency string for which this price is billed in.
	Currency param.Field[string] `json:"currency,required"`
	// The id of the item the plan will be associated with.
	ItemID    param.Field[string]                                                        `json:"item_id,required"`
	ModelType param.Field[SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceModelType] `json:"model_type,required"`
	// The name of the price.
	Name       param.Field[string]                                                         `json:"name,required"`
	UnitConfig param.Field[SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceUnitConfig] `json:"unit_config,required"`
	// The id of the billable metric for the price. Only needed if the price is
	// usage-based.
	BillableMetricID param.Field[string] `json:"billable_metric_id"`
	// If the Price represents a fixed cost, the price will be billed in-advance if
	// this is true, and in-arrears if this is false.
	BilledInAdvance param.Field[bool] `json:"billed_in_advance"`
	// An alias for the price.
	ExternalPriceID param.Field[string] `json:"external_price_id"`
	// If the Price represents a fixed cost, this represents the quantity of units
	// applied.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The property used to group this price on an invoice
	InvoiceGroupingKey param.Field[string] `json:"invoice_grouping_key"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewUnitPrice) MarshalJSON

func (r SubscriptionPriceIntervalsParamsAddPriceNewUnitPrice) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence string

The cadence to bill for this price on.

const (
	SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadenceAnnual    SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence = "annual"
	SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadenceMonthly   SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence = "monthly"
	SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadenceQuarterly SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceCadence = "quarterly"
)

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceModelType

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceModelType string
const (
	SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceModelTypeUnit SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceModelType = "unit"
)

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceUnitConfig

type SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceUnitConfig struct {
	// Rate per unit of usage
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionPriceIntervalsParamsAddPriceNewUnitPriceUnitConfig) MarshalJSON

type SubscriptionPriceIntervalsParamsAddStartDate

type SubscriptionPriceIntervalsParamsAddStartDate interface {
	ImplementsSubscriptionPriceIntervalsParamsAddStartDate()
}

The start date of the price interval. This is the date that the price will start billing on the subscription.

Satisfied by shared.UnionTime, SubscriptionPriceIntervalsParamsAddStartDateString.

type SubscriptionPriceIntervalsParamsAddStartDateString

type SubscriptionPriceIntervalsParamsAddStartDateString string
const (
	SubscriptionPriceIntervalsParamsAddStartDateStringStartOfTerm SubscriptionPriceIntervalsParamsAddStartDateString = "start_of_term"
	SubscriptionPriceIntervalsParamsAddStartDateStringEndOfTerm   SubscriptionPriceIntervalsParamsAddStartDateString = "end_of_term"
)

type SubscriptionPriceIntervalsParamsEdit

type SubscriptionPriceIntervalsParamsEdit struct {
	// The id of the price interval to edit.
	PriceIntervalID param.Field[string] `json:"price_interval_id,required"`
	// The updated end date of this price interval. If not specified, the start date
	// will not be updated.
	EndDate param.Field[SubscriptionPriceIntervalsParamsEditEndDate] `json:"end_date" format:"date-time"`
	// A list of fixed fee quantity transitions to use for this price interval. Note
	// that this list will overwrite all existing fixed fee quantity transitions on the
	// price interval.
	FixedFeeQuantityTransitions param.Field[[]SubscriptionPriceIntervalsParamsEditFixedFeeQuantityTransition] `json:"fixed_fee_quantity_transitions"`
	// The updated start date of this price interval. If not specified, the start date
	// will not be updated.
	StartDate param.Field[SubscriptionPriceIntervalsParamsEditStartDate] `json:"start_date" format:"date-time"`
}

func (SubscriptionPriceIntervalsParamsEdit) MarshalJSON

func (r SubscriptionPriceIntervalsParamsEdit) MarshalJSON() (data []byte, err error)

type SubscriptionPriceIntervalsParamsEditEndDate

type SubscriptionPriceIntervalsParamsEditEndDate interface {
	ImplementsSubscriptionPriceIntervalsParamsEditEndDate()
}

The updated end date of this price interval. If not specified, the start date will not be updated.

Satisfied by shared.UnionTime, SubscriptionPriceIntervalsParamsEditEndDateString.

type SubscriptionPriceIntervalsParamsEditEndDateString

type SubscriptionPriceIntervalsParamsEditEndDateString string
const (
	SubscriptionPriceIntervalsParamsEditEndDateStringStartOfTerm SubscriptionPriceIntervalsParamsEditEndDateString = "start_of_term"
	SubscriptionPriceIntervalsParamsEditEndDateStringEndOfTerm   SubscriptionPriceIntervalsParamsEditEndDateString = "end_of_term"
)

type SubscriptionPriceIntervalsParamsEditFixedFeeQuantityTransition

type SubscriptionPriceIntervalsParamsEditFixedFeeQuantityTransition struct {
	// The date that the fixed fee quantity transition should take effect.
	EffectiveDate param.Field[time.Time] `json:"effective_date,required" format:"date"`
	// The quantity of the fixed fee quantity transition.
	Quantity param.Field[int64] `json:"quantity,required"`
}

func (SubscriptionPriceIntervalsParamsEditFixedFeeQuantityTransition) MarshalJSON

type SubscriptionPriceIntervalsParamsEditStartDate

type SubscriptionPriceIntervalsParamsEditStartDate interface {
	ImplementsSubscriptionPriceIntervalsParamsEditStartDate()
}

The updated start date of this price interval. If not specified, the start date will not be updated.

Satisfied by shared.UnionTime, SubscriptionPriceIntervalsParamsEditStartDateString.

type SubscriptionPriceIntervalsParamsEditStartDateString

type SubscriptionPriceIntervalsParamsEditStartDateString string
const (
	SubscriptionPriceIntervalsParamsEditStartDateStringStartOfTerm SubscriptionPriceIntervalsParamsEditStartDateString = "start_of_term"
	SubscriptionPriceIntervalsParamsEditStartDateStringEndOfTerm   SubscriptionPriceIntervalsParamsEditStartDateString = "end_of_term"
)

type SubscriptionRedeemedCoupon

type SubscriptionRedeemedCoupon struct {
	CouponID  string    `json:"coupon_id,required"`
	EndDate   time.Time `json:"end_date,required,nullable" format:"date-time"`
	StartDate time.Time `json:"start_date,required" format:"date-time"`
	JSON      subscriptionRedeemedCouponJSON
}

func (*SubscriptionRedeemedCoupon) UnmarshalJSON

func (r *SubscriptionRedeemedCoupon) UnmarshalJSON(data []byte) (err error)

type SubscriptionSchedulePlanChangeParams

type SubscriptionSchedulePlanChangeParams struct {
	ChangeOption param.Field[SubscriptionSchedulePlanChangeParamsChangeOption] `json:"change_option,required"`
	// [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be
	// aligned with the plan change’s effective date.
	AlignBillingWithPlanChangeDate param.Field[bool] `json:"align_billing_with_plan_change_date"`
	// Reset billing periods to be aligned with the plan change’s effective date or
	// start of the month. Defaults to `unchanged` which keeps subscription's existing
	// billing cycle alignment.
	BillingCycleAlignment param.Field[SubscriptionSchedulePlanChangeParamsBillingCycleAlignment] `json:"billing_cycle_alignment"`
	// The date that the plan change should take effect. This parameter can only be
	// passed if the `change_option` is `requested_date`.
	ChangeDate param.Field[string] `json:"change_date"`
	// Redemption code to be used for this subscription. If the coupon cannot be found
	// by its redemption code, or cannot be redeemed, an error response will be
	// returned and the plan change will not be scheduled.
	CouponRedemptionCode param.Field[string]  `json:"coupon_redemption_code"`
	CreditsOverageRate   param.Field[float64] `json:"credits_overage_rate"`
	// The external_plan_id of the plan that the given subscription should be switched
	// to. Note that either this property or `plan_id` must be specified.
	ExternalPlanID param.Field[string] `json:"external_plan_id"`
	// The phase of the plan to start with
	InitialPhaseOrder param.Field[int64] `json:"initial_phase_order"`
	// When this subscription's accrued usage reaches this threshold, an invoice will
	// be issued for the subscription. If not specified, invoices will only be issued
	// at the end of the billing period.
	InvoicingThreshold     param.Field[string] `json:"invoicing_threshold"`
	PerCreditOverageAmount param.Field[string] `json:"per_credit_overage_amount"`
	// The plan that the given subscription should be switched to. Note that either
	// this property or `external_plan_id` must be specified.
	PlanID param.Field[string] `json:"plan_id"`
	// Optionally provide a list of overrides for prices on the plan
	PriceOverrides param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverride] `json:"price_overrides"`
}

func (SubscriptionSchedulePlanChangeParams) MarshalJSON

func (r SubscriptionSchedulePlanChangeParams) MarshalJSON() (data []byte, err error)

type SubscriptionSchedulePlanChangeParamsBillingCycleAlignment

type SubscriptionSchedulePlanChangeParamsBillingCycleAlignment string

Reset billing periods to be aligned with the plan change’s effective date or start of the month. Defaults to `unchanged` which keeps subscription's existing billing cycle alignment.

const (
	SubscriptionSchedulePlanChangeParamsBillingCycleAlignmentUnchanged      SubscriptionSchedulePlanChangeParamsBillingCycleAlignment = "unchanged"
	SubscriptionSchedulePlanChangeParamsBillingCycleAlignmentPlanChangeDate SubscriptionSchedulePlanChangeParamsBillingCycleAlignment = "plan_change_date"
	SubscriptionSchedulePlanChangeParamsBillingCycleAlignmentStartOfMonth   SubscriptionSchedulePlanChangeParamsBillingCycleAlignment = "start_of_month"
)

type SubscriptionSchedulePlanChangeParamsChangeOption

type SubscriptionSchedulePlanChangeParamsChangeOption string
const (
	SubscriptionSchedulePlanChangeParamsChangeOptionRequestedDate         SubscriptionSchedulePlanChangeParamsChangeOption = "requested_date"
	SubscriptionSchedulePlanChangeParamsChangeOptionEndOfSubscriptionTerm SubscriptionSchedulePlanChangeParamsChangeOption = "end_of_subscription_term"
	SubscriptionSchedulePlanChangeParamsChangeOptionImmediate             SubscriptionSchedulePlanChangeParamsChangeOption = "immediate"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPrice struct {
	ID        param.Field[string]                                                                      `json:"id,required"`
	BpsConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceBpsConfig] `json:"bps_config,required"`
	ModelType param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceModelType] `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceBpsConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceBpsConfig struct {
	// Basis point take rate per event
	Bps param.Field[float64] `json:"bps,required"`
	// Optional currency amount maximum to cap spend per event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceBpsConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceModelTypeBps SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBpsPriceModelType = "bps"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPrice struct {
	ID            param.Field[string]                                                                              `json:"id,required"`
	BulkBpsConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig] `json:"bulk_bps_config,required"`
	ModelType     param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceModelType]     `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig struct {
	// Tiers for a bulk BPS pricing model where all usage is aggregated to a single
	// tier based on total volume
	Tiers param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier struct {
	// Basis points to rate on
	Bps param.Field[float64] `json:"bps,required"`
	// Upper bound for tier
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The maximum amount to charge for any one event
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceBulkBpsConfigTier) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceModelTypeBulkBps SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkBpsPriceModelType = "bulk_bps"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPrice struct {
	ID         param.Field[string]                                                                        `json:"id,required"`
	BulkConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfig] `json:"bulk_config,required"`
	ModelType  param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceModelType]  `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfig struct {
	// Bulk tiers for rating based on total usage volume
	Tiers param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfigTier] `json:"tiers,required"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfigTier

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfigTier struct {
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Upper bound for this tier
	MaximumUnits param.Field[float64] `json:"maximum_units"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceBulkConfigTier) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceModelTypeBulk SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideBulkPriceModelType = "bulk"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePrice struct {
	ID                    param.Field[string]                                                                                  `json:"id,required"`
	FivetranExampleConfig param.Field[map[string]interface{}]                                                                  `json:"fivetran_example_config,required"`
	ModelType             param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePriceModelType] `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePriceModelTypeFivetranExample SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideFivetranExamplePriceModelType = "fivetran_example"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPrice struct {
	ID           param.Field[string]                                                                            `json:"id,required"`
	MatrixConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfig] `json:"matrix_config,required"`
	ModelType    param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceModelType]    `json:"model_type,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfig struct {
	// Default per unit rate for any usage not bucketed into a specified matrix_value
	DefaultUnitAmount param.Field[string] `json:"default_unit_amount,required"`
	// One or two event property values to evaluate matrix groups by
	Dimensions param.Field[[]string] `json:"dimensions,required"`
	// Matrix values for specified matrix grouping keys
	MatrixValues param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue] `json:"matrix_values,required"`
	// Default optional multiplier to scale rated quantities that fall into the default
	// bucket by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue struct {
	// One or two matrix keys to filter usage to this Matrix value by. For example,
	// ["region", "tier"] could be used to filter cloud usage by a cloud region and an
	// instance tier.
	DimensionValues param.Field[[]string] `json:"dimension_values,required"`
	// Unit price for the specified dimension_values
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Optional multiplier to scale rated quantities by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceMatrixConfigMatrixValue) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceModelTypeMatrix SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideMatrixPriceModelType = "matrix"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePrice struct {
	ID            param.Field[string]                                                                              `json:"id,required"`
	ModelType     param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePriceModelType]     `json:"model_type,required"`
	PackageConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePricePackageConfig] `json:"package_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePriceModelTypePackage SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePriceModelType = "package"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePricePackageConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePricePackageConfig struct {
	// A currency amount to rate usage by
	PackageAmount param.Field[string] `json:"package_amount,required"`
	// An integer amount to represent package size. For example, 1000 here would divide
	// usage by 1000 before multiplying by package_amount in rating
	PackageSize param.Field[int64] `json:"package_size"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackagePricePackageConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPrice struct {
	ID                          param.Field[string]                                                                                        `json:"id,required"`
	ModelType                   param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPriceModelType] `json:"model_type,required"`
	PackageWithAllocationConfig param.Field[map[string]interface{}]                                                                        `json:"package_with_allocation_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPriceModelTypePackageWithAllocation SubscriptionSchedulePlanChangeParamsPriceOverridesOverridePackageWithAllocationPriceModelType = "package_with_allocation"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPrice struct {
	ID                       param.Field[string]                                                                                     `json:"id,required"`
	ModelType                param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPriceModelType] `json:"model_type,required"`
	TestRatingFunctionConfig param.Field[map[string]interface{}]                                                                     `json:"test_rating_function_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPriceModelTypeTestRatingFunction SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTestRatingFunctionPriceModelType = "test_rating_function"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPrice struct {
	ID                         param.Field[string]                                                                                       `json:"id,required"`
	ModelType                  param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType] `json:"model_type,required"`
	ThresholdTotalAmountConfig param.Field[map[string]interface{}]                                                                       `json:"threshold_total_amount_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPriceModelTypeThresholdTotalAmount SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideThresholdTotalAmountPriceModelType = "threshold_total_amount"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPrice struct {
	ID              param.Field[string]                                                                                  `json:"id,required"`
	ModelType       param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceModelType]       `json:"model_type,required"`
	TieredBpsConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig] `json:"tiered_bps_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceModelTypeTieredBps SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceModelType = "tiered_bps"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig struct {
	// Tiers for a Graduated BPS pricing model, where usage is bucketed into specified
	// tiers
	Tiers param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier] `json:"tiers,required"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier struct {
	// Per-event basis point rate
	Bps param.Field[float64] `json:"bps,required"`
	// Inclusive tier starting value
	MinimumAmount param.Field[string] `json:"minimum_amount,required"`
	// Exclusive tier ending value
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// Per unit maximum to charge
	PerUnitMaximum param.Field[string] `json:"per_unit_maximum"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredBpsPriceTieredBpsConfigTier) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePrice struct {
	ID                  param.Field[string]                                                                                `json:"id,required"`
	ModelType           param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePriceModelType] `json:"model_type,required"`
	TieredPackageConfig param.Field[map[string]interface{}]                                                                `json:"tiered_package_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePriceModelTypeTieredPackage SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPackagePriceModelType = "tiered_package"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPrice struct {
	ID           param.Field[string]                                                                            `json:"id,required"`
	ModelType    param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceModelType]    `json:"model_type,required"`
	TieredConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfig] `json:"tiered_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceModelTypeTiered SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceModelType = "tiered"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfig struct {
	// Tiers for rating based on total usage quantities into the specified tier
	Tiers param.Field[[]SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfigTier] `json:"tiers,required"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfig) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfigTier

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfigTier struct {
	// Inclusive tier starting value
	FirstUnit param.Field[float64] `json:"first_unit,required"`
	// Amount per unit
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Exclusive tier ending value. If null, this is treated as the last tier
	LastUnit param.Field[float64] `json:"last_unit"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredPriceTieredConfigTier) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPrice struct {
	ID                      param.Field[string]                                                                                    `json:"id,required"`
	ModelType               param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPriceModelType] `json:"model_type,required"`
	TieredWithMinimumConfig param.Field[map[string]interface{}]                                                                    `json:"tiered_with_minimum_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPriceModelTypeTieredWithMinimum SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideTieredWithMinimumPriceModelType = "tiered_with_minimum"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPrice

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPrice struct {
	ID         param.Field[string]                                                                        `json:"id,required"`
	ModelType  param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceModelType]  `json:"model_type,required"`
	UnitConfig param.Field[SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceUnitConfig] `json:"unit_config,required"`
	// The subscription's override discount for the plan.
	Discount param.Field[DiscountParam] `json:"discount"`
	// The starting quantity of the price, if the price is a fixed price.
	FixedPriceQuantity param.Field[float64] `json:"fixed_price_quantity"`
	// The subscription's override maximum amount for the plan.
	MaximumAmount param.Field[string] `json:"maximum_amount"`
	// The subscription's override minimum amount for the plan.
	MinimumAmount param.Field[string] `json:"minimum_amount"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPrice) MarshalJSON

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceModelType

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceModelType string
const (
	SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceModelTypeUnit SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceModelType = "unit"
)

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceUnitConfig

type SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceUnitConfig struct {
	// Rate per unit of usage
	UnitAmount param.Field[string] `json:"unit_amount,required"`
	// Multiplier to scale rated quantity by
	ScalingFactor param.Field[float64] `json:"scaling_factor"`
}

func (SubscriptionSchedulePlanChangeParamsPriceOverridesOverrideUnitPriceUnitConfig) MarshalJSON

type SubscriptionService

type SubscriptionService struct {
	Options []option.RequestOption
}

SubscriptionService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSubscriptionService method instead.

func NewSubscriptionService

func NewSubscriptionService(opts ...option.RequestOption) (r *SubscriptionService)

NewSubscriptionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SubscriptionService) Cancel

func (r *SubscriptionService) Cancel(ctx context.Context, subscriptionID string, body SubscriptionCancelParams, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to cancel an existing subscription. It returns the serialized subscription object with an `end_date` parameter that signifies when the subscription will transition to an ended state.

The body parameter `cancel_option` determines the cancellation behavior. Orb supports three cancellation options:

  • `end_of_subscription_term`: stops the subscription from auto-renewing. Subscriptions that have been cancelled with this option can still incur charges for the remainder of their term:

  • Issuing this cancellation request for a monthly subscription will keep the subscription active until the start of the subsequent month, and potentially issue an invoice for any usage charges incurred in the intervening period.

  • Issuing this cancellation request for a quarterly subscription will keep the subscription active until the end of the quarter and potentially issue an invoice for any usage charges incurred in the intervening period.

  • Issuing this cancellation request for a yearly subscription will keep the subscription active for the full year. For example, a yearly subscription starting on 2021-11-01 and cancelled on 2021-12-08 will remain active until 2022-11-01 and potentially issue charges in the intervening months for any recurring monthly usage charges in its plan.

  • **Note**: If a subscription's plan contains prices with difference cadences, the end of term date will be determined by the largest cadence value. For example, cancelling end of term for a subscription with a quarterly fixed fee with a monthly usage fee will result in the subscription ending at the end of the quarter.

  • `immediate`: ends the subscription immediately, setting the `end_date` to the current time:

  • Subscriptions that have been cancelled with this option will be invoiced immediately. This invoice will include any usage fees incurred in the billing period up to the cancellation, along with any prorated recurring fees for the billing period, if applicable.

  • **Note**: If the subscription has a recurring fee that was paid in-advance, the prorated amount for the remaining time period will be added to the [customer's balance](list-balance-transactions) upon immediate cancellation. However, if the customer is ineligible to use the customer balance, the subscription cannot be cancelled immediately.

  • `requested_date`: ends the subscription on a specified date, which requires a `cancellation_date` to be passed in. If no timezone is provided, the customer's timezone is used. For example, a subscription starting on January 1st with a monthly price can be set to be cancelled on the first of any month after January 1st (e.g. March 1st, April 1st, May 1st). A subscription with multiple prices with different cadences defines the "term" to be the highest cadence of the prices.

Upcoming subscriptions are only eligible for immediate cancellation, which will set the `end_date` equal to the `start_date` upon cancellation.

## Backdated cancellations

Orb allows you to cancel a subscription in the past as long as there are no paid invoices between the `requested_date` and the current time. If the cancellation is after the latest issued invoice, Orb will generate a balance refund for the current period. If the cancellation is before the most recently issued invoice, Orb will void the intervening invoice and generate a new one based on the new dates for the subscription. See the section on [cancellation behaviors](../guides/product-catalog/creating-subscriptions.md#cancellation-behaviors).

func (*SubscriptionService) Fetch

func (r *SubscriptionService) Fetch(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint is used to fetch a Subscription(../guides/concepts#subscription) given an identifier.

func (*SubscriptionService) FetchCosts

This endpoint is used to fetch a day-by-day snapshot of a subscription's costs in Orb, calculated by applying pricing information to the underlying usage (see the [subscription usage endpoint](fetch-subscription-usage) to fetch usage per metric, in usage units rather than a currency).

The semantics of this endpoint exactly mirror those of [fetching a customer's costs](fetch-customer-costs). Use this endpoint to limit your analysis of costs to a specific subscription for the customer (e.g. to de-aggregate costs when a customer's subscription has started and stopped on the same day).

func (*SubscriptionService) FetchSchedule

This endpoint returns a [paginated](../reference/pagination) list of all plans associated with a subscription along with their start and end dates. This list contains the subscription's initial plan along with past and future plan changes.

func (*SubscriptionService) FetchScheduleAutoPaging

This endpoint returns a [paginated](../reference/pagination) list of all plans associated with a subscription along with their start and end dates. This list contains the subscription's initial plan along with past and future plan changes.

func (*SubscriptionService) FetchUsage

func (r *SubscriptionService) FetchUsage(ctx context.Context, subscriptionID string, query SubscriptionFetchUsageParams, opts ...option.RequestOption) (res *SubscriptionUsage, err error)

This endpoint is used to fetch a subscription's usage in Orb. Especially when combined with optional query parameters, this endpoint is a powerful way to build visualizations on top of Orb's event data and metrics.

With no query parameters specified, this endpoint returns usage for the subscription's _current billing period_ across each billable metric that participates in the subscription. Usage quantities returned are the result of evaluating the metric definition for the entirety of the customer's billing period.

### Default response shape

Orb returns a `data` array with an object corresponding to each billable metric. Nested within this object is a `usage` array which has a `quantity` value and a corresponding `timeframe_start` and `timeframe_end`. The `quantity` value represents the calculated usage value for the billable metric over the specified timeframe (inclusive of the `timeframe_start` timestamp and exclusive of the `timeframe_end` timestamp).

Orb will include _every_ window in the response starting from the beginning of the billing period, even when there were no events (and therefore no usage) in the window. This increases the size of the response but prevents the caller from filling in gaps and handling cumbersome time-based logic.

The query parameters in this endpoint serve to override this behavior and provide some key functionality, as listed below. Note that this functionality can also be used _in conjunction_ with each other, e.g. to display grouped usage on a custom timeframe.

## Custom timeframe

In order to view usage for a custom timeframe rather than the current billing period, specify a `timeframe_start` and `timeframe_end`. This will calculate quantities for usage incurred between timeframe_start (inclusive) and timeframe_end (exclusive), i.e. `[timeframe_start, timeframe_end)`.

Note:

  • These timestamps must be specified in ISO 8601 format and UTC timezone, e.g. `2022-02-01T05:00:00Z`.
  • Both parameters must be specified if either is specified.

## Grouping by custom attributes

In order to view a single metric grouped by a specific _attribute_ that each event is tagged with (e.g. `cluster`), you must additionally specify a `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event property on which to group.

When returning grouped usage, only usage for `billable_metric_id` is returned, and a separate object in the `data` array is returned for each value of the `group_by` key present in your events. The `quantity` value is the result of evaluating the billable metric for events filtered to a single value of the `group_by` key.

Orb expects that events that match the billable metric will contain values in the `properties` dictionary that correspond to the `group_by` key specified. By default, Orb will not return a `null` group (i.e. events that match the metric but do not have the key set). Currently, it is only possible to view usage grouped by a single attribute at a time.

When viewing grouped usage, Orb uses pagination to limit the response size to 1000 groups by default. If there are more groups for a given subscription, pagination metadata in the response can be used to fetch all of the data.

The following example shows usage for an "API Requests" billable metric grouped by `region`. Note the extra `metric_group` dictionary in the response, which provides metadata about the group:

```json

{
    "data": [
        {
            "usage": [
                {
                    "quantity": 0.19291,
                    "timeframe_start": "2021-10-01T07:00:00Z",
                    "timeframe_end": "2021-10-02T07:00:00Z",
                },
                ...
            ],
            "metric_group": {
                "property_key": "region",
                "property_value": "asia/pacific"
            },
            "billable_metric": {
                "id": "Fe9pbpMk86xpwdGB",
                "name": "API Requests"
            },
            "view_mode": "periodic"
        },
        ...
    ]
}

```

## Windowed usage

The `granularity` parameter can be used to _window_ the usage `quantity` value into periods. When not specified, usage is returned for the entirety of the time range.

When `granularity = day` is specified with a timeframe longer than a day, Orb will return a `quantity` value for each full day between `timeframe_start` and `timeframe_end`. Note that the days are demarcated by the _customer's local midnight_.

For example, with `timeframe_start = 2022-02-01T05:00:00Z`, `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`, the following windows will be returned for a customer in the `America/Los_Angeles` timezone since local midnight is `08:00` UTC:

- `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)` - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)` - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)` - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`

```json

{
    "data": [
        {
            "billable_metric": {
                "id": "Q8w89wjTtBdejXKsm",
                "name": "API Requests"
            },
            "usage": [
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-01T08:00:00+00:00",
                    "timeframe_start": "2022-02-01T05:00:00+00:00"
                },
                {

                    "quantity": 0,
                    "timeframe_end": "2022-02-02T08:00:00+00:00",
                    "timeframe_start": "2022-02-01T08:00:00+00:00"
                },
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-03T08:00:00+00:00",
                    "timeframe_start": "2022-02-02T08:00:00+00:00"
                },
                {
                    "quantity": 0,
                    "timeframe_end": "2022-02-04T01:00:00+00:00",
                    "timeframe_start": "2022-02-03T08:00:00+00:00"
                }
            ],
            "view_mode": "periodic"
        },
        ...
    ]
}

```

## Decomposable vs. non-decomposable metrics

Billable metrics fall into one of two categories: decomposable and non-decomposable. A decomposable billable metric, such as a sum or a count, can be displayed and aggregated across arbitrary timescales. On the other hand, a non-decomposable metric is not meaningful when only a slice of the billing window is considered.

As an example, if we have a billable metric that's defined to count unique users, displaying a graph of unique users for each day is not representative of the billable metric value over the month (days could have an overlapping set of 'unique' users). Instead, what's useful for any given day is the number of unique users in the billing period so far, which are the _cumulative_ unique users.

Accordingly, this endpoint returns treats these two types of metrics differently when `group_by` is specified:

  • Decomposable metrics can be grouped by any event property.
  • Non-decomposable metrics can only be grouped by the corresponding price's invoice grouping key. If no invoice grouping key is present, the metric does not support `group_by`.

## Matrix prices

When a billable metric is attached to a price that uses matrix pricing, it's important to view usage grouped by those matrix dimensions. In this case, use the query parameters `first_dimension_key`, `first_dimension_value` and `second_dimension_key`, `second_dimension_value` while filtering to a specific `billable_metric_id`.

For example, if your compute metric has a separate unit price (i.e. a matrix pricing model) per `region` and `provider`, your request might provide the following parameters:

- `first_dimension_key`: `region` - `first_dimension_value`: `us-east-1` - `second_dimension_key`: `provider` - `second_dimension_value`: `aws`

func (*SubscriptionService) List

This endpoint returns a list of all subscriptions for an account as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see Subscription(../guides/concepts#subscription).

Subscriptions can be filtered to a single customer by passing in the `customer_id` query parameter or the `external_customer_id` query parameter.

func (*SubscriptionService) ListAutoPaging

This endpoint returns a list of all subscriptions for an account as a [paginated](../reference/pagination) list, ordered starting from the most recently created subscription. For a full discussion of the subscription resource, see Subscription(../guides/concepts#subscription).

Subscriptions can be filtered to a single customer by passing in the `customer_id` query parameter or the `external_customer_id` query parameter.

func (*SubscriptionService) New

A subscription represents the purchase of a plan by a customer. The customer is identified by either the `customer_id` or the `external_customer_id`, and exactly one of these fields must be provided.

By default, subscriptions begin on the day that they're created and renew automatically for each billing cycle at the cadence that's configured in the plan definition.

The default configuration for subscriptions in Orb is **In-advance billing** and **Beginning of month alignment** (see Subscription(../guides/concepts#subscription) for more details).

In order to change the alignment behavior, Orb also supports billing subscriptions on the day of the month they are created. If `align_billing_with_subscription_start_date = true` is specified, subscriptions have billing cycles that are aligned with their `start_date`. For example, a subscription that begins on January 15th will have a billing cycle from January 15th to February 15th. Every subsequent billing cycle will continue to start and invoice on the 15th.

If the "day" value is greater than the number of days in the month, the next billing cycle will start at the end of the month. For example, if the start_date is January 31st, the next billing cycle will start on February 28th.

If a customer was created with a currency, Orb only allows subscribing the customer to a plan with a matching `invoicing_currency`. If the customer does not have a currency set, on subscription creation, we set the customer's currency to be the `invoicing_currency` of the plan.

## Price overrides

Price overrides are used to update some or all prices in a plan for the specific subscription being created. This is useful when a new customer has negotiated one or more different prices for a specific plan than the plan's default prices. Any type of price can be overridden, if the correct data is provided. The billable metric, cadence, type, and name of a price can not be overridden.

To override prices, provide a list of objects with the key `price_overrides`. The price object in the list of overrides is expected to contain the existing price id, the `model_type` and config value in the format below. The specific numerical values can be updated, but the config value and `model_type` must match the existing price that is being overridden

### Request format for price overrides

Orb supports a few different pricing models out of the box. The `model_type` field determines the key for the configuration object that is present.

### Unit pricing

With unit pricing, each unit costs a fixed amount.

```json { ... "id": "price_id", "model_type": "unit", "unit_config": { "unit_amount": "0.50" } ... } ```

### Tiered pricing

In tiered pricing, the cost of a given unit depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first ten units may cost $0.50 each and all units thereafter may cost $0.10 each. Tiered prices can be overridden with a new number of tiers or new values for `first_unit`, `last_unit`, or `unit_amount`.

```json { ... "id": "price_id", "model_type": "tiered", "tiered_config": { "tiers": [ { "first_unit":"1", "last_unit": "10", "unit_amount": "0.50" }, { "first_unit": "10", "last_unit": null, "unit_amount": "0.10" } ] } ... } ```

### Bulk pricing

Bulk pricing applies when the number of units determine the cost of _all_ units. For example, if you've bought less than 10 units, they may each be $0.50 for a total of $5.00. Once you've bought more than 10 units, all units may now be priced at $0.40 (i.e. 101 units total would be $40.40). Bulk prices can be overridden with a new number of tiers or new values for `maximum_units`, or `unit_amount`.

```json { ... "id": "price_id", "model_type": "bulk", "bulk_config": { "tiers": [ { "maximum_units": "10", "unit_amount": "0.50" }, { "maximum_units": "1000", "unit_amount": "0.40" } ] } ... } ```

### Package pricing

Package pricing defines the size or granularity of a unit for billing purposes. For example, if the package size is set to 5, then 4 units will be billed as 5 and 6 units will be billed at 10.

```json { ... "id": "price_id", "model_type": "package", "package_config": { "package_amount": "0.80", "package_size": 10 } ... } ```

### BPS pricing

BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a percent (the number of basis points to charge), as well as a cap per event to assess. For example, this would allow you to assess a fee of 0.25% on every payment you process, with a maximum charge of $25 per payment.

```json { ... "id": "price_id" "model_type": "bps", "bps_config": { "bps": 125, "per_event_cap": "11.00" } ... } ```

### Bulk BPS pricing

Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the total quantity across all events. Similar to bulk pricing, the BPS parameters of a given event depends on the tier range that the billing period falls into. Each tier range is defined by an upper and lower bound. For example, after $1.5M of payment volume is reached, each individual payment may have a lower cap or a smaller take-rate.

```json { ... "id": "price_id" "model_type": "bulk_bps", "bulk_bps_config": { "tiers": [ { "minimum_amount": "0.00", "maximum_amount": "1000000.00", "bps": 125, "per_event_cap": "19.00" }, { "minimum_amount":"1000000.00", "maximum_amount": null, "bps": 115, "per_event_cap": "4.00" } ] } ... } ```

### Tiered BPS pricing

Tiered BPS pricing specifies BPS parameters in a graduated manner, where an event's applicable parameter is a function of its marginal addition to the period total. Similar to tiered pricing, the BPS parameters of a given event depends on the tier range that it falls into, where each tier range is defined by an upper and lower bound. For example, the first few payments may have a 0.8 BPS take-rate and all payments after a specific volume may incur a take-rate of 0.5 BPS each.

```json { ... "id": "price_id" "model_type": "tiered_bps", "tiered_bps_config": { "tiers": [ { "minimum_amount": "0.00", "maximum_amount": "1000000.00", "bps": 125, "per_event_cap": "19.00" }, { "minimum_amount":"1000000", "maximum_amount": null, "bps": 115, "per_event_cap": "4.00" } ] } ... } ```

### Matrix pricing

Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. `dimensions` defines the two event property values evaluated in this pricing model. In a one-dimensional matrix, the second value is `null`. Every configuration has a list of `matrix_values` which give the unit prices for specified property values. In a one-dimensional matrix, the matrix values will have `dimension_values` where the second value of the pair is null. If an event does not match any of the dimension values in the matrix, it will resort to the `default_unit_amount`.

```json ... "model_type": "matrix" "matrix_config": { "default_unit_amount": "3.00", "dimensions": [ "cluster_name", "region" ], "matrix_values": [ { "dimension_values": [ "alpha", "west" ], "unit_amount": "2.00" }, ... ] } ... ```

### Fixed fees

Fixed fees follow unit pricing, and also have an additional parameter `fixed_price_quantity` that indicates how many of a fixed fee that should be applied for a subscription. This parameter defaults to 1.

```json { ... "id": "price_id", "model_type": "unit", "unit_config": { "unit_amount": "2.00" }, "fixed_price_quantity": 3.0 ... } ```

## Maximums and Minimums

Minimums and maximums, much like price overrides, can be useful when a new customer has negotiated a new or different minimum or maximum spend cap than the default for a given price. If one exists for a price and null is provided for the minimum/maximum override on creation, then there will be no minimum/maximum on the new subscription. If no value is provided, then the default price maximum or minimum is used.

To add a minimum for a specific price, add `minimum_amount` to the specific price in the `price_overrides` object.

To add a maximum for a specific price, add `maximum_amount` to the specific price in the `price_overrides` object.

### Minimum override example

Price minimum override example:

```json { ... "id": "price_id", "model_type": "unit", "unit_config": { "unit_amount": "0.50" }, "minimum_amount": "100.00" ... } ```

Removing an existing minimum example

```json { ... "id": "price_id", "model_type": "unit", "unit_config": { "unit_amount": "0.50" }, "minimum_amount": null ... } ```

## Discounts

Discounts, like price overrides, can be useful when a new customer has negotiated a new or different discount than the default for a price. A single price price can have at most one discount. If a discount exists for a price and a null discount is provided on creation, then there will be no discount on the new subscription.

To add a discount for a specific price, add `discount` to the price in the `price_overrides` object. Discount should be a dictionary of the format:

```json { "discount_type": "amount" | "percentage" | "usage", "amount_discount": string, "percentage_discount": string, "usage_discount": string } ```

where either `amount_discount`, `percentage_discount`, or `usage_discount` is provided.

Price discount example

```json { ... "id": "price_id", "model_type": "unit", "unit_config": { "unit_amount": "0.50" }, "discount": {"discount_type": "amount", "amount_discount": "175"}, } ```

Removing an existing discount example

```json { "customer_id": "customer_id", "plan_id": "plan_id", "discount": null, "price_overrides": [ ... ] ... } ```

## Threshold Billing

Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's invoicing currency, when creating a subscription. Ex. pass in `10.00` to issue an invoice when usage amounts hit $10.00 for a subscription that invoices in USD.

func (*SubscriptionService) PriceIntervals

func (r *SubscriptionService) PriceIntervals(ctx context.Context, subscriptionID string, body SubscriptionPriceIntervalsParams, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint is used to add and edit subscription [price intervals](../reference/price-interval). By making modifications to a subscription’s price intervals, you can [flexibly and atomically control the billing behavior of a subscription](../guides/product-catalog/modifying-subscriptions).

## Adding price intervals

Prices can be added as price intervals to a subscription by specifying them in the `add` array. A `price_id` or `external_price_id` from an add-on price or previously removed plan price can be specified to reuse an existing price definition (however, please note that prices from other plans cannot be added to the subscription). Additionally, a new price can be specified using the `price` field — this price will be created automatically.

A `start_date` must be specified for the price interval. This is the date when the price will start billing on the subscription, so this will notably result in an immediate charge at this time for any billed in advance fixed fees. The `end_date` will default to null, resulting in a price interval that will bill on a continually recurring basis. Both of these dates can be set in the past or the future and Orb will generate or modify invoices to ensure the subscription’s invoicing behavior is correct.

Additionally, a discount, minimum, or maximum can be specified on the price interval. This will only apply to this price interval, not any other price intervals on the subscription.

## Editing price intervals

Price intervals can be adjusted by specifying edits to make in the `edit` array. A `price_interval_id` to edit must be specified — this can be retrieved from the `price_intervals` field on the subscription.

A new `start_date` or `end_date` can be specified to change the range of the price interval, which will modify past or future invoices to ensure correctness. If either of these dates are unspecified, they will default to the existing date on the price interval. To remove a price interval entirely from a subscription, set the `end_date` to be equivalent to the `start_date`.

## Fixed fee quantity transitions

The fixed fee quantity transitions for a fixed fee price interval can also be specified when adding or editing by passing an array for `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a `quantity` and an `effective_date`, which is the date after which the new quantity will be used for billing. If a fixed fee quantity transition is scheduled at a billing period boundary, the full quantity will be billed on an invoice with the other prices on the subscription. If the fixed fee quantity transition is scheduled mid-billing period, the difference between the existing quantity and quantity specified in the transition will be prorated for the rest of the billing period and billed immediately, which will generate a new invoice.

Notably, the list of fixed fee quantity transitions passed will overwrite the existing fixed fee quantity transitions on the price interval, so the entire list of transitions must be specified to add additional transitions. The existing list of transitions can be retrieved using the `fixed_fee_quantity_transitions` property on a subscription’s serialized price intervals.

func (*SubscriptionService) SchedulePlanChange

func (r *SubscriptionService) SchedulePlanChange(ctx context.Context, subscriptionID string, body SubscriptionSchedulePlanChangeParams, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to change the plan on an existing subscription. It returns the serialized updated subscription object.

The body parameter `change_option` determines the timing of the plan change. Orb supports three options:

  • `end_of_subscription_term`: changes the plan at the end of the existing plan's term.
  • Issuing this plan change request for a monthly subscription will keep the existing plan active until the start of the subsequent month, and potentially issue an invoice for any usage charges incurred in the intervening period.
  • Issuing this plan change request for a yearly subscription will keep the existing plan active for the full year.
  • `immediate`: changes the plan immediately. Subscriptions that have their plan changed with this option will be invoiced immediately. This invoice will include any usage fees incurred in the billing period up to the change, along with any prorated recurring fees for the billing period, if applicable.
  • `requested_date`: changes the plan on the requested date (`change_date`). If no timezone is provided, the customer's timezone is used. The `change_date` body parameter is required if this option is chosen.

Note that one of `plan_id` or `external_plan_id` is required in the request body for this operation.

## Price overrides, maximums, and minimums

Price overrides are used to update some or all prices in the target plan. Minimums and maximums, much like price overrides, can be useful when a new customer has negotiated a new or different minimum or maximum spend cap than the default for the plan. The request format for price overrides, maximums, and minimums are the same as those in [subscription creation](create-subscription).

## Prorations for in-advance fees

By default, Orb calculates the prorated difference in any fixed fees when making a plan change, adjusting the customer balance as needed. For details on this behavior, see [Modifying subscriptions](../guides/product-catalog/modifying-subscriptions.md#prorations-for-in-advance-fees).

func (*SubscriptionService) TriggerPhase

func (r *SubscriptionService) TriggerPhase(ctx context.Context, subscriptionID string, body SubscriptionTriggerPhaseParams, opts ...option.RequestOption) (res *Subscription, err error)

Manually trigger a phase, effective the given date (or the current time, if not specified).

func (*SubscriptionService) UnscheduleCancellation

func (r *SubscriptionService) UnscheduleCancellation(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to unschedule any pending cancellations for a subscription.

To be eligible, the subscription must currently be active and have a future cancellation. This operation will turn on auto-renew, ensuring that the subscription does not end at the currently scheduled cancellation time.

func (*SubscriptionService) UnscheduleFixedFeeQuantityUpdates

func (r *SubscriptionService) UnscheduleFixedFeeQuantityUpdates(ctx context.Context, subscriptionID string, body SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to clear scheduled updates to the quantity for a fixed fee.

If there are no updates scheduled, this endpoint is a no-op.

func (*SubscriptionService) UnschedulePendingPlanChanges

func (r *SubscriptionService) UnschedulePendingPlanChanges(ctx context.Context, subscriptionID string, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to unschedule any pending plan changes on an existing subscription.

func (*SubscriptionService) UpdateFixedFeeQuantity

func (r *SubscriptionService) UpdateFixedFeeQuantity(ctx context.Context, subscriptionID string, body SubscriptionUpdateFixedFeeQuantityParams, opts ...option.RequestOption) (res *Subscription, err error)

This endpoint can be used to update the quantity for a fixed fee.

To be eligible, the subscription must currently be active and the price specified must be a fixed fee (not usage-based). This operation will immediately update the quantity for the fee, or if a `effective_date` is passed in, will update the quantity on the requested date at midnight in the customer's timezone.

In order to change the fixed fee quantity as of the next draft invoice for this subscription, pass `change_option=upcoming_invoice` without an `effective_date` specified.

If the fee is an in-advance fixed fee, it will also issue an immediate invoice for the difference for the remainder of the billing period.

type SubscriptionStatus

type SubscriptionStatus string
const (
	SubscriptionStatusActive   SubscriptionStatus = "active"
	SubscriptionStatusEnded    SubscriptionStatus = "ended"
	SubscriptionStatusUpcoming SubscriptionStatus = "upcoming"
)

type SubscriptionTrialInfo

type SubscriptionTrialInfo struct {
	EndDate time.Time `json:"end_date,required,nullable" format:"date-time"`
	JSON    subscriptionTrialInfoJSON
}

func (*SubscriptionTrialInfo) UnmarshalJSON

func (r *SubscriptionTrialInfo) UnmarshalJSON(data []byte) (err error)

type SubscriptionTriggerPhaseParams

type SubscriptionTriggerPhaseParams struct {
	// The date on which the phase change should take effect. If not provided, defaults
	// to today in the customer's timezone.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
}

func (SubscriptionTriggerPhaseParams) MarshalJSON

func (r SubscriptionTriggerPhaseParams) MarshalJSON() (data []byte, err error)

type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams

type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams struct {
	// Price for which the updates should be cleared. Must be a fixed fee.
	PriceID param.Field[string] `json:"price_id,required"`
}

func (SubscriptionUnscheduleFixedFeeQuantityUpdatesParams) MarshalJSON

func (r SubscriptionUnscheduleFixedFeeQuantityUpdatesParams) MarshalJSON() (data []byte, err error)

type SubscriptionUpdateFixedFeeQuantityParams

type SubscriptionUpdateFixedFeeQuantityParams struct {
	// Price for which the quantity should be updated. Must be a fixed fee.
	PriceID  param.Field[string]  `json:"price_id,required"`
	Quantity param.Field[float64] `json:"quantity,required"`
	// Determines when the change takes effect. Note that if `effective_date` is
	// specified, this defaults to `effective_date`. Otherwise, this defaults to
	// `immediate` unless it's explicitly set to `upcoming_invoice.
	ChangeOption param.Field[SubscriptionUpdateFixedFeeQuantityParamsChangeOption] `json:"change_option"`
	// The date that the quantity change should take effect, localized to the
	// customer's timezone. Ifthis parameter is not passed in, the quantity change is
	// effective according to `change_option`.
	EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
}

func (SubscriptionUpdateFixedFeeQuantityParams) MarshalJSON

func (r SubscriptionUpdateFixedFeeQuantityParams) MarshalJSON() (data []byte, err error)

type SubscriptionUpdateFixedFeeQuantityParamsChangeOption

type SubscriptionUpdateFixedFeeQuantityParamsChangeOption string

Determines when the change takes effect. Note that if `effective_date` is specified, this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's explicitly set to `upcoming_invoice.

const (
	SubscriptionUpdateFixedFeeQuantityParamsChangeOptionImmediate       SubscriptionUpdateFixedFeeQuantityParamsChangeOption = "immediate"
	SubscriptionUpdateFixedFeeQuantityParamsChangeOptionUpcomingInvoice SubscriptionUpdateFixedFeeQuantityParamsChangeOption = "upcoming_invoice"
	SubscriptionUpdateFixedFeeQuantityParamsChangeOptionEffectiveDate   SubscriptionUpdateFixedFeeQuantityParamsChangeOption = "effective_date"
)

type SubscriptionUsage

type SubscriptionUsage interface {
	// contains filtered or unexported methods
}

Union satisfied by SubscriptionUsageUngroupedSubscriptionUsage or SubscriptionUsageGroupedSubscriptionUsage.

type SubscriptionUsageGroupedSubscriptionUsage

type SubscriptionUsageGroupedSubscriptionUsage struct {
	Data               []SubscriptionUsageGroupedSubscriptionUsageData             `json:"data,required"`
	PaginationMetadata SubscriptionUsageGroupedSubscriptionUsagePaginationMetadata `json:"pagination_metadata,nullable"`
	JSON               subscriptionUsageGroupedSubscriptionUsageJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsage) UnmarshalJSON

func (r *SubscriptionUsageGroupedSubscriptionUsage) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageGroupedSubscriptionUsageData

type SubscriptionUsageGroupedSubscriptionUsageData struct {
	BillableMetric SubscriptionUsageGroupedSubscriptionUsageDataBillableMetric `json:"billable_metric,required"`
	MetricGroup    SubscriptionUsageGroupedSubscriptionUsageDataMetricGroup    `json:"metric_group,required"`
	Usage          []SubscriptionUsageGroupedSubscriptionUsageDataUsage        `json:"usage,required"`
	ViewMode       SubscriptionUsageGroupedSubscriptionUsageDataViewMode       `json:"view_mode,required"`
	JSON           subscriptionUsageGroupedSubscriptionUsageDataJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsageData) UnmarshalJSON

func (r *SubscriptionUsageGroupedSubscriptionUsageData) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageGroupedSubscriptionUsageDataBillableMetric

type SubscriptionUsageGroupedSubscriptionUsageDataBillableMetric struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON subscriptionUsageGroupedSubscriptionUsageDataBillableMetricJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsageDataBillableMetric) UnmarshalJSON

type SubscriptionUsageGroupedSubscriptionUsageDataMetricGroup

type SubscriptionUsageGroupedSubscriptionUsageDataMetricGroup struct {
	PropertyKey   string `json:"property_key,required"`
	PropertyValue string `json:"property_value,required"`
	JSON          subscriptionUsageGroupedSubscriptionUsageDataMetricGroupJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsageDataMetricGroup) UnmarshalJSON

type SubscriptionUsageGroupedSubscriptionUsageDataUsage

type SubscriptionUsageGroupedSubscriptionUsageDataUsage struct {
	Quantity       float64   `json:"quantity,required"`
	TimeframeEnd   time.Time `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time `json:"timeframe_start,required" format:"date-time"`
	JSON           subscriptionUsageGroupedSubscriptionUsageDataUsageJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsageDataUsage) UnmarshalJSON

func (r *SubscriptionUsageGroupedSubscriptionUsageDataUsage) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageGroupedSubscriptionUsageDataViewMode

type SubscriptionUsageGroupedSubscriptionUsageDataViewMode string
const (
	SubscriptionUsageGroupedSubscriptionUsageDataViewModePeriodic   SubscriptionUsageGroupedSubscriptionUsageDataViewMode = "periodic"
	SubscriptionUsageGroupedSubscriptionUsageDataViewModeCumulative SubscriptionUsageGroupedSubscriptionUsageDataViewMode = "cumulative"
)

type SubscriptionUsageGroupedSubscriptionUsagePaginationMetadata

type SubscriptionUsageGroupedSubscriptionUsagePaginationMetadata struct {
	HasMore    bool   `json:"has_more,required"`
	NextCursor string `json:"next_cursor,required,nullable"`
	JSON       subscriptionUsageGroupedSubscriptionUsagePaginationMetadataJSON
}

func (*SubscriptionUsageGroupedSubscriptionUsagePaginationMetadata) UnmarshalJSON

type SubscriptionUsageUngroupedSubscriptionUsage

type SubscriptionUsageUngroupedSubscriptionUsage struct {
	Data []SubscriptionUsageUngroupedSubscriptionUsageData `json:"data,required"`
	JSON subscriptionUsageUngroupedSubscriptionUsageJSON
}

func (*SubscriptionUsageUngroupedSubscriptionUsage) UnmarshalJSON

func (r *SubscriptionUsageUngroupedSubscriptionUsage) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageUngroupedSubscriptionUsageData

type SubscriptionUsageUngroupedSubscriptionUsageData struct {
	BillableMetric SubscriptionUsageUngroupedSubscriptionUsageDataBillableMetric `json:"billable_metric,required"`
	Usage          []SubscriptionUsageUngroupedSubscriptionUsageDataUsage        `json:"usage,required"`
	ViewMode       SubscriptionUsageUngroupedSubscriptionUsageDataViewMode       `json:"view_mode,required"`
	JSON           subscriptionUsageUngroupedSubscriptionUsageDataJSON
}

func (*SubscriptionUsageUngroupedSubscriptionUsageData) UnmarshalJSON

func (r *SubscriptionUsageUngroupedSubscriptionUsageData) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageUngroupedSubscriptionUsageDataBillableMetric

type SubscriptionUsageUngroupedSubscriptionUsageDataBillableMetric struct {
	ID   string `json:"id,required"`
	Name string `json:"name,required"`
	JSON subscriptionUsageUngroupedSubscriptionUsageDataBillableMetricJSON
}

func (*SubscriptionUsageUngroupedSubscriptionUsageDataBillableMetric) UnmarshalJSON

type SubscriptionUsageUngroupedSubscriptionUsageDataUsage

type SubscriptionUsageUngroupedSubscriptionUsageDataUsage struct {
	Quantity       float64   `json:"quantity,required"`
	TimeframeEnd   time.Time `json:"timeframe_end,required" format:"date-time"`
	TimeframeStart time.Time `json:"timeframe_start,required" format:"date-time"`
	JSON           subscriptionUsageUngroupedSubscriptionUsageDataUsageJSON
}

func (*SubscriptionUsageUngroupedSubscriptionUsageDataUsage) UnmarshalJSON

func (r *SubscriptionUsageUngroupedSubscriptionUsageDataUsage) UnmarshalJSON(data []byte) (err error)

type SubscriptionUsageUngroupedSubscriptionUsageDataViewMode

type SubscriptionUsageUngroupedSubscriptionUsageDataViewMode string
const (
	SubscriptionUsageUngroupedSubscriptionUsageDataViewModePeriodic   SubscriptionUsageUngroupedSubscriptionUsageDataViewMode = "periodic"
	SubscriptionUsageUngroupedSubscriptionUsageDataViewModeCumulative SubscriptionUsageUngroupedSubscriptionUsageDataViewMode = "cumulative"
)

type Subscriptions

type Subscriptions struct {
	Data               []Subscription                  `json:"data,required"`
	PaginationMetadata SubscriptionsPaginationMetadata `json:"pagination_metadata,required"`
	JSON               subscriptionsJSON
}

func (*Subscriptions) UnmarshalJSON

func (r *Subscriptions) UnmarshalJSON(data []byte) (err error)

type SubscriptionsPaginationMetadata

type SubscriptionsPaginationMetadata struct {
	HasMore    bool   `json:"has_more,required"`
	NextCursor string `json:"next_cursor,required,nullable"`
	JSON       subscriptionsPaginationMetadataJSON
}

func (*SubscriptionsPaginationMetadata) UnmarshalJSON

func (r *SubscriptionsPaginationMetadata) UnmarshalJSON(data []byte) (err error)

type TopLevelPingResponse

type TopLevelPingResponse struct {
	Response string `json:"response,required"`
	JSON     topLevelPingResponseJSON
}

func (*TopLevelPingResponse) UnmarshalJSON

func (r *TopLevelPingResponse) UnmarshalJSON(data []byte) (err error)

type TopLevelService

type TopLevelService struct {
	Options []option.RequestOption
}

TopLevelService contains methods and other services that help with interacting with the orb API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTopLevelService method instead.

func NewTopLevelService

func NewTopLevelService(opts ...option.RequestOption) (r *TopLevelService)

NewTopLevelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TopLevelService) Ping

func (r *TopLevelService) Ping(ctx context.Context, opts ...option.RequestOption) (res *TopLevelPingResponse, err error)

This endpoint allows you to test your connection to the Orb API and check the validity of your API key, passed in the Authorization header. This is particularly useful for checking that your environment is set up properly, and is a great choice for connectors and integrations.

This API does not have any side-effects or return any Orb resources.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL