This feature is coming soon! To get notified as soon as our GCP Marketplace integration is ready, reach out to your Metronome Representative.

Set up GCP authentication for Metronome to meter on your behalf

In order to meter your listings, Metronome will require access to the procurement and metering APIs in your marketplace GCP project. Metronome will access your project via Workload Identity Federation, which allows federated access to your project by Metronome without the need to store long-lived tokens or keys. You will then associate a Google Service Account with the Workload Identity Federation pool, to which you will attach the appropriate fine-grained permissions for Metronome’s metering operations. To assist with deploying these resources, Metronome provides a set of configuration files and scripts that will walk you through deploying through either Terraform, a Bash script, or a self-guided method using the gcloud CLI utility. Those suggested configurations are available in Github. You will need some information from Metronome to fully configure this integration properly, and in return, Metronome will need some output from this process back. Here are the steps:
  1. In Metronome, go to Connections > Integrations > Available Integrations > GCP Marketplace > click Get started.
  2. Copy Metronome’s Service Account ID, AWS Account ID, and AWS Lambda Role Name from the menu:
    GCP service account ID
  3. In GCP, go to the GCP Console welcome page and select your target project from the project picker in the top left. Your Project ID and Project Number will be displayed here:
    GCP project details
  4. Using any of the configuration methods provided in the Github repository, supply your metronome_service_account_id, metronome_aws_account_id, metronome_aws_lambda_role_name, project_id, and project_number as input arguments. This will deploy a Workload Identity Federation Pool, an AWS Workload Identity Federation Provider, and a Service Account to your project with the appropriate configuration.
      • For Terraform configuration, supply the required variables to the module:
        project_id = "my-gcp-project-id"
        project_number = "123456789012"
        metronome_service_account_id = "m-123456789012abcdef"
        metronome_aws_account_id = "123456789012"
        metronome_aws_lambda_role_name = "metronome-lambda-role"
        
      • For the Bash or self-guided gcloud configuration, set the appropriate variables on your environment:
        export GCP_PROJECT_ID="my-gcp-project-id"
        export GCP_PROJECT_NUMBER="123456789012"
        export METRONOME_SERVICE_ACCOUNT_ID="m-123456789012abcdef"
        export METRONOME_AWS_ACCOUNT_ID="123456789012"
        export METRONOME_AWS_LAMBDA_ROLE_NAME="metronome-lambda-role"
        
  5. Also in GCP console, Metronome will need the appropriate GCP APIs enabled in order to authenticate to your project, discover your GCP entitlements, and report usage to GCP. See GCP’s Documentation for more information on how to enable APIs, and ensure the following APIs are enabled:
      • Identity and Access Management (IAM) API
      • IAM Service Account Credentials API
      • Cloud Commerce Partner Procurement API
      • Service Control API
      • Service Management API
  6. Finally, go to the Workload Identity Federation pools page in your GCP console and click on the Pool that was created in step 4. Click Connected service accounts, and then Download next to the service account we created in step 4. Save this credentials file for submission to Metronome in a later step.
    GCP workload identity download

Create a GCP Marketplace listing

With federated access to your project configured, we now proceed to configuring your listing for usage-based billing through Metronome:
  1. You must have access to the GCP Producer Portal, which includes registering with Google as a vendor.
  2. From the GCP Producer Portal home page, use Add Product to begin setting up a new listing.
    GCP add product
  3. Complete the Product Details section. This is all identifying information about your listing — Metronome does not require any specific settings here.
    Product details
  4. Complete the Pricing section. In particular, in the Price Model tab, you will create a plan with a usage-based metric and pricing for that metric. Metronome has specific requirements for each:
      • Create a new plan and add a metric with the following settings:
          • Metric ID set to usage_fee
          • Reporting unit set to count
          • Display unit set to Custom
          • Custom unit: We recommend something generic like “Usage Fee”. Do not set the Custom unit to a value that implies an actual currency, e.g. “USD”.
        CAUTIONThe metric ID must be called usage_fee for the integration to work correctly.
        GCP metric configuration
      • Once the metric is submitted, configure pricing on the metric by adding a usage fee with the following settings:
          • Display quantity set to 1
          • Price set to 0.01
        CAUTIONDeviating from these values will cause the integration to fail.
        GCP pricing configuration
      • You will then be asked to create feature(s) on your listing. Metronome is not opinionated on what your feature(s) are named, but you will need to have at least one feature with your usage-based pricing plan attached.
        GCP feature configuration
      • You will additionally fill out the Tax Category and Terms & Policies sections. There are no Metronome-specific requirements for these sections.
  5. Complete the final section, Technical Integration. Here, in particular, you will need to configure your Metronome-provided service account with access to the appropriate APIs in order for Metronome to have access to meter your listing. Completing this section will require your Metronome Service Account ID that you created and deployed in the Set up Workload Identity Federation section.
      • In the Billing Integration section, under step 1, you will need to provide Metronome’s service account ID access to Partner Procurement API. Metronome requires this access in order to read and track metadata about your listing’s entitlements. Click Add Service Account and type or paste in Metronome’s service account ID:
        GCP procurement API access
      • In the same Partner Procurement API integration step, just below the service account, your Provider ID will be displayed. Take note of this identifier as you will need to submit it to Metronome in the final step:
        GCP provider ID
      • The next step is to configure a Pub/Sub integration. Metronome does not require access to Pub/Sub at this time. However, here you may link your own internal service account(s) for any backend integrations you will use to manage GCP Marketplace subscriptions to your listing.
        GCP pub/sub integration
      • Finally, still in Billing Integration, under step 3, you will need to provide the same service account ID with access to the Service Controller API by again clicking Add Service Account and entering the identifier. Doing so permits Metronome to submit usage metrics to Google for billing:
        GCP service controller API access
        Note: Google may automatically attach a system service account here, which should remain in place.
      • Complete the Frontend Integration section and submit. There are no Metronome-specific requirements for this section.
  6. With all required sections for your listing submitted, Google will proceed with a review and approval workflow before your listing may be published.

Submit listing configuration to Metronome

With federated access configured via a Workload Identity Pool, and with Metronome’s Service Account configured with the appropriate permissions via your listing’s Technical Integration, you are now ready to submit your configuration information to Metronome to finalize the integration:
  1. In Metronome, return to Connections > Integrations > Available Integrations > GCP Marketplace > click Get started.
  2. Submit your Provider ID and your Workload Identity Configuration JSON file to the appropriate fields:
    GCP configuration submission
  3. Click Save changes to submit. Metronome will validate access has been granted to the listing correctly, and if successful, the integration will be saved.

Provision GCP Marketplace customers in Metronome

When a customer agrees to your Marketplace listing, you will need to provision their account in Metronome with a Metronome Contract that reflects the full details of the offer/subscription they signed with you in the Marketplace and GCP identified as the billing provider on that Contract. To connect a customer to GCP and have Metronome begin metering their invoices to GCP on your behalf:
  1. Go to an existing customer’s detail page in Metronome or create a new customer at Customers > Add New Customer.
  2. Go to Settings > Available Integrations > GCP > Get Started.
  3. Enter the Entitlement ID and Service Name for this customer’s subscription:
    • You can find both pieces of information from the subscription or order in GCP Producer Portal.
    • Entitlement ID is the unique identifier representing your customer’s offer/subscription in GCP. It is also referenced as Order ID. Example:
      GCP entitlement ID
    • Service Name is a domain name that identifies your product/listing to Google. It is displayed as Product on an offer:
      GCP service name
  4. Create a new contract for the customer that matches the details of the contract they signed with you in the GCP Marketplace. Include any credits and commits the customer has as part of the contract. Learn how to provision contracts in Metronome.
  5. Under the Billing Configuration section of the configure contract flow, select GCP as the billing provider.
    CAUTIONYou cannot add or change the billing provider after creating the contract.
  6. Alternatively, you can use the following endpoints to set up GCP as a customer’s billing provider and assign it to a contract:
    • To set up a new customer configured with GCP Marketplace:
      • Call the create customer endpoint
      • In the request payload, include customer_billing_provider_configurations:
        • In the configuration property, specify gcp_entitlement_id and gcp_service_name
          {
              // ...
              "customer_billing_provider_configurations": [{
                  "billing_provider": "gcp",
                  "delivery_method": "direct_to_billing_provider",
                  "configuration": {
                      "gcp_service_name": "<your GCP service name>",
                      "gcp_entitlement_id": "<your GCP entitlement ID>"
                  }
              }]
          }
          
    • To configure an existing customer with GCP Marketplace:
      • Call the set customer billing provider configurations endpoint
      • In the request payload, include your configuration:
        • In the configuration property, specify gcp_entitlement_id and gcp_service_name
          {
              // ...
              {
                  "billing_provider": "gcp",
                  "delivery_method": "direct_to_billing_provider",
                  "configuration": {
                      "gcp_service_name": "<your GCP service name>",
                      "gcp_entitlement_id": "<your GCP entitlement ID>"
                  }
              }
          }
          
    • To set up a new contract with invoices metered to GCP Marketplace:
      • Call the create contract endpoint
      • In the request payload, include billing_provider_configuration:
        {
            // ...
            "billing_provider_configuration": {
                "billing_provider": "gcp",
                "delivery_method": "direct_to_billing_provider"
            }
        }
        
After you set GCP as that customer’s billing provider and begin sending usage events, Metronome starts metering that customer’s calculated invoice totals to GCP on your behalf.

What Metronome meters to GCP

When metering to GCP, Metronome sums up a customer’s total amount accrued across all contract invoices that have GCP set as the billing provider since the last metering request. Metronome sets the quantity for each metering record as the total dollar amount expressed in USD cents. If a customer purchased a commit or was offered a credit as part of their contract, Metronome meters like this:
  • Prepaid commits A contract in Metronome specifies a schedule over which the customer pays for their prepaid commit. Those inputs create one or more scheduled invoices. Metronome meters the amount the customer owes on the prepaid commit on the date associated with the service period of the scheduled invoice, not the created at date.
  • Credits As credits on a Metronome contract are not paid for, Metronome only meters overages reflected on invoice totals after the credit has been drawn down in its entirety.
  • Postpaid commits Metronome meters usage reflected on invoice totals throughout the duration of the contract. However, if the entirety of the postpaid commit isn’t consumed by the end of the contract, Metronome ignores the true-up invoice and doesn’t send it to the marketplace. This is because the true-up invoice isn’t finalized until after the Metronome grace period ends, at which point the metering endpoint for the marketplace has closed. This means you must handle the true-up in the marketplace directly.

Handling marketplace customer lifecycle events in Metronome and your app

Metronome stops metering if it detects subscription changes due to marketplace lifecycle events, and updates the customer’s status in Metronome accordingly. However, you are responsible for ensuing that the customer’s status is correctly represented in your application and ending the customer’s contract in Metronome, if relevant. To end the customer’s contract in the Metronome app, go to the customer > click the contract > select the overflow menu > click Edit Contract End Date. To end the customer’s contract with the Metronome API, use the /contracts/updateEndDate endpoint.

Limitations of GCP Marketplace listings

Billing through the GCP Marketplace has some limitations. GCP Marketplace only supports positive quantities through their usage reporting service. There’s no way to decrease a customer’s total bill. For example, consider a customer who was meant to receive $1,000 in credits when they started using your product. Due to a typo, they erroneously received only $100. The mistake gets noticed one week into their first billing period, when the customer notices a $500 charge on their GCP bill. In Metronome, this mistake is easily rectified by adding an additional $900 credit, but in GCP, there’s no way to reduce that bill. If this situation arises, Metronome stops billing for that customer until their usage catches up to the amount they’ve already been billed. If this is insufficient to correct the problem, you must issue a manual refund through the GCP Marketplace. Contact your GCP or Metronome representative for help. GCP Marketplace strictly enforces the end of a customer’s Marketplace contract or subscription. Metronome provides a 1 hour grace period of events sent after the completion of the subscription. While Metronome normally supports a grace period of up to 24 hours after the billing period ends, the GCP integration currently is limited to 1 hour. This means usage received after that cannot be billed through GCP. Metronome automatically disables metering 2 hours after the subscription ends. In the event of an outage, Metronome catches up when everything comes back online. If Metronome was unable to send usage to GCP for some period of time, the accrued usage is included in the next request to GCP. However, if the customer’s contract has already ended and GCP’s grace period has elapsed, Metronome is unable to bill for the usage accrued during the down time. Metronome’s integration with GCP Marketplace only supports invoices with a USD fiat currency. Metronome throws an error if you attempt to create a contract with GCP Marketplace set as the billing provider, and the rate card on the contract has a non-USD fiat currency. In the case where the contract is associated with other invoices that are not in USD (for example, scheduled invoices associated with scheduled charges), only the USD invoices will be sent to GCP Marketplace.