Class: MetronomeSDK::Resources::V1::Contracts
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::Contracts
- Defined in:
- lib/metronome_sdk/resources/v1/contracts.rb,
lib/metronome_sdk/resources/v1/contracts/products.rb,
lib/metronome_sdk/resources/v1/contracts/rate_cards.rb,
lib/metronome_sdk/resources/v1/contracts/named_schedules.rb,
lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb,
lib/metronome_sdk/resources/v1/contracts/rate_cards/product_orders.rb,
lib/metronome_sdk/resources/v1/contracts/rate_cards/named_schedules.rb
Defined Under Namespace
Classes: NamedSchedules, Products, RateCards
Instance Attribute Summary collapse
- #named_schedules ⇒ MetronomeSDK::Resources::V1::Contracts::NamedSchedules readonly
- #products ⇒ MetronomeSDK::Resources::V1::Contracts::Products readonly
- #rate_cards ⇒ MetronomeSDK::Resources::V1::Contracts::RateCards readonly
Instance Method Summary collapse
-
#add_manual_balance_entry(id: , amount: , customer_id: , reason: , segment_id: , contract_id: nil, timestamp: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::V1::ContractAddManualBalanceEntryParams for more details.
-
#amend(contract_id: , customer_id: , starting_at: , commits: nil, credits: nil, custom_fields: nil, discounts: nil, netsuite_sales_order_id: nil, overrides: nil, professional_services: nil, reseller_royalties: nil, salesforce_opportunity_id: nil, scheduled_charges: nil, total_contract_value: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractAmendResponse
Amendments will be replaced by Contract editing.
-
#archive(contract_id: , customer_id: , void_invoices: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractArchiveResponse
Some parameter documentations has been truncated, see Models::V1::ContractArchiveParams for more details.
-
#create(customer_id: , starting_at: , billing_provider_configuration: nil, commits: nil, credits: nil, custom_fields: nil, discounts: nil, ending_before: nil, hierarchy_configuration: nil, multiplier_override_prioritization: nil, name: nil, net_payment_terms_days: nil, netsuite_sales_order_id: nil, overrides: nil, prepaid_balance_threshold_configuration: nil, priority: nil, professional_services: nil, rate_card_alias: nil, rate_card_id: nil, recurring_commits: nil, recurring_credits: nil, reseller_royalties: nil, salesforce_opportunity_id: nil, scheduled_charges: nil, scheduled_charges_on_usage_invoices: nil, spend_threshold_configuration: nil, subscriptions: nil, total_contract_value: nil, transition: nil, uniqueness_key: nil, usage_filter: nil, usage_statement_schedule: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractCreateResponse
Some parameter documentations has been truncated, see Models::V1::ContractCreateParams for more details.
-
#create_historical_invoices(invoices: , preview: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractCreateHistoricalInvoicesResponse
Create historical usage invoices for past billing periods on specific contracts.
-
#initialize(client:) ⇒ Contracts
constructor
private
A new instance of Contracts.
-
#list(customer_id: , covering_date: nil, include_archived: nil, include_balance: nil, include_ledgers: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractListResponse
Some parameter documentations has been truncated, see Models::V1::ContractListParams for more details.
-
#list_balances(customer_id: , id: nil, covering_date: nil, effective_before: nil, exclude_zero_balances: nil, include_archived: nil, include_balance: nil, include_contract_balances: nil, include_ledgers: nil, limit: nil, next_page: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Internal::BodyCursorPage<MetronomeSDK::Models::Commit, MetronomeSDK::Models::Credit>
Some parameter documentations has been truncated, see Models::V1::ContractListBalancesParams for more details.
-
#retrieve(contract_id: , customer_id: , include_balance: nil, include_ledgers: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveResponse
Some parameter documentations has been truncated, see Models::V1::ContractRetrieveParams for more details.
-
#retrieve_rate_schedule(contract_id: , customer_id: , limit: nil, next_page: nil, at: nil, selectors: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveRateScheduleResponse
Some parameter documentations has been truncated, see Models::V1::ContractRetrieveRateScheduleParams for more details.
-
#retrieve_subscription_quantity_history(contract_id: , customer_id: , subscription_id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveSubscriptionQuantityHistoryResponse
Get the history of subscription quantities and prices over time for a given ‘subscription_id`.
-
#schedule_pro_services_invoice(contract_id: , customer_id: , issued_at: , line_items: , netsuite_invoice_header_end: nil, netsuite_invoice_header_start: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractScheduleProServicesInvoiceResponse
Create a new scheduled invoice for Professional Services terms on a contract.
-
#set_usage_filter(contract_id: , customer_id: , group_key: , group_values: , starting_at: , request_options: {}) ⇒ nil
If a customer has multiple contracts with overlapping rates, the usage filter routes usage to the appropriate contract based on a predefined group key.
-
#update_end_date(contract_id: , customer_id: , allow_ending_before_finalized_invoice: nil, ending_before: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractUpdateEndDateResponse
Some parameter documentations has been truncated, see Models::V1::ContractUpdateEndDateParams for more details.
Constructor Details
#initialize(client:) ⇒ Contracts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Contracts.
750 751 752 753 754 755 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 750 def initialize(client:) @client = client @products = MetronomeSDK::Resources::V1::Contracts::Products.new(client: client) @rate_cards = MetronomeSDK::Resources::V1::Contracts::RateCards.new(client: client) @named_schedules = MetronomeSDK::Resources::V1::Contracts::NamedSchedules.new(client: client) end |
Instance Attribute Details
#named_schedules ⇒ MetronomeSDK::Resources::V1::Contracts::NamedSchedules (readonly)
14 15 16 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 14 def named_schedules @named_schedules end |
#products ⇒ MetronomeSDK::Resources::V1::Contracts::Products (readonly)
8 9 10 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 8 def products @products end |
#rate_cards ⇒ MetronomeSDK::Resources::V1::Contracts::RateCards (readonly)
11 12 13 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 11 def rate_cards @rate_cards end |
Instance Method Details
#add_manual_balance_entry(id: , amount: , customer_id: , reason: , segment_id: , contract_id: nil, timestamp: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::V1::ContractAddManualBalanceEntryParams for more details.
Manually adjust the available balance on a commit or credit. This entry is appended to the commit ledger as a new event. Optionally include a description that provides the reasoning for the entry.
### Use this endpoint to:
-
Address incorrect usage burn-down caused by malformed usage or invalid config
-
Decrease available balance to account for outages where usage may have not been tracked or sent to Metronome
-
Issue credits to customers in the form of increased balance on existing commit or credit
### Usage guidelines:
Manual ledger entries can be extremely useful for resolving discrepancies in Metronome. However, most corrections to inaccurate billings can be modified upstream of the commit, whether that is via contract editing, rate editing, or other actions that cause an invoice to be recalculated.
342 343 344 345 346 347 348 349 350 351 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 342 def add_manual_balance_entry(params) parsed, = MetronomeSDK::V1::ContractAddManualBalanceEntryParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/addManualBalanceLedgerEntry", body: parsed, model: NilClass, options: ) end |
#amend(contract_id: , customer_id: , starting_at: , commits: nil, credits: nil, custom_fields: nil, discounts: nil, netsuite_sales_order_id: nil, overrides: nil, professional_services: nil, reseller_royalties: nil, salesforce_opportunity_id: nil, scheduled_charges: nil, total_contract_value: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractAmendResponse
Amendments will be replaced by Contract editing. New clients should implement using the ‘editContract` endpoint. Read more about the migration to contract editing [here](/guides/implement-metronome/migrate-amendments-to-edits/) and reach out to your Metronome representative for more details. Once contract editing is enabled, access to this endpoint will be removed.
394 395 396 397 398 399 400 401 402 403 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 394 def amend(params) parsed, = MetronomeSDK::V1::ContractAmendParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/amend", body: parsed, model: MetronomeSDK::Models::V1::ContractAmendResponse, options: ) end |
#archive(contract_id: , customer_id: , void_invoices: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractArchiveResponse
Some parameter documentations has been truncated, see Models::V1::ContractArchiveParams for more details.
Permanently end and archive a contract along with all its terms. Any draft invoices will be canceled, and all upcoming scheduled invoices will be voided–also all finalized invoices can optionally be voided. Use this in the event a contract was incorrectly created and needed to be removed from a customer.
#### Impact on commits and credits:
When archiving a contract, all associated commits and credits are also archived. For prepaid commits with active segments, Metronome automatically generates expiration ledger entries to close out any remaining balances, ensuring accurate accounting of unused prepaid amounts. These ledger entries will appear in the commit’s transaction history with type ‘PREPAID_COMMIT_EXPIRATION`.
#### Archived contract visibility:
Archived contracts remain accessible for historical reporting and audit purposes. They can be retrieved using the ‘ListContracts` endpoint by setting the `include_archived` parameter to `true` or in the Metronome UI when the “Show archived” option is enabled.
442 443 444 445 446 447 448 449 450 451 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 442 def archive(params) parsed, = MetronomeSDK::V1::ContractArchiveParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/archive", body: parsed, model: MetronomeSDK::Models::V1::ContractArchiveResponse, options: ) end |
#create(customer_id: , starting_at: , billing_provider_configuration: nil, commits: nil, credits: nil, custom_fields: nil, discounts: nil, ending_before: nil, hierarchy_configuration: nil, multiplier_override_prioritization: nil, name: nil, net_payment_terms_days: nil, netsuite_sales_order_id: nil, overrides: nil, prepaid_balance_threshold_configuration: nil, priority: nil, professional_services: nil, rate_card_alias: nil, rate_card_id: nil, recurring_commits: nil, recurring_credits: nil, reseller_royalties: nil, salesforce_opportunity_id: nil, scheduled_charges: nil, scheduled_charges_on_usage_invoices: nil, spend_threshold_configuration: nil, subscriptions: nil, total_contract_value: nil, transition: nil, uniqueness_key: nil, usage_filter: nil, usage_statement_schedule: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractCreateResponse
Some parameter documentations has been truncated, see Models::V1::ContractCreateParams for more details.
Contracts define a customer’s products, pricing, discounts, access duration, and billing configuration. Contracts serve as the central billing agreement for both PLG and Enterprise customers, you can automatically customers access to your products and services directly from your product or CRM.
### Use this endpoint to:
-
PLG onboarding: Automatically provision new self-serve customers with contracts when they sign up.
-
Enterprise sales: Push negotiated contracts from Salesforce with custom pricing and commitments
-
Promotional pricing: Implement time-limited discounts and free trials through overrides
### Key components:
#### Contract Term and Billing Schedule
-
Set contract duration using ‘starting_at` and `ending_before` fields. PLG contracts typically use perpetual agreements (no end date), while Enterprise contracts have fixed end dates which can be edited over time in the case of co-term upsells.
#### Rate Card
If you are offering usage based pricing, you can set a rate card for the contract to reference through ‘rate_card_id` or `rate_card_alias`. The rate card is a store of all of your usage based products and their centralized pricing. Any new products or price changes on the rate card can be set to automatically propagate to all associated contracts - this ensures consistent pricing and product launches flow to contracts without manual updates and migrations. The `usage_statement_schedule` determines the cadence on which Metronome will finalize a usage invoice for the customer. This defaults to monthly on the 1st, with options for custom dates, quarterly, or annual cadences. Note: Most usage based billing companies align usage statements to be evaluated aligned to the first of the month. Read more about [Rate Cards](docs.metronome.com/pricing-packaging/create-manage-rate-cards/).
#### Overrides and discounts
Customize pricing on the contract through time-bounded overrides that can target specific products, product families, or complex usage scenarios. Overrides enable two key capabilities:
-
Discounts: Apply percentage discounts, fixed rate reductions, or quantity-based pricing tiers
-
Entitlements: Provide special pricing or access to specific products for negotiated deals
Read more about [Contract Overrides](docs.metronome.com/manage-product-access/add-contract-override/).
#### Commits and Credits
Using commits, configure prepaid or postpaid spending commitments where customers promise to spend a certain amount over the contract period paid in advance or in arrears. Use credits to provide free spending allowances. Under the hood these are the same mechanisms, however, credits are typically offered for free (SLA or promotional) or as a part of an allotment associated with a Subscription.
In Metronome, you can set commits and credits to only be applicable for a subset of usage. Use ‘applicable_product_ids` or `applicable_product_tags` to create product or product-family specific commits or credits, or you can build complex boolean logic specifiers to target usage based on pricing and presentation group values using `override_specifiers`.
These objects can also also be configured to have a recurrence schedule to easily model customer packaging which includes recurring monthly or quarterly allotments.
Commits support rollover settings (‘rollover_fraction`) to transfer unused balances between contract periods, either entirely or as a percentage.
Read more about [Credits and Commits](docs.metronome.com/pricing-packaging/apply-credits-commits/).
#### Subscriptions
You can add a fixed recurring charge to a contract, like monthly licenses or seat-based fees, using the subscription charge. Subscription charges are defined on your rate card and you can select which subscription is applicable to add to each contract. When you add a subscription to a contract you need to:
-
Define whether the subscription is paid for in-advance or in-arrears (‘collection_schedule`)
-
Define the proration behavior (‘proration`)
-
Specify an initial quantity (‘initial_quantity`)
-
Define which subscription rate on the rate card should be used (‘subscription_rate`)
Read more about [Subscriptions](docs.metronome.com/manage-product-access/create-subscription/).
#### Scheduled Charges
Set up one-time, recurring, or entirely custom charges that occur on specific dates, separate from usage-based billing or commitments. These can be used to model non-recurring platform charges or professional services.
#### Threshold Billing
Metronome allows you to configure automatic billing triggers when customers reach spending thresholds to prevent fraud and manage risk. You can use ‘spend_threshold_configuration` to trigger an invoice to cover current charges whenever the threshold is reached or you can ensure the customer maintains a minimum prepaid balance using the `prepaid_balance_configuration`.
Read more about [Spend Threshold](docs.metronome.com/manage-product-access/spend-thresholds/) and [Prepaid Balance Thresholds](docs.metronome.com/manage-product-access/prepaid-balance-thresholds/).
### Usage guidelines:
-
You can always [Edit Contracts](docs.metronome.com/manage-product-access/edit-contract/) after it has been created, using the ‘editContract` endpoint. Metronome keeps track of all edits, both in the audit log and over the `getEditHistory` endpoint.
-
Customers in Metronome can have multiple concurrent contracts at one time. Use ‘usage_filters` to route the correct usage to each contract. [Read more about usage filters](docs.metronome.com/manage-product-access/provision-customer/#create-a-usage-filter).
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 214 def create(params) parsed, = MetronomeSDK::V1::ContractCreateParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/create", body: parsed, model: MetronomeSDK::Models::V1::ContractCreateResponse, options: ) end |
#create_historical_invoices(invoices: , preview: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractCreateHistoricalInvoicesResponse
Create historical usage invoices for past billing periods on specific contracts. Use this endpoint to generate retroactive invoices with custom usage line items, quantities, and date ranges. Supports preview mode to validate invoice data before creation. Ideal for billing migrations or correcting past billing periods.
468 469 470 471 472 473 474 475 476 477 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 468 def create_historical_invoices(params) parsed, = MetronomeSDK::V1::ContractCreateHistoricalInvoicesParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/createHistoricalInvoices", body: parsed, model: MetronomeSDK::Models::V1::ContractCreateHistoricalInvoicesResponse, options: ) end |
#list(customer_id: , covering_date: nil, include_archived: nil, include_balance: nil, include_ledgers: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractListResponse
Some parameter documentations has been truncated, see Models::V1::ContractListParams for more details.
Retrieves all contracts for a specific customer, including pricing, terms, credits, and commitments. Use this to view a customer’s contract history and current agreements for billing management. Returns contract details with optional ledgers and balance information.
⚠️ Note: This is the legacy v1 endpoint - new integrations should use the v2 endpoint for enhanced features.
287 288 289 290 291 292 293 294 295 296 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 287 def list(params) parsed, = MetronomeSDK::V1::ContractListParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/list", body: parsed, model: MetronomeSDK::Models::V1::ContractListResponse, options: ) end |
#list_balances(customer_id: , id: nil, covering_date: nil, effective_before: nil, exclude_zero_balances: nil, include_archived: nil, include_balance: nil, include_contract_balances: nil, include_ledgers: nil, limit: nil, next_page: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Internal::BodyCursorPage<MetronomeSDK::Models::Commit, MetronomeSDK::Models::Credit>
Some parameter documentations has been truncated, see Models::V1::ContractListBalancesParams for more details.
Retrieve a comprehensive view of all available balances (commits and credits) for a customer. This endpoint provides real-time visibility into prepaid funds, postpaid commitments, promotional credits, and other balance types that can offset usage charges, helping you build transparent billing experiences.
### Use this endpoint to:
-
Display current available balances in customer dashboards
-
Verify available funds before approving high-usage operations
-
Generate balance reports for finance teams
-
Filter balances by contract or date ranges
### Key response fields:
An array of balance objects (all credits and commits) containing:
-
Balance details: Current available amount for each commit or credit
-
Metadata: Product associations, priorities, applicable date ranges
-
Optional ledger entries: Detailed transaction history (if ‘include_ledgers=true`)
-
Balance calculations: Including pending transactions and future-dated entries
-
Custom fields: Any additional metadata attached to balances
### Usage guidelines:
-
Date filtering: Use ‘effective_before` to include only balances with access before a specific date (exclusive)
-
Set ‘include_balance=true` for calculated balance amounts on each commit or credit
-
Set ‘include_ledgers=true` for full transaction history
-
Set ‘include_contract_balances = true` to see contract level balances
-
Balance logic: Reflects currently accessible amounts, excluding expired/future segments
-
Manual adjustments: Includes all manual ledger entries, even future-dated ones
548 549 550 551 552 553 554 555 556 557 558 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 548 def list_balances(params) parsed, = MetronomeSDK::V1::ContractListBalancesParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/customerBalances/list", body: parsed, page: MetronomeSDK::Internal::BodyCursorPage, model: MetronomeSDK::Models::V1::ContractListBalancesResponse, options: ) end |
#retrieve(contract_id: , customer_id: , include_balance: nil, include_ledgers: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveResponse
Some parameter documentations has been truncated, see Models::V1::ContractRetrieveParams for more details.
This is the v1 endpoint to get a contract. New clients should implement using the v2 endpoint.
246 247 248 249 250 251 252 253 254 255 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 246 def retrieve(params) parsed, = MetronomeSDK::V1::ContractRetrieveParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/get", body: parsed, model: MetronomeSDK::Models::V1::ContractRetrieveResponse, options: ) end |
#retrieve_rate_schedule(contract_id: , customer_id: , limit: nil, next_page: nil, at: nil, selectors: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveRateScheduleResponse
Some parameter documentations has been truncated, see Models::V1::ContractRetrieveRateScheduleParams for more details.
For a specific customer and contract, get the rates at a specific point in time. This endpoint takes the contract’s rate card into consideration, including scheduled changes. It also takes into account overrides on the contract.
For example, if you want to show your customer a summary of the prices they are paying, inclusive of any negotiated discounts or promotions, use this endpoint. This endpoint only returns rates that are entitled.
590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 590 def retrieve_rate_schedule(params) parsed, = MetronomeSDK::V1::ContractRetrieveRateScheduleParams.dump_request(params) query_params = [:limit, :next_page] @client.request( method: :post, path: "v1/contracts/getContractRateSchedule", query: parsed.slice(*query_params), body: parsed.except(*query_params), model: MetronomeSDK::Models::V1::ContractRetrieveRateScheduleResponse, options: ) end |
#retrieve_subscription_quantity_history(contract_id: , customer_id: , subscription_id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractRetrieveSubscriptionQuantityHistoryResponse
Get the history of subscription quantities and prices over time for a given ‘subscription_id`. This endpoint can be used to power an in-product experience where you show a customer their historical changes to seat count. Future changes are not included in this endpoint - use the `getContract` endpoint to view the future scheduled changes to a subscription’s quantity.
Subscriptions are used to model fixed recurring fees as well as seat-based recurring fees. To model changes to the number of seats in Metronome, you can increment or decrement the quantity on a subscription at any point in the past or future.
624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 624 def retrieve_subscription_quantity_history(params) parsed, = MetronomeSDK::V1::ContractRetrieveSubscriptionQuantityHistoryParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/getSubscriptionQuantityHistory", body: parsed, model: MetronomeSDK::Models::V1::ContractRetrieveSubscriptionQuantityHistoryResponse, options: ) end |
#schedule_pro_services_invoice(contract_id: , customer_id: , issued_at: , line_items: , netsuite_invoice_header_end: nil, netsuite_invoice_header_start: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractScheduleProServicesInvoiceResponse
Create a new scheduled invoice for Professional Services terms on a contract. This endpoint’s availability is dependent on your client’s configuration.
658 659 660 661 662 663 664 665 666 667 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 658 def schedule_pro_services_invoice(params) parsed, = MetronomeSDK::V1::ContractScheduleProServicesInvoiceParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/scheduleProServicesInvoice", body: parsed, model: MetronomeSDK::Models::V1::ContractScheduleProServicesInvoiceResponse, options: ) end |
#set_usage_filter(contract_id: , customer_id: , group_key: , group_values: , starting_at: , request_options: {}) ⇒ nil
If a customer has multiple contracts with overlapping rates, the usage filter routes usage to the appropriate contract based on a predefined group key.
As an example, imagine you have a customer associated with two projects. Each project is associated with its own contract. You can create a usage filter with group key ‘project_id` on each contract, and route usage for `project_1` to the first contract and `project_2` to the second contract.
### Use this endpoint to:
-
Support enterprise contracting scenarios where multiple contracts are associated to the same customer with the same rates.
-
Update the usage filter associated with the contract over time.
### Usage guidelines:
To use usage filters, the ‘group_key` must be defined on the billable metrics underlying the rate card on the contracts.
700 701 702 703 704 705 706 707 708 709 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 700 def set_usage_filter(params) parsed, = MetronomeSDK::V1::ContractSetUsageFilterParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/setUsageFilter", body: parsed, model: NilClass, options: ) end |
#update_end_date(contract_id: , customer_id: , allow_ending_before_finalized_invoice: nil, ending_before: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::ContractUpdateEndDateResponse
Some parameter documentations has been truncated, see Models::V1::ContractUpdateEndDateParams for more details.
Update or add an end date to a contract. Ending a contract early will impact draft usage statements, truncate any terms, and remove upcoming scheduled invoices. Moving the date into the future will only extend the contract length. Terms and scheduled invoices are not extended. In-advance subscriptions will not be extended. Use this if a contract’s end date has changed or if a perpetual contract ends.
736 737 738 739 740 741 742 743 744 745 |
# File 'lib/metronome_sdk/resources/v1/contracts.rb', line 736 def update_end_date(params) parsed, = MetronomeSDK::V1::ContractUpdateEndDateParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/updateEndDate", body: parsed, model: MetronomeSDK::Models::V1::ContractUpdateEndDateResponse, options: ) end |