## Create `v1.contracts.create(**kwargs) -> ContractCreateResponse` **post** `/v1/contracts/create` Create a new contract ### Parameters - **customer\_id:** `String` - **starting\_at:** `Time` inclusive contract start time - **billing\_provider\_configuration:** `{ billing_provider, billing_provider_configuration_id, delivery_method}` The billing provider configuration associated with a contract. Provide either an ID or the provider and delivery method. - **billing\_provider:** `:aws_marketplace | :azure_marketplace | :gcp_marketplace | 2 more` Do not specify if using billing_provider_configuration_id. - `:aws_marketplace` - `:azure_marketplace` - `:gcp_marketplace` - `:stripe` - `:netsuite` - **billing\_provider\_configuration\_id:** `String` The Metronome ID of the billing provider configuration. Use when a customer has multiple configurations with the same billing provider and delivery method. Otherwise, specify the billing_provider and delivery_method. - **delivery\_method:** `:direct_to_billing_provider | :aws_sqs | :tackle | :aws_sns` Do not specify if using billing_provider_configuration_id. - `:direct_to_billing_provider` - `:aws_sqs` - `:tackle` - `:aws_sns` - **commits:** `Array[{ product_id, type, access_schedule, 15 more}]` - **product\_id:** `String` - **type:** `:PREPAID | :POSTPAID` - `:PREPAID` - `:POSTPAID` - **access\_schedule:** `{ schedule_items, credit_type_id}` Required: Schedule for distributing the commit to the customer. For "POSTPAID" commits only one schedule item is allowed and amount must match invoice_schedule total. - **schedule\_items:** `Array[{ amount, ending_before, starting_at}]` - **amount:** `Float` - **ending\_before:** `Time` RFC 3339 timestamp (exclusive) - **starting\_at:** `Time` RFC 3339 timestamp (inclusive) - **credit\_type\_id:** `String` Defaults to USD (cents) if not passed - **amount:** `Float` (DEPRECATED) Use access_schedule and invoice_schedule instead. - **applicable\_product\_ids:** `Array[String]` Which products the 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[String]` Which tags the commit applies to. If applicable_product_ids, applicable_product_tags or specifiers are not provided, the commit applies to all products. - **custom\_fields:** `Hash[Symbol, String]` - **description:** `String` Used only in UI/API. It is not exposed to end customers. - **hierarchy\_configuration:** `{ child_access}` Optional configuration for commit hierarchy access control - **child\_access:** `{ type} | { type} | { contract_ids, type}` - `class CommitHierarchyChildAccessAll` - **type:** `:ALL` - `:ALL` - `class CommitHierarchyChildAccessNone` - **type:** `:NONE` - `:NONE` - `class CommitHierarchyChildAccessContractIDs` - **contract\_ids:** `Array[String]` - **type:** `:CONTRACT_IDS` - `:CONTRACT_IDS` - **invoice\_schedule:** `{ credit_type_id, do_not_invoice, recurring_schedule, schedule_items}` Required for "POSTPAID" commits: the true up invoice will be generated at this time and only one schedule item is allowed; the total must match access_schedule amount. Optional for "PREPAID" commits: if not provided, this will be a "complimentary" commit with no invoice. - **credit\_type\_id:** `String` Defaults to USD (cents) if not passed. - **do\_not\_invoice:** `bool` This field is only applicable to commit invoice schedules. If true, this schedule will not generate an invoice. - **recurring\_schedule:** `{ amount_distribution, ending_before, frequency, 4 more}` Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1. - **amount\_distribution:** `:DIVIDED | :DIVIDED_ROUNDED | :EACH` - `:DIVIDED` - `:DIVIDED_ROUNDED` - `:EACH` - **ending\_before:** `Time` RFC 3339 timestamp (exclusive). - **frequency:** `:MONTHLY | :QUARTERLY | :SEMI_ANNUAL | :ANNUAL` - `:MONTHLY` - `:QUARTERLY` - `:SEMI_ANNUAL` - `:ANNUAL` - **starting\_at:** `Time` RFC 3339 timestamp (inclusive). - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **schedule\_items:** `Array[{ timestamp, amount, quantity, unit_price}]` Either provide amount or provide both unit_price and quantity. - **timestamp:** `Time` timestamp of the scheduled event - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **name:** `String` displayed on invoices - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **payment\_gate\_config:** `{ payment_gate_type, precalculated_tax_config, stripe_config, tax_type}` optionally payment gate this commit - **payment\_gate\_type:** `:NONE | :STRIPE | :EXTERNAL` 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. - `:NONE` - `:STRIPE` - `:EXTERNAL` - **precalculated\_tax\_config:** `{ tax_amount, tax_name}` Only applicable if using PRECALCULATED as your tax type. - **tax\_amount:** `Float` Amount of tax to be applied. This should be in the same currency and denomination as the commit's invoice schedule - **tax\_name:** `String` Name of the tax to be applied. This may be used in an invoice line item description. - **stripe\_config:** `{ payment_type, invoice_metadata}` Only applicable if using STRIPE as your payment gate type. - **payment\_type:** `:INVOICE | :PAYMENT_INTENT` If left blank, will default to INVOICE - `:INVOICE` - `:PAYMENT_INTENT` - **invoice\_metadata:** `Hash[Symbol, String]` Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as your payment type. - **tax\_type:** `:NONE | :STRIPE | :ANROK | :PRECALCULATED` 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. - `:NONE` - `:STRIPE` - `:ANROK` - `:PRECALCULATED` - **priority:** `Float` If multiple commits are applicable, the one with the lower priority will apply first. - **rate\_type:** `:COMMIT_RATE | :LIST_RATE` - `:COMMIT_RATE` - `:LIST_RATE` - **rollover\_fraction:** `Float` Fraction of unused segments that will be rolled over. Must be between 0 and 1. - **specifiers:** `Array[{ presentation_group_values, pricing_group_values, product_id, product_tags}]` 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`. - **presentation\_group\_values:** `Hash[Symbol, String]` - **pricing\_group\_values:** `Hash[Symbol, String]` - **product\_id:** `String` If provided, the specifier will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the specifier will only apply to products with all the specified tags. - **temporary\_id:** `String` A temporary ID for the commit that can be used to reference the commit for commit specific overrides. - **credits:** `Array[{ access_schedule, product_id, applicable_product_ids, 9 more}]` - **access\_schedule:** `{ schedule_items, credit_type_id}` Schedule for distributing the credit to the customer. - **schedule\_items:** `Array[{ amount, ending_before, starting_at}]` - **amount:** `Float` - **ending\_before:** `Time` RFC 3339 timestamp (exclusive) - **starting\_at:** `Time` RFC 3339 timestamp (inclusive) - **credit\_type\_id:** `String` Defaults to USD (cents) if not passed - **product\_id:** `String` - **applicable\_product\_ids:** `Array[String]` Which products the credit applies to. If both applicable_product_ids and applicable_product_tags are not provided, the credit applies to all products. - **applicable\_product\_tags:** `Array[String]` Which tags the credit applies to. If both applicable_product_ids and applicable_product_tags are not provided, the credit applies to all products. - **custom\_fields:** `Hash[Symbol, String]` - **description:** `String` Used only in UI/API. It is not exposed to end customers. - **hierarchy\_configuration:** `{ child_access}` Optional configuration for credit hierarchy access control - **child\_access:** `{ type} | { type} | { contract_ids, type}` - `class CommitHierarchyChildAccessAll` - **type:** `:ALL` - `:ALL` - `class CommitHierarchyChildAccessNone` - **type:** `:NONE` - `:NONE` - `class CommitHierarchyChildAccessContractIDs` - **contract\_ids:** `Array[String]` - **type:** `:CONTRACT_IDS` - `:CONTRACT_IDS` - **name:** `String` displayed on invoices - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **priority:** `Float` If multiple credits are applicable, the one with the lower priority will apply first. - **rate\_type:** `:COMMIT_RATE | :LIST_RATE` - `:COMMIT_RATE` - `:LIST_RATE` - **specifiers:** `Array[{ presentation_group_values, pricing_group_values, product_id, product_tags}]` 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`. - **presentation\_group\_values:** `Hash[Symbol, String]` - **pricing\_group\_values:** `Hash[Symbol, String]` - **product\_id:** `String` If provided, the specifier will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the specifier will only apply to products with all the specified tags. - **custom\_fields:** `Hash[Symbol, String]` - **discounts:** `Array[{ product_id, schedule, custom_fields, 2 more}]` This field's availability is dependent on your client's configuration. - **product\_id:** `String` - **schedule:** `{ credit_type_id, do_not_invoice, recurring_schedule, schedule_items}` Must provide either schedule_items or recurring_schedule. - **credit\_type\_id:** `String` Defaults to USD (cents) if not passed. - **do\_not\_invoice:** `bool` This field is only applicable to commit invoice schedules. If true, this schedule will not generate an invoice. - **recurring\_schedule:** `{ amount_distribution, ending_before, frequency, 4 more}` Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1. - **amount\_distribution:** `:DIVIDED | :DIVIDED_ROUNDED | :EACH` - `:DIVIDED` - `:DIVIDED_ROUNDED` - `:EACH` - **ending\_before:** `Time` RFC 3339 timestamp (exclusive). - **frequency:** `:MONTHLY | :QUARTERLY | :SEMI_ANNUAL | :ANNUAL` - `:MONTHLY` - `:QUARTERLY` - `:SEMI_ANNUAL` - `:ANNUAL` - **starting\_at:** `Time` RFC 3339 timestamp (inclusive). - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **schedule\_items:** `Array[{ timestamp, amount, quantity, unit_price}]` Either provide amount or provide both unit_price and quantity. - **timestamp:** `Time` timestamp of the scheduled event - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **custom\_fields:** `Hash[Symbol, String]` - **name:** `String` displayed on invoices - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **ending\_before:** `Time` exclusive contract end time - **hierarchy\_configuration:** `{ parent}` - **parent:** `{ contract_id, customer_id}` - **contract\_id:** `String` - **customer\_id:** `String` - **multiplier\_override\_prioritization:** `:LOWEST_MULTIPLIER | :EXPLICIT` 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. If tiered overrides are used, prioritization must be explicit. - `:LOWEST_MULTIPLIER` - `:EXPLICIT` - **name:** `String` - **net\_payment\_terms\_days:** `Float` - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **overrides:** `Array[{ starting_at, applicable_product_tags, ending_before, 10 more}]` - **starting\_at:** `Time` RFC 3339 timestamp indicating when the override will start applying (inclusive) - **applicable\_product\_tags:** `Array[String]` tags identifying products whose rates are being overridden. Cannot be used in conjunction with override_specifiers. - **ending\_before:** `Time` RFC 3339 timestamp indicating when the override will stop applying (exclusive) - **entitled:** `bool` - **is\_commit\_specific:** `bool` Indicates whether the override should only apply to commits. Defaults to `false`. If `true`, you can specify relevant commits in `override_specifiers` by passing `commit_ids`. if you do not specify `commit_ids`, then the override will apply when consuming any prepaid or postpaid commit. - **multiplier:** `Float` Required for MULTIPLIER type. Must be >=0. - **override\_specifiers:** `Array[{ billing_frequency, commit_ids, presentation_group_values, 5 more}]` Cannot be used in conjunction with product_id or applicable_product_tags. If provided, the override will apply to all products with the specified specifiers. - **billing\_frequency:** `:MONTHLY | :QUARTERLY | :ANNUAL | :WEEKLY` - `:MONTHLY` - `:QUARTERLY` - `:ANNUAL` - `:WEEKLY` - **commit\_ids:** `Array[String]` Can only be used for commit specific overrides. Must be used in conjunction with one of product_id, product_tags, pricing_group_values, or presentation_group_values. If provided, the override will only apply to the specified commits. If not provided, the override will apply to all commits. - **presentation\_group\_values:** `Hash[Symbol, String]` A map of group names to values. The override will only apply to line items with the specified presentation group values. - **pricing\_group\_values:** `Hash[Symbol, String]` A map of pricing group names to values. The override will only apply to products with the specified pricing group values. - **product\_id:** `String` If provided, the override will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the override will only apply to products with all the specified tags. - **recurring\_commit\_ids:** `Array[String]` Can only be used for commit specific overrides. Must be used in conjunction with one of product_id, product_tags, pricing_group_values, or presentation_group_values. If provided, the override will only apply to commits created by the specified recurring commit ids. - **recurring\_credit\_ids:** `Array[String]` Can only be used for commit specific overrides. Must be used in conjunction with one of product_id, product_tags, pricing_group_values, or presentation_group_values. If provided, the override will only apply to credits created by the specified recurring credit ids. - **overwrite\_rate:** `{ rate_type, credit_type_id, custom_rate, 4 more}` Required for OVERWRITE type. - **rate\_type:** `:FLAT | :PERCENTAGE | :SUBSCRIPTION | 2 more` - `:FLAT` - `:PERCENTAGE` - `:SUBSCRIPTION` - `:TIERED` - `:CUSTOM` - **credit\_type\_id:** `String` - **custom\_rate:** `Hash[Symbol, untyped]` Only set for CUSTOM rate_type. This field is interpreted by custom rate processors. - **is\_prorated:** `bool` Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be set to true. - **price:** `Float` 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. - **quantity:** `Float` Default quantity. For SUBSCRIPTION rate_type, this must be >=0. - **tiers:** `Array[Tier]` Only set for TIERED rate_type. - **price:** `Float` - **size:** `Float` - **priority:** `Float` Required for EXPLICIT multiplier prioritization scheme and all TIERED overrides. Under EXPLICIT prioritization, overwrites are prioritized first, and then tiered and multiplier overrides are prioritized by their priority value (lowest first). Must be > 0. - **product\_id:** `String` ID of the product whose rate is being overridden. Cannot be used in conjunction with override_specifiers. - **target:** `:COMMIT_RATE | :LIST_RATE` Indicates whether the override applies to commit rates or list rates. Can only be used for overrides that have `is_commit_specific` set to `true`. Defaults to `"LIST_RATE"`. - `:COMMIT_RATE` - `:LIST_RATE` - **tiers:** `Array[{ multiplier, size}]` Required for TIERED type. Must have at least one tier. - **multiplier:** `Float` - **size:** `Float` - **type:** `:OVERWRITE | :MULTIPLIER | :TIERED` Overwrites are prioritized over multipliers and tiered overrides. - `:OVERWRITE` - `:MULTIPLIER` - `:TIERED` - **prepaid\_balance\_threshold\_configuration:** `{ commit, is_enabled, payment_gate_config, 3 more}` - **commit:** `{ product_id, applicable_product_ids, applicable_product_tags, 3 more}` - **product\_id:** `String` The commit product that will be used to generate the line item for commit payment. - **applicable\_product\_ids:** `Array[String]` 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\_tags:** `Array[String]` 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. - **description:** `String` - **name:** `String` Specify the name of the line item for the threshold charge. If left blank, it will default to the commit product name. - **specifiers:** `Array[{ presentation_group_values, pricing_group_values, product_id, product_tags}]` 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`. - **presentation\_group\_values:** `Hash[Symbol, String]` - **pricing\_group\_values:** `Hash[Symbol, String]` - **product\_id:** `String` If provided, the specifier will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the specifier will only apply to products with all the specified tags. - **is\_enabled:** `bool` 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. - **payment\_gate\_config:** `{ payment_gate_type, precalculated_tax_config, stripe_config, tax_type}` - **payment\_gate\_type:** `:NONE | :STRIPE | :EXTERNAL` 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. - `:NONE` - `:STRIPE` - `:EXTERNAL` - **precalculated\_tax\_config:** `{ tax_amount, tax_name}` Only applicable if using PRECALCULATED as your tax type. - **tax\_amount:** `Float` Amount of tax to be applied. This should be in the same currency and denomination as the commit's invoice schedule - **tax\_name:** `String` Name of the tax to be applied. This may be used in an invoice line item description. - **stripe\_config:** `{ payment_type, invoice_metadata}` Only applicable if using STRIPE as your payment gate type. - **payment\_type:** `:INVOICE | :PAYMENT_INTENT` If left blank, will default to INVOICE - `:INVOICE` - `:PAYMENT_INTENT` - **invoice\_metadata:** `Hash[Symbol, String]` Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as your payment type. - **tax\_type:** `:NONE | :STRIPE | :ANROK | :PRECALCULATED` 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. - `:NONE` - `:STRIPE` - `:ANROK` - `:PRECALCULATED` - **recharge\_to\_amount:** `Float` Specify the amount the balance should be recharged to. - **threshold\_amount:** `Float` Specify the threshold amount for the contract. Each time the contract's prepaid balance lowers to this amount, a threshold charge will be initiated. - **custom\_credit\_type\_id:** `String` 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. - **priority:** `Float` Priority of the contract. - **professional\_services:** `Array[{ max_amount, product_id, quantity, 4 more}]` This field's availability is dependent on your client's configuration. - **max\_amount:** `Float` Maximum amount for the term. - **product\_id:** `String` - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified. - **custom\_fields:** `Hash[Symbol, String]` - **description:** `String` - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **rate\_card\_alias:** `String` Selects the rate card linked to the specified alias as of the contract's start date. - **rate\_card\_id:** `String` - **recurring\_commits:** `Array[{ access_amount, commit_duration, priority, 17 more}]` - **access\_amount:** `{ credit_type_id, unit_price, quantity}` The amount of commit to grant. - **credit\_type\_id:** `String` - **unit\_price:** `Float` - **quantity:** `Float` This field is required unless a subscription is attached via `subscription_config`. - **commit\_duration:** `{ value, unit}` Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency. - **value:** `Float` - **unit:** `:PERIODS` - `:PERIODS` - **priority:** `Float` Will be passed down to the individual commits - **product\_id:** `String` - **starting\_at:** `Time` determines the start time for the first commit - **applicable\_product\_ids:** `Array[String]` Will be passed down to the individual commits - **applicable\_product\_tags:** `Array[String]` Will be passed down to the individual commits - **description:** `String` Will be passed down to the individual commits - **ending\_before:** `Time` Determines when the contract will stop creating recurring commits. optional - **hierarchy\_configuration:** `{ child_access}` Optional configuration for recurring commit/credit hierarchy access control - **child\_access:** `{ type} | { type} | { contract_ids, type}` - `class CommitHierarchyChildAccessAll` - **type:** `:ALL` - `:ALL` - `class CommitHierarchyChildAccessNone` - **type:** `:NONE` - `:NONE` - `class CommitHierarchyChildAccessContractIDs` - **contract\_ids:** `Array[String]` - **type:** `:CONTRACT_IDS` - `:CONTRACT_IDS` - **invoice\_amount:** `{ credit_type_id, quantity, unit_price}` The amount the customer should be billed for the commit. Not required. - **credit\_type\_id:** `String` - **quantity:** `Float` - **unit\_price:** `Float` - **name:** `String` displayed on invoices. will be passed through to the individual commits - **netsuite\_sales\_order\_id:** `String` Will be passed down to the individual commits - **proration:** `:NONE | :FIRST | :LAST | :FIRST_AND_LAST` 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). - `:NONE` - `:FIRST` - `:LAST` - `:FIRST_AND_LAST` - **rate\_type:** `:COMMIT_RATE | :LIST_RATE` Whether the created commits will use the commit rate or list rate - `:COMMIT_RATE` - `:LIST_RATE` - **recurrence\_frequency:** `:MONTHLY | :QUARTERLY | :ANNUAL | :WEEKLY` 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. - `:MONTHLY` - `:QUARTERLY` - `:ANNUAL` - `:WEEKLY` - **rollover\_fraction:** `Float` 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. - **specifiers:** `Array[{ presentation_group_values, pricing_group_values, product_id, product_tags}]` 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`. - **presentation\_group\_values:** `Hash[Symbol, String]` - **pricing\_group\_values:** `Hash[Symbol, String]` - **product\_id:** `String` If provided, the specifier will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the specifier will only apply to products with all the specified tags. - **subscription\_config:** `{ apply_seat_increase_config, subscription_id, allocation}` Attach a subscription to the recurring commit/credit. - **apply\_seat\_increase\_config:** `{ is_prorated}` - **is\_prorated:** `bool` Indicates whether a mid-period seat increase should be prorated. - **subscription\_id:** `String` ID of the subscription to configure on the recurring commit/credit. - **allocation:** `:POOLED` If set to POOLED, allocation added per seat is pooled across the account. - `:POOLED` - **temporary\_id:** `String` A temporary ID that can be used to reference the recurring commit for commit specific overrides. - **recurring\_credits:** `Array[{ access_amount, commit_duration, priority, 16 more}]` - **access\_amount:** `{ credit_type_id, unit_price, quantity}` The amount of commit to grant. - **credit\_type\_id:** `String` - **unit\_price:** `Float` - **quantity:** `Float` This field is required unless a subscription is attached via `subscription_config`. - **commit\_duration:** `{ value, unit}` Defines the length of the access schedule for each created commit/credit. The value represents the number of units. Unit defaults to "PERIODS", where the length of a period is determined by the recurrence_frequency. - **value:** `Float` - **unit:** `:PERIODS` - `:PERIODS` - **priority:** `Float` Will be passed down to the individual commits - **product\_id:** `String` - **starting\_at:** `Time` determines the start time for the first commit - **applicable\_product\_ids:** `Array[String]` Will be passed down to the individual commits - **applicable\_product\_tags:** `Array[String]` Will be passed down to the individual commits - **description:** `String` Will be passed down to the individual commits - **ending\_before:** `Time` Determines when the contract will stop creating recurring commits. optional - **hierarchy\_configuration:** `{ child_access}` Optional configuration for recurring commit/credit hierarchy access control - **child\_access:** `{ type} | { type} | { contract_ids, type}` - `class CommitHierarchyChildAccessAll` - **type:** `:ALL` - `:ALL` - `class CommitHierarchyChildAccessNone` - **type:** `:NONE` - `:NONE` - `class CommitHierarchyChildAccessContractIDs` - **contract\_ids:** `Array[String]` - **type:** `:CONTRACT_IDS` - `:CONTRACT_IDS` - **name:** `String` displayed on invoices. will be passed through to the individual commits - **netsuite\_sales\_order\_id:** `String` Will be passed down to the individual commits - **proration:** `:NONE | :FIRST | :LAST | :FIRST_AND_LAST` 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). - `:NONE` - `:FIRST` - `:LAST` - `:FIRST_AND_LAST` - **rate\_type:** `:COMMIT_RATE | :LIST_RATE` Whether the created commits will use the commit rate or list rate - `:COMMIT_RATE` - `:LIST_RATE` - **recurrence\_frequency:** `:MONTHLY | :QUARTERLY | :ANNUAL | :WEEKLY` 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. - `:MONTHLY` - `:QUARTERLY` - `:ANNUAL` - `:WEEKLY` - **rollover\_fraction:** `Float` 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. - **specifiers:** `Array[{ presentation_group_values, pricing_group_values, product_id, product_tags}]` 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`. - **presentation\_group\_values:** `Hash[Symbol, String]` - **pricing\_group\_values:** `Hash[Symbol, String]` - **product\_id:** `String` If provided, the specifier will only apply to the product with the specified ID. - **product\_tags:** `Array[String]` If provided, the specifier will only apply to products with all the specified tags. - **subscription\_config:** `{ apply_seat_increase_config, subscription_id, allocation}` Attach a subscription to the recurring commit/credit. - **apply\_seat\_increase\_config:** `{ is_prorated}` - **is\_prorated:** `bool` Indicates whether a mid-period seat increase should be prorated. - **subscription\_id:** `String` ID of the subscription to configure on the recurring commit/credit. - **allocation:** `:POOLED` If set to POOLED, allocation added per seat is pooled across the account. - `:POOLED` - **temporary\_id:** `String` A temporary ID that can be used to reference the recurring commit for commit specific overrides. - **reseller\_royalties:** `Array[{ fraction, netsuite_reseller_id, reseller_type, 7 more}]` This field's availability is dependent on your client's configuration. - **fraction:** `Float` - **netsuite\_reseller\_id:** `String` - **reseller\_type:** `:AWS | :AWS_PRO_SERVICE | :GCP | :GCP_PRO_SERVICE` - `:AWS` - `:AWS_PRO_SERVICE` - `:GCP` - `:GCP_PRO_SERVICE` - **starting\_at:** `Time` - **applicable\_product\_ids:** `Array[String]` Must provide at least one of applicable_product_ids or applicable_product_tags. - **applicable\_product\_tags:** `Array[String]` Must provide at least one of applicable_product_ids or applicable_product_tags. - **aws\_options:** `{ aws_account_number, aws_offer_id, aws_payer_reference_id}` - **aws\_account\_number:** `String` - **aws\_offer\_id:** `String` - **aws\_payer\_reference\_id:** `String` - **ending\_before:** `Time` - **gcp\_options:** `{ gcp_account_id, gcp_offer_id}` - **gcp\_account\_id:** `String` - **gcp\_offer\_id:** `String` - **reseller\_contract\_value:** `Float` - **salesforce\_opportunity\_id:** `String` This field's availability is dependent on your client's configuration. - **scheduled\_charges:** `Array[{ product_id, schedule, name, netsuite_sales_order_id}]` - **product\_id:** `String` - **schedule:** `{ credit_type_id, do_not_invoice, recurring_schedule, schedule_items}` Must provide either schedule_items or recurring_schedule. - **credit\_type\_id:** `String` Defaults to USD (cents) if not passed. - **do\_not\_invoice:** `bool` This field is only applicable to commit invoice schedules. If true, this schedule will not generate an invoice. - **recurring\_schedule:** `{ amount_distribution, ending_before, frequency, 4 more}` Enter the unit price and quantity for the charge or instead only send the amount. If amount is sent, the unit price is assumed to be the amount and quantity is inferred to be 1. - **amount\_distribution:** `:DIVIDED | :DIVIDED_ROUNDED | :EACH` - `:DIVIDED` - `:DIVIDED_ROUNDED` - `:EACH` - **ending\_before:** `Time` RFC 3339 timestamp (exclusive). - **frequency:** `:MONTHLY | :QUARTERLY | :SEMI_ANNUAL | :ANNUAL` - `:MONTHLY` - `:QUARTERLY` - `:SEMI_ANNUAL` - `:ANNUAL` - **starting\_at:** `Time` RFC 3339 timestamp (inclusive). - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **schedule\_items:** `Array[{ timestamp, amount, quantity, unit_price}]` Either provide amount or provide both unit_price and quantity. - **timestamp:** `Time` timestamp of the scheduled event - **amount:** `Float` Amount for the charge. Can be provided instead of unit_price and quantity. If amount is sent, the unit_price is assumed to be the amount and quantity is inferred to be 1. - **quantity:** `Float` Quantity for the charge. Will be multiplied by unit_price to determine the amount and must be specified with unit_price. If specified amount cannot be provided. - **unit\_price:** `Float` Unit price for the charge. Will be multiplied by quantity to determine the amount and must be specified with quantity. If specified amount cannot be provided. - **name:** `String` displayed on invoices - **netsuite\_sales\_order\_id:** `String` This field's availability is dependent on your client's configuration. - **scheduled\_charges\_on\_usage\_invoices:** `:ALL` 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. - `:ALL` - **spend\_threshold\_configuration:** `{ commit, is_enabled, payment_gate_config, threshold_amount}` - **commit:** `{ product_id, description, name}` - **product\_id:** `String` The commit product that will be used to generate the line item for commit payment. - **description:** `String` - **name:** `String` Specify the name of the line item for the threshold charge. If left blank, it will default to the commit product name. - **is\_enabled:** `bool` 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. - **payment\_gate\_config:** `{ payment_gate_type, precalculated_tax_config, stripe_config, tax_type}` - **payment\_gate\_type:** `:NONE | :STRIPE | :EXTERNAL` 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. - `:NONE` - `:STRIPE` - `:EXTERNAL` - **precalculated\_tax\_config:** `{ tax_amount, tax_name}` Only applicable if using PRECALCULATED as your tax type. - **tax\_amount:** `Float` Amount of tax to be applied. This should be in the same currency and denomination as the commit's invoice schedule - **tax\_name:** `String` Name of the tax to be applied. This may be used in an invoice line item description. - **stripe\_config:** `{ payment_type, invoice_metadata}` Only applicable if using STRIPE as your payment gate type. - **payment\_type:** `:INVOICE | :PAYMENT_INTENT` If left blank, will default to INVOICE - `:INVOICE` - `:PAYMENT_INTENT` - **invoice\_metadata:** `Hash[Symbol, String]` Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as your payment type. - **tax\_type:** `:NONE | :STRIPE | :ANROK | :PRECALCULATED` 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. - `:NONE` - `:STRIPE` - `:ANROK` - `:PRECALCULATED` - **threshold\_amount:** `Float` Specify the threshold amount for the contract. Each time the contract's usage hits this amount, a threshold charge will be initiated. - **subscriptions:** `Array[{ collection_schedule, initial_quantity, proration, 7 more}]` Optional list of [subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/) to add to the contract. - **collection\_schedule:** `:ADVANCE | :ARREARS` - `:ADVANCE` - `:ARREARS` - **initial\_quantity:** `Float` The initial quantity for the subscription. It must be non-negative value. - **proration:** `{ invoice_behavior, is_prorated}` - **invoice\_behavior:** `:BILL_IMMEDIATELY | :BILL_ON_NEXT_COLLECTION_DATE` Indicates how mid-period quantity adjustments are invoiced. **BILL\_IMMEDIATELY**: Only available when collection schedule is `ADVANCE`. The quantity increase will be billed immediately on the scheduled date. **BILL\_ON\_NEXT\_COLLECTION\_DATE**: The quantity increase will be billed for in-arrears at the end of the period. - `:BILL_IMMEDIATELY` - `:BILL_ON_NEXT_COLLECTION_DATE` - **is\_prorated:** `bool` Indicates if the partial period will be prorated or charged a full amount. - **subscription\_rate:** `{ billing_frequency, product_id}` - **billing\_frequency:** `:MONTHLY | :QUARTERLY | :ANNUAL | :WEEKLY` Frequency to bill subscription with. Together with product_id, must match existing rate on the rate card. - `:MONTHLY` - `:QUARTERLY` - `:ANNUAL` - `:WEEKLY` - **product\_id:** `String` Must be subscription type product - **custom\_fields:** `Hash[Symbol, String]` - **description:** `String` - **ending\_before:** `Time` Exclusive end time for the subscription. If not provided, subscription inherits contract end date. - **name:** `String` - **starting\_at:** `Time` Inclusive start time for the subscription. If not provided, defaults to contract start date - **temporary\_id:** `String` A temporary ID used to reference the subscription in recurring commit/credit subscription configs created within the same payload. - **total\_contract\_value:** `Float` This field's availability is dependent on your client's configuration. - **transition:** `{ from_contract_id, type, future_invoice_behavior}` - **from\_contract\_id:** `String` - **type:** `:SUPERSEDE | :RENEWAL` This field's available values may vary based on your client's configuration. - `:SUPERSEDE` - `:RENEWAL` - **future\_invoice\_behavior:** `{ trueup}` - **trueup:** `:REMOVE | :AS_IS` Controls whether future trueup invoices are billed or removed. Default behavior is AS_IS if not specified. - `:REMOVE` - `:AS_IS` - **uniqueness\_key:** `String` 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. - **usage\_filter:** `BaseUsageFilter` - **usage\_statement\_schedule:** `{ frequency, billing_anchor_date, day, invoice_generation_starting_at}` - **frequency:** `:MONTHLY | :QUARTERLY | :ANNUAL | :WEEKLY` - `:MONTHLY` - `:QUARTERLY` - `:ANNUAL` - `:WEEKLY` - **billing\_anchor\_date:** `Time` Required when using CUSTOM_DATE. This option lets you set a historical billing anchor date, aligning future billing cycles with a chosen cadence. For example, if a contract starts on 2024-09-15 and you set the anchor date to 2024-09-10 with a MONTHLY frequency, the first usage statement will cover 09-15 to 10-10. Subsequent statements will follow the 10th of each month. - **day:** `:FIRST_OF_MONTH | :CONTRACT_START | :CUSTOM_DATE` If not provided, defaults to the first day of the month. - `:FIRST_OF_MONTH` - `:CONTRACT_START` - `:CUSTOM_DATE` - **invoice\_generation\_starting\_at:** `Time` The date Metronome should start generating usage invoices. If unspecified, contract start date will be used. This is useful to set if you want to import historical invoices via our 'Create Historical Invoices' API rather than having Metronome automatically generate them. ### Returns - `class ContractCreateResponse` - **data:** `ID` ### Example ```ruby require "metronome_sdk" metronome = MetronomeSDK::Client.new(bearer_token: "My Bearer Token") contract = metronome.v1.contracts.create( customer_id: "13117714-3f05-48e5-a6e9-a66093f13b4d", starting_at: "2020-01-01T00:00:00.000Z" ) puts(contract) ```