Create Historical Invoices
Create historical invoices
Creates historical usage invoices for a contract
Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
This field's availability is dependent on your client's configuration.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Returns
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Details about the credit or commit that was applied to this line item. Only present on line items with product of USAGE, SUBSCRIPTION or COMPOSITE types.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
For line items with product of USAGE, SUBSCRIPTION, or COMPOSITE types, the ID of the credit or commit that was applied to this line item. For line items with product type of FIXED, the ID of the prepaid or postpaid commit that is being paid for.
PrepaidCommit (for commit types PREPAID and CREDIT) or PostpaidCommit (for commit type POSTPAID).
ID of the discount applied to this line item.
Indicates whether the line item is prorated for SUBSCRIPTION type product.
Only present for contract invoices and when the include_list_prices query parameter is set to true. This will include the list rate for the charge if applicable. Only present for usage and subscription line items.
The end date for the billing period on the invoice.
The start date for the billing period on the invoice.
Only present for line items paying for a postpaid commit true-up.
Hide ParametersShow Parameters
Includes the presentation group values associated with this line item if presentation group keys are used.
Includes the pricing group values associated with this line item if dimensional pricing is used.
ID of the product associated with the line item.
The current product tags associated with the line item's product_id.
The type of the line item's product. Possible values are FixedProductListItem (for FIXED type products), UsageProductListItem (for USAGE type products), SubscriptionProductListItem (for SUBSCRIPTION type products) or CompositeProductListItem (for COMPOSITE type products). For scheduled charges, commit and credit payments, the value is FixedProductListItem.
The quantity associated with the line item.
Hide ParametersShow Parameters
ID of scheduled charge.
Hide ParametersShow Parameters
the unit price for this charge, present only if the charge is not tiered and the quantity is nonzero
when the current tier started and ends (for tiered charges only)
Hide ParametersShow Parameters
at what metric amount this tier begins
Populated if the line item has a tiered price.
Hide ParametersShow Parameters
The unit price associated with the line item.
This field's availability is dependent on your client's configuration.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
When the invoice was created (UTC). This field is present for correction invoices only.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
This field's availability is dependent on your client's configuration.
Only present for contract invoices with reseller royalties.
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
Hide ParametersShow Parameters
This field's availability is dependent on your client's configuration.
package main
import (
"context"
"fmt"
"time"
"github.com/Metronome-Industries/metronome-go"
"github.com/Metronome-Industries/metronome-go/option"
)
func main() {
client := metronome.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.V1.Contracts.NewHistoricalInvoices(context.TODO(), metronome.V1ContractNewHistoricalInvoicesParams{
Invoices: metronome.F([]metronome.V1ContractNewHistoricalInvoicesParamsInvoice{metronome.V1ContractNewHistoricalInvoicesParamsInvoice{
CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
ContractID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
CreditTypeID: metronome.F("2714e483-4ff1-48e4-9e25-ac732e8f24f2"),
InclusiveStartDate: metronome.F(time.Now()),
ExclusiveEndDate: metronome.F(time.Now()),
IssueDate: metronome.F(time.Now()),
UsageLineItems: metronome.F([]metronome.V1ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem{metronome.V1ContractNewHistoricalInvoicesParamsInvoicesUsageLineItem{
ProductID: metronome.F("f14d6729-6a44-4b13-9908-9387f1918790"),
InclusiveStartDate: metronome.F(time.Now()),
ExclusiveEndDate: metronome.F(time.Now()),
Quantity: metronome.F(100.000000),
}}),
}}),
Preview: metronome.F(false),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
{
"data": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"credit_type": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"customer_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"line_items": [
{
"credit_type": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"name": "name",
"total": 0,
"applied_commit_or_credit": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"type": "PREPAID"
},
"commit_custom_fields": {
"foo": "string"
},
"commit_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"commit_netsuite_item_id": "commit_netsuite_item_id",
"commit_netsuite_sales_order_id": "commit_netsuite_sales_order_id",
"commit_segment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"commit_type": "commit_type",
"custom_fields": {
"foo": "string"
},
"discount_custom_fields": {
"foo": "string"
},
"discount_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"ending_before": "2019-12-27T18:11:19.117Z",
"group_key": "group_key",
"group_value": "group_value",
"is_prorated": true,
"list_price": {
"rate_type": "FLAT",
"credit_type": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"custom_rate": {
"foo": "bar"
},
"is_prorated": true,
"price": 0,
"pricing_group_values": {
"foo": "string"
},
"quantity": 0,
"tiers": [
{
"price": 0,
"size": 0
}
],
"use_list_prices": true
},
"metadata": "metadata",
"netsuite_invoice_billing_end": "2019-12-27T18:11:19.117Z",
"netsuite_invoice_billing_start": "2019-12-27T18:11:19.117Z",
"netsuite_item_id": "netsuite_item_id",
"postpaid_commit": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"presentation_group_values": {
"foo": "string"
},
"pricing_group_values": {
"foo": "string"
},
"product_custom_fields": {
"foo": "string"
},
"product_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"product_tags": [
"string"
],
"product_type": "product_type",
"professional_service_custom_fields": {
"foo": "string"
},
"professional_service_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"quantity": 0,
"reseller_type": "AWS",
"scheduled_charge_custom_fields": {
"foo": "string"
},
"scheduled_charge_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"starting_at": "2019-12-27T18:11:19.117Z",
"sub_line_items": [
{
"custom_fields": {
"foo": "string"
},
"name": "name",
"quantity": 0,
"subtotal": 0,
"charge_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"credit_grant_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"end_date": "2019-12-27T18:11:19.117Z",
"price": 0,
"start_date": "2019-12-27T18:11:19.117Z",
"tier_period": {
"starting_at": "2019-12-27T18:11:19.117Z",
"ending_before": "2019-12-27T18:11:19.117Z"
},
"tiers": [
{
"price": 0,
"quantity": 0,
"starting_at": 0,
"subtotal": 0
}
]
}
],
"subscription_custom_fields": {
"foo": "string"
},
"tier": {
"level": 0,
"starting_at": "starting_at",
"size": "size"
},
"unit_price": 0
}
],
"status": "DRAFT, VOID, or FINALIZED",
"total": 0,
"type": "PLAN_ARREARS, SCHEDULED, USAGE, CORRECTION, CREDIT_PURCHASE, or SEAT_PURCHASE",
"amendment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"billable_status": "billable",
"contract_custom_fields": {
"foo": "string"
},
"contract_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"correction_record": {
"corrected_invoice_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"memo": "memo",
"reason": "reason",
"corrected_external_invoice": {
"billing_provider_type": "aws_marketplace",
"external_status": "DRAFT",
"invoice_id": "invoice_id",
"issued_at_timestamp": "2019-12-27T18:11:19.117Z"
}
},
"created_at": "2019-12-27T18:11:19.117Z",
"custom_fields": {
"foo": "bar"
},
"customer_custom_fields": {
"foo": "string"
},
"end_timestamp": "2019-12-27T18:11:19.117Z",
"external_invoice": {
"billing_provider_type": "aws_marketplace",
"external_status": "DRAFT",
"invoice_id": "invoice_id",
"issued_at_timestamp": "2019-12-27T18:11:19.117Z"
},
"invoice_adjustments": [
{
"credit_type": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "name"
},
"name": "Monthly minimum ($1,000)",
"total": 0,
"credit_grant_custom_fields": {
"foo": "string"
},
"credit_grant_id": "credit_grant_id"
}
],
"issued_at": "2019-12-27T18:11:19.117Z",
"net_payment_terms_days": 0,
"netsuite_sales_order_id": "netsuite_sales_order_id",
"plan_custom_fields": {
"foo": "string"
},
"plan_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"plan_name": "plan_name",
"reseller_royalty": {
"fraction": "fraction",
"netsuite_reseller_id": "netsuite_reseller_id",
"reseller_type": "AWS",
"aws_options": {
"aws_account_number": "aws_account_number",
"aws_offer_id": "aws_offer_id",
"aws_payer_reference_id": "aws_payer_reference_id"
},
"gcp_options": {
"gcp_account_id": "gcp_account_id",
"gcp_offer_id": "gcp_offer_id"
}
},
"salesforce_opportunity_id": "salesforce_opportunity_id",
"start_timestamp": "2019-12-27T18:11:19.117Z",
"subtotal": 0
}
]
}