Class: MetronomeSDK::Resources::V1::Invoices

Inherits:
Object
  • Object
show all
Defined in:
lib/metronome_sdk/resources/v1/invoices.rb

Overview

[Invoices](docs.metronome.com/invoicing/) reflect how much a customer spent during a period, which is the basis for billing. Metronome automatically generates invoices based upon your pricing, packaging, and usage events. Use these endpoints to retrieve invoices.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invoices

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 Invoices.

Parameters:



79
80
81
# File 'lib/metronome_sdk/resources/v1/invoices.rb', line 79

def initialize(client:)
  @client = client
end

Instance Method Details

#regenerate(id:, request_options: {}) ⇒ MetronomeSDK::Models::V1::InvoiceRegenerateResponse

This endpoint regenerates a voided invoice and recalculates the invoice based on up-to-date rates, available balances, and other fees regardless of the billing period.

### Use this endpoint to:

Recalculate an invoice with updated rate terms, available balance, and fees to correct billing disputes or discrepancies

### Key response fields:

The regenerated invoice id, which is distinct from the previously voided invoice.

### Usage guidelines:

If an invoice is attached to a contract with a billing provider on it, the regenerated invoice will be distributed based on the configuration.

Parameters:

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
# File 'lib/metronome_sdk/resources/v1/invoices.rb', line 39

def regenerate(params)
  parsed, options = MetronomeSDK::V1::InvoiceRegenerateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/invoices/regenerate",
    body: parsed,
    model: MetronomeSDK::Models::V1::InvoiceRegenerateResponse,
    options: options
  )
end

#void(id:, request_options: {}) ⇒ MetronomeSDK::Models::V1::InvoiceVoidResponse

Permanently cancels an invoice by setting its status to voided, preventing collection and removing it from customer billing. Use this to correct billing errors, cancel incorrect charges, or handle disputed invoices that should not be collected. Returns the voided invoice ID with the status change applied immediately to stop any payment processing.

Parameters:

Returns:

See Also:



65
66
67
68
69
70
71
72
73
74
# File 'lib/metronome_sdk/resources/v1/invoices.rb', line 65

def void(params)
  parsed, options = MetronomeSDK::V1::InvoiceVoidParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/invoices/void",
    body: parsed,
    model: MetronomeSDK::Models::V1::InvoiceVoidResponse,
    options: options
  )
end