Class: MetronomeSDK::Resources::V1::Invoices
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::Invoices
- 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
-
#initialize(client:) ⇒ Invoices
constructor
private
A new instance of Invoices.
-
#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.
-
#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.
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.
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.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/metronome_sdk/resources/v1/invoices.rb', line 39 def regenerate(params) parsed, = MetronomeSDK::V1::InvoiceRegenerateParams.dump_request(params) @client.request( method: :post, path: "v1/invoices/regenerate", body: parsed, model: MetronomeSDK::Models::V1::InvoiceRegenerateResponse, 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.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/metronome_sdk/resources/v1/invoices.rb', line 65 def void(params) parsed, = MetronomeSDK::V1::InvoiceVoidParams.dump_request(params) @client.request( method: :post, path: "v1/invoices/void", body: parsed, model: MetronomeSDK::Models::V1::InvoiceVoidResponse, options: ) end |