Skip to main content

Overview

When a buyer subscribes to your product on GCP Marketplace, GCP creates an entitlement for them. Registering that entitlement tells Flexprice which subscription’s usage belongs to which buyer on GCP. Registration links three Flexprice entities to their GCP counterparts: Flexprice does not call the GCP Procurement API itself. You retrieve the entitlement’s identifiers yourself and pass them to Flexprice. Register the entitlement once per buyer, at the point they subscribe. After that, usage reporting runs on its own.

Prerequisites

Before registering an agreement, ensure you have:
  1. A published GCP Marketplace connection - See How to Set Up GCP Marketplace
  2. Your metric name - The single usage metric you created on your GCP product
  3. A Flexprice customer, plan, and active subscription - For the buyer, see Step 3 for what you must check or create before registering.

Step 1: Handle the Entitlement Creation

When a buyer subscribes on GCP Marketplace, GCP creates an entitlement for them in your producer project. Detecting and retrieving that entitlement is done through the GCP Procurement API, in your own backend, using credentials from the GCP project that published the product.
This is a call your own backend makes directly to the GCP Procurement API. Flexprice is not involved in this exchange. See Manage customer entitlements for how to detect and read a new entitlement.

Step 2: Get the Values Flexprice Needs

Registering an agreement needs four values. Two are per-buyer, from the entitlement your backend retrieved in Step 1. Two are per-product, fixed for every buyer and already known from setting up your listing.
GCP’s own docs give this example format: service name example-messaging-service.gcpmarketplace.example.com, metric name example-messaging-service/UsageInGiB. Your actual values are account-specific, GCP does not publish a fixed value, view yours in Producer Portal’s Technical integration section, see Configure usage reporting to Google.
Persist these values on your own side. Flexprice does not look them up again after registration.

Step 3: Make Sure the Buyer Exists in Flexprice

Three things must already exist in Flexprice before you can register the agreement. Flexprice does not create any of them for you.
1

A Flexprice customer for this buyer

Create one with POST /v1/customers if it does not already exist. Usage and billing are attributed to this customer.
2

The Flexprice plan for this product

The plan whose usage-based charge corresponds to the GCP product the buyer subscribed to. See Creating a Plan.
3

An active Flexprice subscription

Create it with POST /v1/subscriptions on that plan if it does not already exist. The subscription must be active: registration rejects a subscription in any other state.

Step 4: Register the Agreement

Using Flexprice Dashboard

You can link a buyer’s GCP entitlement to a Flexprice subscription directly from the Flexprice dashboard.

API Request

Endpoint: POST /api/v1/marketplace/agreements Headers:
Request Body:
gcp.metric_name is sent to GCP exactly as you provide it, with no prefix added by Flexprice. Pass the fully qualified <service_name>/<metric> form, not the bare metric name.

Response

A successful response means the mapping is recorded. Nothing else happens synchronously: usage reporting begins on its own schedule, described in Usage Reporting.

Validation Rules

Registration rejects the request if any of these do not hold:
Each entitlement maps to exactly one subscription, and a subscription cannot be re-pointed to a different entitlement. If a buyer re-subscribes and GCP issues a new entitlement, create a new Flexprice subscription for them rather than reusing the old one.

Registering Multiple Buyers on One Plan

The plan mapping stores your product-level GCP configuration, so it is created once and reused. Registering a second buyer on the same plan reuses the existing plan mapping rather than creating another one. This means service_name and metric_name are set by the first agreement registered against a plan. Later registrations for that plan do not change them.
Register every buyer for the same GCP product against the same Flexprice plan, with the same service_name and metric_name.

Next Steps

Connection Setup

Set up your GCP listing, Workload Identity Federation, and Flexprice connection.

Usage Reporting

Understand what gets metered to GCP and when.
API References