// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Shared from './shared'; import { BodyCursorPage } from '../core/pagination'; export interface BalanceFilter { /** * The balance type to filter by. */ balance_types?: Array<'PREPAID_COMMIT' | 'POSTPAID_COMMIT' | 'CREDIT'>; /** * Custom fields to compute balance across. Must match all custom fields */ custom_fields?: { [key: string]: string }; /** * Specific IDs to compute balance across. */ ids?: Array; } export interface BaseThresholdCommit { /** * The commit product that will be used to generate the line item for commit * payment. */ product_id: string; description?: string; /** * Specify the name of the line item for the threshold charge. If left blank, it * will default to the commit product name. */ name?: string; } export interface BaseUsageFilter { group_key: string; group_values: Array; starting_at?: string; } export interface Commit { id: string; /** * Timestamp of when the commit was created. * * - Recurring commits: latter of commit service period date and parent commit * start date * - Rollover commits: when the new contract started */ created_at: string; product: Commit.Product; type: 'PREPAID' | 'POSTPAID'; /** * The schedule that the customer will gain access to the credits purposed with * this commit. */ access_schedule?: ScheduleDuration; /** * (DEPRECATED) Use access_schedule + invoice_schedule instead. */ amount?: number; applicable_contract_ids?: Array; applicable_product_ids?: Array; applicable_product_tags?: Array; /** * RFC 3339 timestamp indicating when the commit was archived. If not provided, the * commit is not archived. */ archived_at?: string; /** * The current balance of the credit or commit. This balance reflects the amount of * credit or commit that the customer has access to use at this moment - thus, * expired and upcoming credit or commit segments contribute 0 to the balance. The * balance will match the sum of all ledger entries with the exception of the case * where the sum of negative manual ledger entries exceeds the positive amount * remaining on the credit or commit - in that case, the balance will be 0. All * manual ledger entries associated with active credit or commit segments are * included in the balance, including future-dated manual ledger entries. */ balance?: number; contract?: Commit.Contract; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; /** * Optional configuration for commit hierarchy access control */ hierarchy_configuration?: CommitHierarchyConfiguration; /** * The contract that this commit will be billed on. */ invoice_contract?: Commit.InvoiceContract; /** * The schedule that the customer will be invoiced for this commit. */ invoice_schedule?: SchedulePointInTime; /** * A list of ordered events that impact the balance of a commit. For example, an * invoice deduction or a rollover. */ ledger?: Array< | Commit.PrepaidCommitSegmentStartLedgerEntry | Commit.PrepaidCommitAutomatedInvoiceDeductionLedgerEntry | Commit.PrepaidCommitRolloverLedgerEntry | Commit.PrepaidCommitExpirationLedgerEntry | Commit.PrepaidCommitCanceledLedgerEntry | Commit.PrepaidCommitCreditedLedgerEntry | Commit.PrepaidCommitSeatBasedAdjustmentLedgerEntry | Commit.PostpaidCommitInitialBalanceLedgerEntry | Commit.PostpaidCommitAutomatedInvoiceDeductionLedgerEntry | Commit.PostpaidCommitRolloverLedgerEntry | Commit.PostpaidCommitTrueupLedgerEntry | Commit.PrepaidCommitManualLedgerEntry | Commit.PostpaidCommitManualLedgerEntry | Commit.PostpaidCommitExpirationLedgerEntry >; name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; /** * If multiple credits or commits are applicable, the one with the lower priority * will apply first. */ priority?: number; rate_type?: 'COMMIT_RATE' | 'LIST_RATE'; /** * The ID of the recurring commit that this commit was generated from, if * applicable. */ recurring_commit_id?: string; rolled_over_from?: Commit.RolledOverFrom; rollover_fraction?: number; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * The subscription configuration for this commit, if it was generated from a * recurring commit with a subscription attached. */ subscription_config?: Commit.SubscriptionConfig; /** * Prevents the creation of duplicates. If a request to create a commit or credit * is made with a uniqueness key that was previously used to create a commit or * credit, a new record will not be created and the request will fail with a 409 * error. */ uniqueness_key?: string; } export namespace Commit { export interface Product { id: string; name: string; } export interface Contract { id: string; } /** * The contract that this commit will be billed on. */ export interface InvoiceContract { id: string; } export interface PrepaidCommitSegmentStartLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_SEGMENT_START'; } export interface PrepaidCommitAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface PrepaidCommitRolloverLedgerEntry { amount: number; new_contract_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_ROLLOVER'; } export interface PrepaidCommitExpirationLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_EXPIRATION'; } export interface PrepaidCommitCanceledLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_CANCELED'; contract_id?: string; } export interface PrepaidCommitCreditedLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_CREDITED'; contract_id?: string; } export interface PrepaidCommitSeatBasedAdjustmentLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_SEAT_BASED_ADJUSTMENT'; } export interface PostpaidCommitInitialBalanceLedgerEntry { amount: number; timestamp: string; type: 'POSTPAID_COMMIT_INITIAL_BALANCE'; } export interface PostpaidCommitAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'POSTPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface PostpaidCommitRolloverLedgerEntry { amount: number; new_contract_id: string; segment_id: string; timestamp: string; type: 'POSTPAID_COMMIT_ROLLOVER'; } export interface PostpaidCommitTrueupLedgerEntry { amount: number; invoice_id: string; timestamp: string; type: 'POSTPAID_COMMIT_TRUEUP'; contract_id?: string; } export interface PrepaidCommitManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'PREPAID_COMMIT_MANUAL'; } export interface PostpaidCommitManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'POSTPAID_COMMIT_MANUAL'; } export interface PostpaidCommitExpirationLedgerEntry { amount: number; timestamp: string; type: 'POSTPAID_COMMIT_EXPIRATION'; } export interface RolledOverFrom { commit_id: string; contract_id: string; } /** * The subscription configuration for this commit, if it was generated from a * recurring commit with a subscription attached. */ export interface SubscriptionConfig { allocation?: 'INDIVIDUAL' | 'POOLED'; apply_seat_increase_config?: SubscriptionConfig.ApplySeatIncreaseConfig; subscription_id?: string; } export namespace SubscriptionConfig { export interface ApplySeatIncreaseConfig { /** * Indicates whether a mid-period seat increase should be prorated. */ is_prorated: boolean; } } } export interface CommitHierarchyConfiguration { child_access: | CommitHierarchyConfiguration.CommitHierarchyChildAccessAll | CommitHierarchyConfiguration.CommitHierarchyChildAccessNone | CommitHierarchyConfiguration.CommitHierarchyChildAccessContractIDs; } export namespace CommitHierarchyConfiguration { export interface CommitHierarchyChildAccessAll { type: 'ALL'; } export interface CommitHierarchyChildAccessNone { type: 'NONE'; } export interface CommitHierarchyChildAccessContractIDs { contract_ids: Array; type: 'CONTRACT_IDS'; } } /** * A distinct rate on the rate card. You can choose to use this rate rather than * list rate when consuming a credit or commit. */ export interface CommitRate { rate_type: 'FLAT' | 'PERCENTAGE' | 'SUBSCRIPTION' | 'TIERED' | 'TIERED_PERCENTAGE' | 'CUSTOM'; /** * Commit rate price. For FLAT rate_type, this must be >=0. For PERCENTAGE * rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 * and <=1. */ price?: number; /** * Only set for TIERED rate_type. */ tiers?: Array; } export interface CommitSpecifier { presentation_group_values?: { [key: string]: string }; pricing_group_values?: { [key: string]: string }; /** * If provided, the specifier will only apply to the product with the specified ID. */ product_id?: string; /** * If provided, the specifier will only apply to products with all the specified * tags. */ product_tags?: Array; } export interface CommitSpecifierInput { /** * If provided, the specifier will apply to product usage with these set of * presentation group values. */ presentation_group_values?: { [key: string]: string }; /** * If provided, the specifier will apply to product usage with these set of pricing * group values. */ pricing_group_values?: { [key: string]: string }; /** * If provided, the specifier will only apply to the product with the specified ID. */ product_id?: string; /** * If provided, the specifier will only apply to products with all the specified * tags. */ product_tags?: Array; } export interface Contract { id: string; amendments: Array; current: ContractWithoutAmendments; customer_id: string; initial: ContractWithoutAmendments; /** * RFC 3339 timestamp indicating when the contract was archived. If not returned, * the contract is not archived. */ archived_at?: string; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; /** * The billing provider configuration associated with a contract. */ customer_billing_provider_configuration?: Contract.CustomerBillingProviderConfiguration; /** * ID of the package this contract was created from, if applicable. */ package_id?: string; prepaid_balance_threshold_configuration?: PrepaidBalanceThresholdConfiguration; /** * Determines which scheduled and commit charges to consolidate onto the Contract's * usage invoice. The charge's `timestamp` must match the usage invoice's * `ending_before` date for consolidation to occur. This field cannot be modified * after a Contract has been created. If this field is omitted, charges will appear * on a separate invoice from usage charges. */ scheduled_charges_on_usage_invoices?: 'ALL'; spend_threshold_configuration?: SpendThresholdConfiguration; /** * List of subscriptions on the contract. */ subscriptions?: Array; /** * Prevents the creation of duplicates. If a request to create a record is made * with a previously used uniqueness key, a new record will not be created and the * request will fail with a 409 error. */ uniqueness_key?: string; } export namespace Contract { export interface Amendment { id: string; commits: Array; created_at: string; created_by: string; overrides: Array; scheduled_charges: Array; starting_at: string; credits?: Array; /** * This field's availability is dependent on your client's configuration. */ discounts?: Array; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; /** * This field's availability is dependent on your client's configuration. */ professional_services?: Array; /** * This field's availability is dependent on your client's configuration. */ reseller_royalties?: Array; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; } export namespace Amendment { export interface ResellerRoyalty { reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; aws_account_number?: string; aws_offer_id?: string; aws_payer_reference_id?: string; ending_before?: string | null; fraction?: number; gcp_account_id?: string; gcp_offer_id?: string; netsuite_reseller_id?: string; reseller_contract_value?: number; starting_at?: string; } } /** * The billing provider configuration associated with a contract. */ export interface CustomerBillingProviderConfiguration { archived_at: string | null; billing_provider: | 'aws_marketplace' | 'stripe' | 'netsuite' | 'custom' | 'azure_marketplace' | 'quickbooks_online' | 'workday' | 'gcp_marketplace' | 'metronome'; delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns'; id?: string; /** * Configuration for the billing provider. The structure of this object is specific * to the billing provider. */ configuration?: { [key: string]: unknown }; } } export interface ContractV2 { id: string; commits: Array; created_at: string; created_by: string; customer_id: string; overrides: Array; scheduled_charges: Array; starting_at: string; transitions: Array; usage_filter: Array; usage_statement_schedule: ContractV2.UsageStatementSchedule; archived_at?: string; credits?: Array; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; /** * This field's availability is dependent on your client's configuration. */ customer_billing_provider_configuration?: ContractV2.CustomerBillingProviderConfiguration; /** * This field's availability is dependent on your client's configuration. */ discounts?: Array; ending_before?: string; /** * Indicates whether there are more items than the limit for this endpoint. Use the * respective list endpoints to get the full lists. */ has_more?: ContractV2.HasMore; /** * Either a **parent** configuration with a list of children or a **child** * configuration with a single parent. */ hierarchy_configuration?: | ContractV2.ParentHierarchyConfiguration | ContractV2.ChildHierarchyConfigurationV2; /** * Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list * prices automatically. EXPLICIT prioritization requires specifying priorities for * each multiplier; the one with the lowest priority value will be prioritized * first. */ multiplier_override_prioritization?: 'LOWEST_MULTIPLIER' | 'EXPLICIT'; name?: string; net_payment_terms_days?: number; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; prepaid_balance_threshold_configuration?: PrepaidBalanceThresholdConfigurationV2; /** * Priority of the contract. */ priority?: number; /** * This field's availability is dependent on your client's configuration. */ professional_services?: Array; rate_card_id?: string; recurring_commits?: Array; recurring_credits?: Array; /** * This field's availability is dependent on your client's configuration. */ reseller_royalties?: Array; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * Determines which scheduled and commit charges to consolidate onto the Contract's * usage invoice. The charge's `timestamp` must match the usage invoice's * `ending_before` date for consolidation to occur. This field cannot be modified * after a Contract has been created. If this field is omitted, charges will appear * on a separate invoice from usage charges. */ scheduled_charges_on_usage_invoices?: 'ALL'; spend_threshold_configuration?: SpendThresholdConfigurationV2; /** * List of subscriptions on the contract. */ subscriptions?: Array; total_contract_value?: number; /** * Optional uniqueness key to prevent duplicate contract creations. */ uniqueness_key?: string; } export namespace ContractV2 { export interface Commit { id: string; /** * Timestamp of when the commit was created. * * - Recurring commits: latter of commit service period date and parent commit * start date * - Rollover commits: when the new contract started */ created_at: string; product: Commit.Product; type: 'PREPAID' | 'POSTPAID'; /** * The schedule that the customer will gain access to the credits purposed with * this commit. */ access_schedule?: Shared.ScheduleDuration; applicable_contract_ids?: Array; applicable_product_ids?: Array; applicable_product_tags?: Array; archived_at?: string; /** * The current balance of the credit or commit. This balance reflects the amount of * credit or commit that the customer has access to use at this moment - thus, * expired and upcoming credit or commit segments contribute 0 to the balance. The * balance will match the sum of all ledger entries with the exception of the case * where the sum of negative manual ledger entries exceeds the positive amount * remaining on the credit or commit - in that case, the balance will be 0. All * manual ledger entries associated with active credit or commit segments are * included in the balance, including future-dated manual ledger entries. */ balance?: number; contract?: Commit.Contract; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; /** * Optional configuration for commit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * The contract that this commit will be billed on. */ invoice_contract?: Commit.InvoiceContract; /** * The schedule that the customer will be invoiced for this commit. */ invoice_schedule?: Shared.SchedulePointInTime; /** * A list of ordered events that impact the balance of a commit. For example, an * invoice deduction or a rollover. */ ledger?: Array< | Commit.PrepaidCommitSegmentStartLedgerEntry | Commit.PrepaidCommitAutomatedInvoiceDeductionLedgerEntry | Commit.PrepaidCommitRolloverLedgerEntry | Commit.PrepaidCommitExpirationLedgerEntry | Commit.PrepaidCommitCanceledLedgerEntry | Commit.PrepaidCommitCreditedLedgerEntry | Commit.PrepaidCommitSeatBasedAdjustmentLedgerEntry | Commit.PostpaidCommitInitialBalanceLedgerEntry | Commit.PostpaidCommitAutomatedInvoiceDeductionLedgerEntry | Commit.PostpaidCommitRolloverLedgerEntry | Commit.PostpaidCommitTrueupLedgerEntry | Commit.PrepaidCommitManualLedgerEntry | Commit.PostpaidCommitManualLedgerEntry | Commit.PostpaidCommitExpirationLedgerEntry >; name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; /** * If multiple credits or commits are applicable, the one with the lower priority * will apply first. */ priority?: number; rate_type?: 'COMMIT_RATE' | 'LIST_RATE'; /** * The ID of the recurring commit that created this commit */ recurring_commit_id?: string; rolled_over_from?: Commit.RolledOverFrom; rollover_fraction?: number; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace Commit { export interface Product { id: string; name: string; } export interface Contract { id: string; } /** * The contract that this commit will be billed on. */ export interface InvoiceContract { id: string; } export interface PrepaidCommitSegmentStartLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_SEGMENT_START'; } export interface PrepaidCommitAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface PrepaidCommitRolloverLedgerEntry { amount: number; new_contract_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_ROLLOVER'; } export interface PrepaidCommitExpirationLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_EXPIRATION'; } export interface PrepaidCommitCanceledLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_CANCELED'; contract_id?: string; } export interface PrepaidCommitCreditedLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_CREDITED'; contract_id?: string; } export interface PrepaidCommitSeatBasedAdjustmentLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'PREPAID_COMMIT_SEAT_BASED_ADJUSTMENT'; } export interface PostpaidCommitInitialBalanceLedgerEntry { amount: number; timestamp: string; type: 'POSTPAID_COMMIT_INITIAL_BALANCE'; } export interface PostpaidCommitAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'POSTPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface PostpaidCommitRolloverLedgerEntry { amount: number; new_contract_id: string; segment_id: string; timestamp: string; type: 'POSTPAID_COMMIT_ROLLOVER'; } export interface PostpaidCommitTrueupLedgerEntry { amount: number; invoice_id: string; timestamp: string; type: 'POSTPAID_COMMIT_TRUEUP'; contract_id?: string; } export interface PrepaidCommitManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'PREPAID_COMMIT_MANUAL'; } export interface PostpaidCommitManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'POSTPAID_COMMIT_MANUAL'; } export interface PostpaidCommitExpirationLedgerEntry { amount: number; timestamp: string; type: 'POSTPAID_COMMIT_EXPIRATION'; } export interface RolledOverFrom { commit_id: string; contract_id: string; } } export interface Override { id: string; starting_at: string; applicable_product_tags?: Array; ending_before?: string; entitled?: boolean; is_commit_specific?: boolean; multiplier?: number; override_specifiers?: Array; override_tiers?: Array; overwrite_rate?: Override.OverwriteRate; priority?: number; product?: Override.Product; target?: 'COMMIT_RATE' | 'LIST_RATE'; type?: 'OVERWRITE' | 'MULTIPLIER' | 'TIERED'; } export namespace Override { export interface OverrideSpecifier { billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; commit_ids?: Array; presentation_group_values?: { [key: string]: string | null }; pricing_group_values?: { [key: string]: string }; product_id?: string; product_tags?: Array; recurring_commit_ids?: Array; recurring_credit_ids?: Array; } export interface OverwriteRate { rate_type: 'FLAT' | 'PERCENTAGE' | 'SUBSCRIPTION' | 'TIERED' | 'TIERED_PERCENTAGE' | 'CUSTOM'; credit_type?: Shared.CreditTypeData; /** * Only set for CUSTOM rate_type. This field is interpreted by custom rate * processors. */ custom_rate?: { [key: string]: unknown }; /** * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be * set to true. */ is_prorated?: boolean; /** * Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type, * this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1. */ price?: number; /** * Default quantity. For SUBSCRIPTION rate_type, this must be >=0. */ quantity?: number; /** * Only set for TIERED rate_type. */ tiers?: Array; } export interface Product { id: string; name: string; } } export interface Transition { from_contract_id: string; to_contract_id: string; type: 'SUPERSEDE' | 'RENEWAL'; } export interface UsageFilter { group_key: string; group_values: Array; /** * This will match contract starting_at value if usage filter is active from the * beginning of the contract. */ starting_at: string; /** * This will match contract ending_before value if usage filter is active until the * end of the contract. It will be undefined if the contract is open-ended. */ ending_before?: string; } export interface UsageStatementSchedule { /** * Contract usage statements follow a selected cadence based on this date. */ billing_anchor_date: string; frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; } export interface Credit { id: string; product: Credit.Product; type: 'CREDIT'; /** * The schedule that the customer will gain access to the credits. */ access_schedule?: Shared.ScheduleDuration; applicable_contract_ids?: Array; applicable_product_ids?: Array; applicable_product_tags?: Array; /** * The current balance of the credit or commit. This balance reflects the amount of * credit or commit that the customer has access to use at this moment - thus, * expired and upcoming credit or commit segments contribute 0 to the balance. The * balance will match the sum of all ledger entries with the exception of the case * where the sum of negative manual ledger entries exceeds the positive amount * remaining on the credit or commit - in that case, the balance will be 0. All * manual ledger entries associated with active credit or commit segments are * included in the balance, including future-dated manual ledger entries. */ balance?: number; contract?: Credit.Contract; /** * Timestamp of when the credit was created. * * - Recurring credits: latter of credit service period date and parent credit * start date */ created_at?: string; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; /** * Optional configuration for credit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * A list of ordered events that impact the balance of a credit. For example, an * invoice deduction or an expiration. */ ledger?: Array< | Credit.CreditSegmentStartLedgerEntry | Credit.CreditAutomatedInvoiceDeductionLedgerEntry | Credit.CreditExpirationLedgerEntry | Credit.CreditCanceledLedgerEntry | Credit.CreditCreditedLedgerEntry | Credit.CreditManualLedgerEntry | Credit.CreditSeatBasedAdjustmentLedgerEntry >; name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; /** * If multiple credits or commits are applicable, the one with the lower priority * will apply first. */ priority?: number; /** * The ID of the recurring credit that created this credit */ recurring_credit_id?: string; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace Credit { export interface Product { id: string; name: string; } export interface Contract { id: string; } export interface CreditSegmentStartLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_SEGMENT_START'; } export interface CreditAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface CreditExpirationLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_EXPIRATION'; } export interface CreditCanceledLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_CANCELED'; contract_id?: string; } export interface CreditCreditedLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_CREDITED'; contract_id?: string; } export interface CreditManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'CREDIT_MANUAL'; } export interface CreditSeatBasedAdjustmentLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_SEAT_BASED_ADJUSTMENT'; } } /** * This field's availability is dependent on your client's configuration. */ export interface CustomerBillingProviderConfiguration { /** * ID of Customer's billing provider configuration. */ id: string; billing_provider: | 'aws_marketplace' | 'stripe' | 'netsuite' | 'custom' | 'azure_marketplace' | 'quickbooks_online' | 'workday' | 'gcp_marketplace' | 'metronome'; delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns'; } /** * Indicates whether there are more items than the limit for this endpoint. Use the * respective list endpoints to get the full lists. */ export interface HasMore { /** * Whether there are more commits on this contract than the limit for this * endpoint. Use the /contracts/customerCommits/list endpoint to get the full list * of commits. */ commits: boolean; /** * Whether there are more credits on this contract than the limit for this * endpoint. Use the /contracts/customerCredits/list endpoint to get the full list * of credits. */ credits: boolean; } export interface ParentHierarchyConfiguration { /** * List of contracts that belong to this parent. */ children: Array; parent_behavior?: ParentHierarchyConfiguration.ParentBehavior; } export namespace ParentHierarchyConfiguration { export interface Child { contract_id: string; customer_id: string; } export interface ParentBehavior { /** * Indicates the desired behavior of consolidated invoices generated by the parent * in a customer hierarchy * * **CONCATENATE**: Statements on the invoices of child customers will be appended * to the consolidated invoice * * **NONE**: Do not generate consolidated invoices */ invoice_consolidation_type?: 'CONCATENATE' | 'NONE'; } } export interface ChildHierarchyConfigurationV2 { /** * The single parent contract/customer for this child. */ parent: ChildHierarchyConfigurationV2.Parent; /** * Indicates which customer should pay for the child's invoice charges **SELF**: * The child pays for its own invoice charges **PARENT**: The parent pays for the * child's invoice charges */ payer?: 'SELF' | 'PARENT'; /** * Indicates the behavior of the child's invoice statements on the parent's * invoices. * * **CONSOLIDATE**: Child's invoice statements will be added to parent's * consolidated invoices * * **SEPARATE**: Child's invoice statements will appear not appear on parent's * consolidated invoices */ usage_statement_behavior?: 'CONSOLIDATE' | 'SEPARATE'; } export namespace ChildHierarchyConfigurationV2 { /** * The single parent contract/customer for this child. */ export interface Parent { contract_id: string; customer_id: string; } } export interface RecurringCommit { id: string; /** * The amount of commit to grant. */ access_amount: RecurringCommit.AccessAmount; /** * The amount of time the created commits will be valid for */ commit_duration: RecurringCommit.CommitDuration; /** * Will be passed down to the individual commits */ priority: number; product: RecurringCommit.Product; /** * Whether the created commits will use the commit rate or list rate */ rate_type: 'COMMIT_RATE' | 'LIST_RATE'; /** * Determines the start time for the first commit */ starting_at: string; /** * Will be passed down to the individual commits */ applicable_product_ids?: Array; /** * Will be passed down to the individual commits */ applicable_product_tags?: Array; contract?: RecurringCommit.Contract; /** * Will be passed down to the individual commits */ description?: string; /** * Determines when the contract will stop creating recurring commits. Optional */ ending_before?: string; /** * Optional configuration for recurring credit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * The amount the customer should be billed for the commit. Not required. */ invoice_amount?: RecurringCommit.InvoiceAmount; /** * Displayed on invoices. Will be passed through to the individual commits */ name?: string; /** * Will be passed down to the individual commits */ netsuite_sales_order_id?: string; /** * Determines whether the first and last commit will be prorated. If not provided, * the default is FIRST_AND_LAST (i.e. prorate both the first and last commits). */ proration?: 'NONE' | 'FIRST' | 'LAST' | 'FIRST_AND_LAST'; /** * The frequency at which the recurring commits will be created. If not provided: - * The commits will be created on the usage invoice frequency. If provided: - The * period defined in the duration will correspond to this frequency. - Commits will * be created aligned with the recurring commit's starting_at rather than the usage * invoice dates. */ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; /** * Will be passed down to the individual commits. This controls how much of an * individual unexpired commit will roll over upon contract transition. Must be * between 0 and 1. */ rollover_fraction?: number; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace RecurringCommit { /** * The amount of commit to grant. */ export interface AccessAmount { credit_type_id: string; unit_price: number; quantity?: number; } /** * The amount of time the created commits will be valid for */ export interface CommitDuration { value: number; unit?: 'PERIODS'; } export interface Product { id: string; name: string; } export interface Contract { id: string; } /** * The amount the customer should be billed for the commit. Not required. */ export interface InvoiceAmount { credit_type_id: string; quantity: number; unit_price: number; } } export interface RecurringCredit { id: string; /** * The amount of commit to grant. */ access_amount: RecurringCredit.AccessAmount; /** * The amount of time the created commits will be valid for */ commit_duration: RecurringCredit.CommitDuration; /** * Will be passed down to the individual commits */ priority: number; product: RecurringCredit.Product; /** * Whether the created commits will use the commit rate or list rate */ rate_type: 'COMMIT_RATE' | 'LIST_RATE'; /** * Determines the start time for the first commit */ starting_at: string; /** * Will be passed down to the individual commits */ applicable_product_ids?: Array; /** * Will be passed down to the individual commits */ applicable_product_tags?: Array; contract?: RecurringCredit.Contract; /** * Will be passed down to the individual commits */ description?: string; /** * Determines when the contract will stop creating recurring commits. Optional */ ending_before?: string; /** * Optional configuration for recurring credit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * Displayed on invoices. Will be passed through to the individual commits */ name?: string; /** * Will be passed down to the individual commits */ netsuite_sales_order_id?: string; /** * Determines whether the first and last commit will be prorated. If not provided, * the default is FIRST_AND_LAST (i.e. prorate both the first and last commits). */ proration?: 'NONE' | 'FIRST' | 'LAST' | 'FIRST_AND_LAST'; /** * The frequency at which the recurring commits will be created. If not provided: - * The commits will be created on the usage invoice frequency. If provided: - The * period defined in the duration will correspond to this frequency. - Commits will * be created aligned with the recurring commit's starting_at rather than the usage * invoice dates. */ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; /** * Will be passed down to the individual commits. This controls how much of an * individual unexpired commit will roll over upon contract transition. Must be * between 0 and 1. */ rollover_fraction?: number; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace RecurringCredit { /** * The amount of commit to grant. */ export interface AccessAmount { credit_type_id: string; unit_price: number; quantity?: number; } /** * The amount of time the created commits will be valid for */ export interface CommitDuration { value: number; unit?: 'PERIODS'; } export interface Product { id: string; name: string; } export interface Contract { id: string; } } export interface ResellerRoyalty { reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; segments: Array; } export namespace ResellerRoyalty { export interface Segment { fraction: number; netsuite_reseller_id: string; reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; starting_at: string; applicable_product_ids?: Array; applicable_product_tags?: Array; aws_account_number?: string; aws_offer_id?: string; aws_payer_reference_id?: string; ending_before?: string; gcp_account_id?: string; gcp_offer_id?: string; reseller_contract_value?: number; } } } export interface ContractWithoutAmendments { commits: Array; created_at: string; created_by: string; overrides: Array; scheduled_charges: Array; starting_at: string; transitions: Array; usage_statement_schedule: ContractWithoutAmendments.UsageStatementSchedule; credits?: Array; /** * This field's availability is dependent on your client's */ discounts?: Array; ending_before?: string; /** * Either a **parent** configuration with a list of children or a **child** * configuration with a single parent. */ hierarchy_configuration?: HierarchyConfiguration; name?: string; net_payment_terms_days?: number; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; prepaid_balance_threshold_configuration?: PrepaidBalanceThresholdConfiguration; /** * This field's availability is dependent on your client's configuration. */ professional_services?: Array; rate_card_id?: string; recurring_commits?: Array; recurring_credits?: Array; /** * This field's availability is dependent on your client's configuration. */ reseller_royalties?: Array; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * Determines which scheduled and commit charges to consolidate onto the Contract's * usage invoice. The charge's `timestamp` must match the usage invoice's * `ending_before` date for consolidation to occur. This field cannot be modified * after a Contract has been created. If this field is omitted, charges will appear * on a separate invoice from usage charges. */ scheduled_charges_on_usage_invoices?: 'ALL'; spend_threshold_configuration?: SpendThresholdConfiguration; /** * This field's availability is dependent on your client's configuration. */ total_contract_value?: number; usage_filter?: ContractWithoutAmendments.UsageFilter; } export namespace ContractWithoutAmendments { export interface Transition { from_contract_id: string; to_contract_id: string; type: 'SUPERSEDE' | 'RENEWAL'; } export interface UsageStatementSchedule { /** * Contract usage statements follow a selected cadence based on this date. */ billing_anchor_date: string; frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; } export interface RecurringCommit { id: string; /** * The amount of commit to grant. */ access_amount: RecurringCommit.AccessAmount; /** * The amount of time the created commits will be valid for */ commit_duration: RecurringCommit.CommitDuration; /** * Will be passed down to the individual commits */ priority: number; product: RecurringCommit.Product; /** * Whether the created commits will use the commit rate or list rate */ rate_type: 'COMMIT_RATE' | 'LIST_RATE'; /** * Determines the start time for the first commit */ starting_at: string; /** * Will be passed down to the individual commits */ applicable_product_ids?: Array; /** * Will be passed down to the individual commits */ applicable_product_tags?: Array; contract?: RecurringCommit.Contract; /** * Will be passed down to the individual commits */ description?: string; /** * Determines when the contract will stop creating recurring commits. Optional */ ending_before?: string; /** * Optional configuration for recurring commit/credit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * The amount the customer should be billed for the commit. Not required. */ invoice_amount?: RecurringCommit.InvoiceAmount; /** * Displayed on invoices. Will be passed through to the individual commits */ name?: string; /** * Will be passed down to the individual commits */ netsuite_sales_order_id?: string; /** * Determines whether the first and last commit will be prorated. If not provided, * the default is FIRST_AND_LAST (i.e. prorate both the first and last commits). */ proration?: 'NONE' | 'FIRST' | 'LAST' | 'FIRST_AND_LAST'; /** * The frequency at which the recurring commits will be created. If not provided: - * The commits will be created on the usage invoice frequency. If provided: - The * period defined in the duration will correspond to this frequency. - Commits will * be created aligned with the recurring commit's starting_at rather than the usage * invoice dates. */ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; /** * Will be passed down to the individual commits. This controls how much of an * individual unexpired commit will roll over upon contract transition. Must be * between 0 and 1. */ rollover_fraction?: number; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace RecurringCommit { /** * The amount of commit to grant. */ export interface AccessAmount { credit_type_id: string; unit_price: number; quantity?: number; } /** * The amount of time the created commits will be valid for */ export interface CommitDuration { value: number; unit?: 'PERIODS'; } export interface Product { id: string; name: string; } export interface Contract { id: string; } /** * The amount the customer should be billed for the commit. Not required. */ export interface InvoiceAmount { credit_type_id: string; quantity: number; unit_price: number; } } export interface RecurringCredit { id: string; /** * The amount of commit to grant. */ access_amount: RecurringCredit.AccessAmount; /** * The amount of time the created commits will be valid for */ commit_duration: RecurringCredit.CommitDuration; /** * Will be passed down to the individual commits */ priority: number; product: RecurringCredit.Product; /** * Whether the created commits will use the commit rate or list rate */ rate_type: 'COMMIT_RATE' | 'LIST_RATE'; /** * Determines the start time for the first commit */ starting_at: string; /** * Will be passed down to the individual commits */ applicable_product_ids?: Array; /** * Will be passed down to the individual commits */ applicable_product_tags?: Array; contract?: RecurringCredit.Contract; /** * Will be passed down to the individual commits */ description?: string; /** * Determines when the contract will stop creating recurring commits. Optional */ ending_before?: string; /** * Optional configuration for recurring commit/credit hierarchy access control */ hierarchy_configuration?: Shared.CommitHierarchyConfiguration; /** * Displayed on invoices. Will be passed through to the individual commits */ name?: string; /** * Will be passed down to the individual commits */ netsuite_sales_order_id?: string; /** * Determines whether the first and last commit will be prorated. If not provided, * the default is FIRST_AND_LAST (i.e. prorate both the first and last commits). */ proration?: 'NONE' | 'FIRST' | 'LAST' | 'FIRST_AND_LAST'; /** * The frequency at which the recurring commits will be created. If not provided: - * The commits will be created on the usage invoice frequency. If provided: - The * period defined in the duration will correspond to this frequency. - Commits will * be created aligned with the recurring commit's starting_at rather than the usage * invoice dates. */ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; /** * Will be passed down to the individual commits. This controls how much of an * individual unexpired commit will roll over upon contract transition. Must be * between 0 and 1. */ rollover_fraction?: number; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * Attach a subscription to the recurring commit/credit. */ subscription_config?: Shared.RecurringCommitSubscriptionConfig; } export namespace RecurringCredit { /** * The amount of commit to grant. */ export interface AccessAmount { credit_type_id: string; unit_price: number; quantity?: number; } /** * The amount of time the created commits will be valid for */ export interface CommitDuration { value: number; unit?: 'PERIODS'; } export interface Product { id: string; name: string; } export interface Contract { id: string; } } export interface ResellerRoyalty { fraction: number; netsuite_reseller_id: string; reseller_type: 'AWS' | 'AWS_PRO_SERVICE' | 'GCP' | 'GCP_PRO_SERVICE'; starting_at: string; applicable_product_ids?: Array; applicable_product_tags?: Array; aws_account_number?: string; aws_offer_id?: string; aws_payer_reference_id?: string; ending_before?: string; gcp_account_id?: string; gcp_offer_id?: string; reseller_contract_value?: number; } export interface UsageFilter { current: Shared.BaseUsageFilter | null; initial: Shared.BaseUsageFilter; updates: Array; } export namespace UsageFilter { export interface Update { group_key: string; group_values: Array; starting_at: string; } } } export interface Credit { id: string; product: Credit.Product; type: 'CREDIT'; /** * The schedule that the customer will gain access to the credits. */ access_schedule?: ScheduleDuration; applicable_contract_ids?: Array; applicable_product_ids?: Array; applicable_product_tags?: Array; /** * The current balance of the credit or commit. This balance reflects the amount of * credit or commit that the customer has access to use at this moment - thus, * expired and upcoming credit or commit segments contribute 0 to the balance. The * balance will match the sum of all ledger entries with the exception of the case * where the sum of negative manual ledger entries exceeds the positive amount * remaining on the credit or commit - in that case, the balance will be 0. All * manual ledger entries associated with active credit or commit segments are * included in the balance, including future-dated manual ledger entries. */ balance?: number; contract?: Credit.Contract; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; /** * Optional configuration for credit hierarchy access control */ hierarchy_configuration?: CommitHierarchyConfiguration; /** * A list of ordered events that impact the balance of a credit. For example, an * invoice deduction or an expiration. */ ledger?: Array< | Credit.CreditSegmentStartLedgerEntry | Credit.CreditAutomatedInvoiceDeductionLedgerEntry | Credit.CreditExpirationLedgerEntry | Credit.CreditCanceledLedgerEntry | Credit.CreditCreditedLedgerEntry | Credit.CreditManualLedgerEntry | Credit.CreditSeatBasedAdjustmentLedgerEntry >; name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; /** * If multiple credits or commits are applicable, the one with the lower priority * will apply first. */ priority?: number; rate_type?: 'COMMIT_RATE' | 'LIST_RATE'; /** * The ID of the recurring credit that this credit was generated from, if * applicable. */ recurring_credit_id?: string; /** * This field's availability is dependent on your client's configuration. */ salesforce_opportunity_id?: string; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. */ specifiers?: Array; /** * The subscription configuration for this credit, if it was generated from a * recurring credit with a subscription attached. */ subscription_config?: Credit.SubscriptionConfig; /** * Prevents the creation of duplicates. If a request to create a commit or credit * is made with a uniqueness key that was previously used to create a commit or * credit, a new record will not be created and the request will fail with a 409 * error. */ uniqueness_key?: string; } export namespace Credit { export interface Product { id: string; name: string; } export interface Contract { id: string; } export interface CreditSegmentStartLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_SEGMENT_START'; } export interface CreditAutomatedInvoiceDeductionLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_AUTOMATED_INVOICE_DEDUCTION'; contract_id?: string; } export interface CreditExpirationLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_EXPIRATION'; } export interface CreditCanceledLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_CANCELED'; contract_id?: string; } export interface CreditCreditedLedgerEntry { amount: number; invoice_id: string; segment_id: string; timestamp: string; type: 'CREDIT_CREDITED'; contract_id?: string; } export interface CreditManualLedgerEntry { amount: number; reason: string; timestamp: string; type: 'CREDIT_MANUAL'; } export interface CreditSeatBasedAdjustmentLedgerEntry { amount: number; segment_id: string; timestamp: string; type: 'CREDIT_SEAT_BASED_ADJUSTMENT'; } /** * The subscription configuration for this credit, if it was generated from a * recurring credit with a subscription attached. */ export interface SubscriptionConfig { allocation?: 'INDIVIDUAL' | 'POOLED'; apply_seat_increase_config?: SubscriptionConfig.ApplySeatIncreaseConfig; subscription_id?: string; } export namespace SubscriptionConfig { export interface ApplySeatIncreaseConfig { /** * Indicates whether a mid-period seat increase should be prorated. */ is_prorated: boolean; } } } export interface CreditTypeData { id: string; name: string; } export interface Discount { id: string; product: Discount.Product; schedule: SchedulePointInTime; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; } export namespace Discount { export interface Product { id: string; name: string; } } /** * An optional filtering rule to match the 'event_type' property of an event. */ export interface EventTypeFilter { /** * A list of event types that are explicitly included in the billable metric. If * specified, only events of these types will match the billable metric. Must be * non-empty if present. */ in_values?: Array; /** * A list of event types that are explicitly excluded from the billable metric. If * specified, events of these types will not match the billable metric. Must be * non-empty if present. */ not_in_values?: Array; } /** * Either a **parent** configuration with a list of children or a **child** * configuration with a single parent. */ export type HierarchyConfiguration = | HierarchyConfiguration.ParentHierarchyConfiguration | HierarchyConfiguration.ChildHierarchyConfiguration; export namespace HierarchyConfiguration { export interface ParentHierarchyConfiguration { /** * List of contracts that belong to this parent. */ children: Array; parent_behavior?: ParentHierarchyConfiguration.ParentBehavior; } export namespace ParentHierarchyConfiguration { export interface Child { contract_id: string; customer_id: string; } export interface ParentBehavior { /** * Indicates the desired behavior of consolidated invoices generated by the parent * in a customer hierarchy * * **CONCATENATE**: Statements on the invoices of child customers will be appended * to the consolidated invoice * * **NONE**: Do not generate consolidated invoices */ invoice_consolidation_type?: 'CONCATENATE' | 'NONE'; } } export interface ChildHierarchyConfiguration { /** * The single parent contract/customer for this child. */ parent: ChildHierarchyConfiguration.Parent; /** * Indicates which customer should pay for the child's invoice charges * * **SELF**: The child pays for its own invoice charges * * **PARENT**: The parent pays for the child's invoice charges */ payer?: 'SELF' | 'PARENT'; /** * Indicates the behavior of the child's invoice statements on the parent's * invoices. * * **CONSOLIDATE**: Child's invoice statements will be added to parent's * consolidated invoices * * **SEPARATE**: Child's invoice statements will appear not appear on parent's * consolidated invoices */ usage_statement_behavior?: 'CONSOLIDATE' | 'SEPARATE'; } export namespace ChildHierarchyConfiguration { /** * The single parent contract/customer for this child. */ export interface Parent { contract_id: string; customer_id: string; } } } export interface ID { id: string; } export interface Override { id: string; starting_at: string; applicable_product_tags?: Array; credit_type?: CreditTypeData; ending_before?: string; entitled?: boolean; is_commit_specific?: boolean; /** * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be * set to true. */ is_prorated?: boolean; multiplier?: number; override_specifiers?: Array; override_tiers?: Array; overwrite_rate?: OverwriteRate; /** * Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type, * this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1. */ price?: number; priority?: number; product?: Override.Product; /** * Default quantity. For SUBSCRIPTION rate_type, this must be >=0. */ quantity?: number; rate_type?: 'FLAT' | 'PERCENTAGE' | 'SUBSCRIPTION' | 'TIERED' | 'TIERED_PERCENTAGE' | 'CUSTOM'; target?: 'COMMIT_RATE' | 'LIST_RATE'; /** * Only set for TIERED rate_type. */ tiers?: Array; type?: 'OVERWRITE' | 'MULTIPLIER' | 'TIERED'; /** * Only set for CUSTOM rate_type. This field is interpreted by custom rate * processors. */ value?: { [key: string]: unknown }; } export namespace Override { export interface OverrideSpecifier { billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; commit_ids?: Array; presentation_group_values?: { [key: string]: string | null }; pricing_group_values?: { [key: string]: string }; product_id?: string; product_tags?: Array; recurring_commit_ids?: Array; recurring_credit_ids?: Array; } export interface Product { id: string; name: string; } } export interface OverrideTier { multiplier: number; size?: number; } export interface OverwriteRate { rate_type: 'FLAT' | 'PERCENTAGE' | 'SUBSCRIPTION' | 'TIERED' | 'TIERED_PERCENTAGE' | 'CUSTOM'; credit_type?: CreditTypeData; /** * Only set for CUSTOM rate_type. This field is interpreted by custom rate * processors. */ custom_rate?: { [key: string]: unknown }; /** * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be * set to true. */ is_prorated?: boolean; /** * Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type, * this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1. */ price?: number; /** * Default quantity. For SUBSCRIPTION rate_type, this must be >=0. */ quantity?: number; /** * Only set for TIERED rate_type. */ tiers?: Array; } export interface PaymentGateConfig { /** * Gate access to the commit balance based on successful collection of payment. * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to * facilitate payment using your own payment integration. Select NONE if you do not * wish to payment gate the commit balance. */ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL'; /** * Only applicable if using PRECALCULATED as your tax type. */ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig; /** * Only applicable if using STRIPE as your payment gate type. */ stripe_config?: PaymentGateConfig.StripeConfig; /** * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do * not wish Metronome to calculate tax on your behalf. Leaving this field blank * will default to NONE. */ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED'; } export namespace PaymentGateConfig { /** * Only applicable if using PRECALCULATED as your tax type. */ export interface PrecalculatedTaxConfig { /** * Amount of tax to be applied. This should be in the same currency and * denomination as the commit's invoice schedule */ tax_amount: number; /** * Name of the tax to be applied. This may be used in an invoice line item * description. */ tax_name?: string; } /** * Only applicable if using STRIPE as your payment gate type. */ export interface StripeConfig { /** * If left blank, will default to INVOICE */ payment_type: 'INVOICE' | 'PAYMENT_INTENT'; /** * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as * your payment type. */ invoice_metadata?: { [key: string]: string }; } } export interface PaymentGateConfigV2 { /** * Gate access to the commit balance based on successful collection of payment. * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to * facilitate payment using your own payment integration. Select NONE if you do not * wish to payment gate the commit balance. */ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL'; /** * Only applicable if using PRECALCULATED as your tax type. */ precalculated_tax_config?: PaymentGateConfigV2.PrecalculatedTaxConfig; /** * Only applicable if using STRIPE as your payment gateway type. */ stripe_config?: PaymentGateConfigV2.StripeConfig; /** * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do * not wish Metronome to calculate tax on your behalf. Leaving this field blank * will default to NONE. */ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED'; } export namespace PaymentGateConfigV2 { /** * Only applicable if using PRECALCULATED as your tax type. */ export interface PrecalculatedTaxConfig { /** * Amount of tax to be applied. This should be in the same currency and * denomination as the commit's invoice schedule */ tax_amount: number; /** * Name of the tax to be applied. This may be used in an invoice line item * description. */ tax_name?: string; } /** * Only applicable if using STRIPE as your payment gateway type. */ export interface StripeConfig { /** * If left blank, will default to INVOICE */ payment_type: 'INVOICE' | 'PAYMENT_INTENT'; /** * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as * your payment type. */ invoice_metadata?: { [key: string]: string }; } } export interface PrepaidBalanceThresholdConfiguration { commit: PrepaidBalanceThresholdConfiguration.Commit; /** * When set to false, the contract will not be evaluated against the * threshold_amount. Toggling to true will result an immediate evaluation, * regardless of prior state. */ is_enabled: boolean; payment_gate_config: PaymentGateConfig; /** * Specify the amount the balance should be recharged to. */ recharge_to_amount: number; /** * Specify the threshold amount for the contract. Each time the contract's prepaid * balance lowers to this amount, a threshold charge will be initiated. */ threshold_amount: number; /** * If provided, the threshold, recharge-to amount, and the resulting threshold * commit amount will be in terms of this credit type instead of the fiat currency. */ custom_credit_type_id?: string; } export namespace PrepaidBalanceThresholdConfiguration { export interface Commit extends Shared.BaseThresholdCommit { /** * Which products the threshold commit applies to. If applicable_product_ids, * applicable_product_tags or specifiers are not provided, the commit applies to * all products. */ applicable_product_ids?: Array; /** * Which tags the threshold commit applies to. If applicable_product_ids, * applicable_product_tags or specifiers are not provided, the commit applies to * all products. */ applicable_product_tags?: Array; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. This field cannot * be used together with `applicable_product_ids` or `applicable_product_tags`. */ specifiers?: Array; } } export interface PrepaidBalanceThresholdConfigurationV2 { commit: PrepaidBalanceThresholdConfigurationV2.Commit; /** * When set to false, the contract will not be evaluated against the * threshold_amount. Toggling to true will result an immediate evaluation, * regardless of prior state. */ is_enabled: boolean; payment_gate_config: PaymentGateConfigV2; /** * Specify the amount the balance should be recharged to. */ recharge_to_amount: number; /** * Specify the threshold amount for the contract. Each time the contract's balance * lowers to this amount, a threshold charge will be initiated. */ threshold_amount: number; /** * If provided, the threshold, recharge-to amount, and the resulting threshold * commit amount will be in terms of this credit type instead of the fiat currency. */ custom_credit_type_id?: string; } export namespace PrepaidBalanceThresholdConfigurationV2 { export interface Commit extends Shared.UpdateBaseThresholdCommit { /** * Which products the threshold commit applies to. If applicable_product_ids, * applicable_product_tags or specifiers are not provided, the commit applies to * all products. */ applicable_product_ids?: Array; /** * Which tags the threshold commit applies to. If applicable_product_ids, * applicable_product_tags or specifiers are not provided, the commit applies to * all products. */ applicable_product_tags?: Array; /** * List of filters that determine what kind of customer usage draws down a commit * or credit. A customer's usage needs to meet the condition of at least one of the * specifiers to contribute to a commit's or credit's drawdown. This field cannot * be used together with `applicable_product_ids` or `applicable_product_tags`. * Instead, to target usage by product or product tag, pass those values in the * body of `specifiers`. */ specifiers?: Array; } } export interface PropertyFilter { /** * The name of the event property. */ name: string; /** * Determines whether the property must exist in the event. If true, only events * with this property will pass the filter. If false, only events without this * property will pass the filter. If null or omitted, the existence of the property * is optional. */ exists?: boolean; /** * Specifies the allowed values for the property to match an event. An event will * pass the filter only if its property value is included in this list. If * undefined, all property values will pass the filter. Must be non-empty if * present. */ in_values?: Array; /** * Specifies the values that prevent an event from matching the filter. An event * will not pass the filter if its property value is included in this list. If null * or empty, all property values will pass the filter. Must be non-empty if * present. */ not_in_values?: Array; } export interface ProService { id: string; /** * Maximum amount for the term. */ max_amount: number; product_id: string; /** * Quantity for the charge. Will be multiplied by unit_price to determine the * amount. */ quantity: number; /** * Unit price for the charge. Will be multiplied by quantity to determine the * amount and must be specified. */ unit_price: number; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; } export interface Rate { rate_type: 'FLAT' | 'PERCENTAGE' | 'SUBSCRIPTION' | 'CUSTOM' | 'TIERED' | 'TIERED_PERCENTAGE'; credit_type?: CreditTypeData; /** * Only set for CUSTOM rate_type. This field is interpreted by custom rate * processors. */ custom_rate?: { [key: string]: unknown }; /** * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be * set to true. */ is_prorated?: boolean; /** * Default price. For FLAT rate_type, this must be >=0. For PERCENTAGE rate_type, * this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1. */ price?: number; /** * if pricing groups are used, this will contain the values used to calculate the * price */ pricing_group_values?: { [key: string]: string }; /** * Default quantity. For SUBSCRIPTION rate_type, this must be >=0. */ quantity?: number; /** * Only set for TIERED rate_type. */ tiers?: Array; } export interface RecurringCommitSubscriptionConfig { allocation: 'INDIVIDUAL' | 'POOLED'; apply_seat_increase_config: RecurringCommitSubscriptionConfig.ApplySeatIncreaseConfig; subscription_id: string; } export namespace RecurringCommitSubscriptionConfig { export interface ApplySeatIncreaseConfig { /** * Indicates whether a mid-period seat increase should be prorated. */ is_prorated: boolean; } } export interface ScheduledCharge { id: string; product: ScheduledCharge.Product; schedule: SchedulePointInTime; archived_at?: string; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; /** * displayed on invoices */ name?: string; /** * This field's availability is dependent on your client's configuration. */ netsuite_sales_order_id?: string; } export namespace ScheduledCharge { export interface Product { id: string; name: string; } } export interface ScheduleDuration { schedule_items: Array; credit_type?: CreditTypeData; } export namespace ScheduleDuration { export interface ScheduleItem { id: string; amount: number; ending_before: string; starting_at: string; } } export interface SchedulePointInTime { credit_type?: CreditTypeData; /** * This field is only applicable to commit invoice schedules. If true, this * schedule will not generate an invoice. */ do_not_invoice?: boolean; schedule_items?: Array; } export namespace SchedulePointInTime { export interface ScheduleItem { id: string; amount: number; quantity: number; timestamp: string; unit_price: number; invoice_id?: string | null; } } export interface SpendThresholdConfiguration { commit: BaseThresholdCommit; /** * When set to false, the contract will not be evaluated against the * threshold_amount. Toggling to true will result an immediate evaluation, * regardless of prior state. */ is_enabled: boolean; payment_gate_config: PaymentGateConfig; /** * Specify the threshold amount for the contract. Each time the contract's usage * hits this amount, a threshold charge will be initiated. */ threshold_amount: number; } export interface SpendThresholdConfigurationV2 { commit: UpdateBaseThresholdCommit; /** * When set to false, the contract will not be evaluated against the * threshold_amount. Toggling to true will result an immediate evaluation, * regardless of prior state. */ is_enabled: boolean; payment_gate_config: PaymentGateConfigV2; /** * Specify the threshold amount for the contract. Each time the contract's usage * hits this amount, a threshold charge will be initiated. */ threshold_amount: number; } export interface Subscription { /** * Previous, current, and next billing periods for the subscription. */ billing_periods: Subscription.BillingPeriods; collection_schedule: 'ADVANCE' | 'ARREARS'; proration: Subscription.Proration; /** * Determines how the subscription's quantity is controlled. Defaults to * QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified * directly on the subscription. `initial_quantity` must be provided with this * option. Compatible with recurring commits/credits that use POOLED allocation. * **SEAT_BASED**: Use when you want to pass specific seat identifiers (e.g. add * user_123) to increment and decrement a subscription quantity, rather than * directly providing the quantity. You must use a **SEAT_BASED** subscription to * use a linked recurring credit with an allocation per seat. `seat_config` must be * provided with this option. */ quantity_management_mode: 'SEAT_BASED' | 'QUANTITY_ONLY'; /** * List of quantity schedule items for the subscription. Only includes the current * quantity and future quantity changes. */ quantity_schedule: Array; starting_at: string; subscription_rate: Subscription.SubscriptionRate; id?: string; /** * Custom fields to be added eg. { "key1": "value1", "key2": "value2" } */ custom_fields?: { [key: string]: string }; description?: string; ending_before?: string; fiat_credit_type_id?: string; name?: string; seat_config?: Subscription.SeatConfig; } export namespace Subscription { /** * Previous, current, and next billing periods for the subscription. */ export interface BillingPeriods { current?: BillingPeriods.Current; next?: BillingPeriods.Next; previous?: BillingPeriods.Previous; } export namespace BillingPeriods { export interface Current { ending_before: string; starting_at: string; } export interface Next { ending_before: string; starting_at: string; } export interface Previous { ending_before: string; starting_at: string; } } export interface Proration { invoice_behavior: 'BILL_IMMEDIATELY' | 'BILL_ON_NEXT_COLLECTION_DATE'; is_prorated: boolean; } export interface QuantitySchedule { quantity: number; starting_at: string; ending_before?: string; } export interface SubscriptionRate { billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY'; product: SubscriptionRate.Product; } export namespace SubscriptionRate { export interface Product { id: string; name: string; } } export interface SeatConfig { /** * The property name, sent on usage events, that identifies the seat ID associated * with the usage event. For example, the property name might be seat_id or * user_id. The property must be set as a group key on billable metrics and a * presentation/pricing group key on contract products. This allows linked * recurring credits with an allocation per seat to be consumed by only one seat's * usage. */ seat_group_key: string; } } export interface Tier { price: number; size?: number; } export interface UpdateBaseThresholdCommit { description?: string; /** * Specify the name of the line item for the threshold charge. If left blank, it * will default to the commit product name. */ name?: string; /** * The commit product that will be used to generate the line item for commit * payment. */ product_id?: string; } export type CommitsBodyCursorPage = BodyCursorPage; export type CreditsBodyCursorPage = BodyCursorPage;