Skip to main content

Invoice with other systems

This use case explores how to set up invoicing in systems not covered by Metronome’s native integrations, like NetSuite or QuickBooks.

To support these workflows, you can collaborate with Metronome to build a managed integration that connects to your billing system of choice. Managed integrations get built using the data export feature or Metronome APIs.

Integration approach

Often times, out-of-the-box integrations to invoicing platforms like NetSuite don’t meet the core requirements of clients and require significant customization. This is because they focus on syncing data without considering the end-to-end use case and business model. In contrast, managed integrations with Metronome take a first-principles approach to meeting client invoicing requirements.

As Metronome invests deeper into different business models, we continuously assess whether to build new native integrations to more billing platforms like our Invoicing in Stripe and Invoicing with marketplaces solutions.

For more information on how to set up a managed integration, contact your Metronome representative.

Pay-as-you-go invoicing in NetSuite example

This example describes how you could use the Metronome data export feature or API to support a NetSuite integration. While this example is specific to NetSuite, the pattern and design decisions apply across other use cases.

Configure required objects

To support this use case, start by building out your customer and item objects inside of NetSuite.

Next, follow these recommended design choices:

  1. Create Metronome products with a one-to-many mapping to NetSuite items.
    1. Add netsuite_internal_item_id as a custom field to the product entity and populate it with the corresponding internal ID in NetSuite.
  2. Create Metronome customers with a one-to-one mapping to NetSuite customers.
    1. Add netsuite_internal_customer_id as a custom field to the customer entity and populate it with the corresponding internal ID in NetSuite.
  3. [Optional] Create Metronome contracts with a one-to-one mapping to NetSuite Sales Orders. This is only required if you use the Order Fulfillment process in NetSuite. The rest of this example does not cover that use case.
    1. Add netsuite_sales_order_id as a custom field to the contract entity and populate it with the corresponding internal ID in NetSuite

Learn more about how to use custom fields.

Integrate through data export

Data export enables you to transfer Metronome data models into a data warehouse of your choice.

To invoice in NetSuite:

  1. Export the finalized_invoice , line_item , and product tables.

  2. Write a query to join the tables together and transform them into the format of the NetSuite invoice upload template.

    At a high level, the query should do the following:

    • Filter invoice to the previous billing period where invoice.total > $0
    • Inner Join invoice to line_item on invoice.id where invoice.total ≠ $0
    • Inner Join product to the newly formed table on product.id = new_table.product_id
    • Extract the custom fields from the metadata JSON on the product and invoice tables
    • Select the columns needed for template upload
  3. The resulting table provides you with the non-zero line items necessary to bill the end customer in NetSuite. Upload these to NetSuite using NetSuite’s template upload method for invoices.

tip

Create an external_id field on all objects created from Metronome data in NetSuite. This field enables joins across the different systems to identify gaps and discrepancies during reconciliation workflows. To learn more, refer to the NetSuite documentation about using external IDs.

Integrate through the API

The second option you have for pushing invoices to NetSuite is to build an integration on top of Metronome APIs.

Follow this recommended approach:

  1. Set up a webhook endpoint and listen for the invoice.finalized event. This event gets created once an invoice is finalized in Metronome after the grace period ends.

    {
    "id": "f4988a54-effe-49a2-9a07-8adfedb7541c",
    "type": "invoice.finalized",
    "properties": {
    "invoice_id": "d23458e0-c9a0-5538-8e81-251835b9f57a",
    "customer_id": "e0ac4251-74f7-4040-a1bd-9d0ef0fbc5bc",
    "invoice_finalized_date": "2024-10-09T17:52:27.371Z"
    }
    }
  2. This webhook provides customer_id. Use customer_id to query the /listInvoices endpoint for finalized invoices from the associated billing period.

    curl -X GET https://api.metronome.com/v1/customers/e0ac4251-74f7-4040-a1bd-9d0ef0fbc5bc/invoices \ 
    -H "Authorization: Bearer <TOKEN>" \
    -H "Content-Type: application/json" \
    -d "status=FINALIZED"\
    -d "starting_on=2024-10-09T00:00:00.000Z"\
    -d "ending_before=2024-10-10T00:00:00.000Z"
  3. Parse and transform the response into the appropriate format and upsert the invoice and line items into NetSuite using their REST API service.

info

The invoice.finalized event is not enabled by default for Metronome clients due to the potential volume of events. To turn this event on, contact your Metronome representative.

To build the necessary orchestration layer, you can choose to leverage existing developer environments or a third-party tool.

If you’re investigating third-party tools, Metronome recommends using the IPaaS system Workato. Workato is an automation tool that enables organizations to transform and transmit data using point-and-click workflow building capabilities. Metronome published a connector in the Workato Public library, which acts a wrapper to the Metronome API similar to an SDK. Similarly, NetSuite also has a public Workato connector that you can use for the integration. Leveraging these public connectors can accelerate the speed of development and provide additional clarity on how to interact with the distinct endpoints.

For more information on integrating with the API or leveraging public connectors, contact your Metronome representative.