> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexprice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GCP Marketplace Usage Reporting

> What Flexprice meters to GCP Marketplace and when it reports

## Overview

Once a buyer's entitlement is registered, usage reporting runs automatically. You do not call Flexprice again for that buyer unless their subscription changes.

Flexprice reports usage against your product's single usage metric via the Service Control API. GCP then invoices the buyer and pays you out.

## What Flexprice Meters to GCP

The amount reported to GCP is the same billable amount that appears on that subscription's Flexprice invoice for the same period. It is computed with the same rules, so GCP bills what Flexprice bills.

That means the reported amount already accounts for:

* **Usage-based charges** across every meter on the subscription
* **Commitment amounts**, where the subscription has a committed spend
* **Overage rates**, where usage exceeds the commitment

The amount is reported in cents against your single usage metric. With the metric priced at `$0.01` per unit, GCP multiplies it back into the exact amount, down to the cent. See [Create Your GCP Marketplace Listing](/integrations/marketplace-integration/gcp/connection-setup#step-1-create-your-gcp-marketplace-listing).

<Info>
  Flexprice reports usage to GCP on a recurring schedule. Do not expect usage to appear in GCP immediately after it happens in Flexprice.
</Info>

## Retries and Failures

Reporting recovers from transient failures on its own.

* **Reports are safe to retry.** Each report carries a fixed operation ID, so a retry is an identical request and GCP de-duplicates it rather than billing twice.
* **Unaccepted reports are retried.** Service Control's API can return a `200 OK` and still reject a report; Flexprice checks for this and leaves rejected reports unreported so they are retried on the next run. No action is needed from you.
* **A rejected buyer resolves itself.** If GCP reports the entitlement is not active, reporting keeps retrying and succeeds once the buyer's entitlement is active again.

## Handling Marketplace Lifecycle Events

Flexprice does not learn about GCP-side changes to a buyer's subscription. You handle these.

| Event on GCP                               | What you must do in Flexprice                                                                                                                |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Buyer cancels or unsubscribes              | Cancel the buyer's Flexprice subscription, see [Final Usage When an Entitlement Is Cancelled](#final-usage-when-an-entitlement-is-cancelled) |
| Buyer's entitlement expires                | Cancel the buyer's Flexprice subscription                                                                                                    |
| Buyer re-subscribes with a new entitlement | Create a new Flexprice subscription and register the new entitlement                                                                         |

<Warning>
  If a buyer cancels on GCP and you leave their Flexprice subscription active, Flexprice keeps computing usage for it and attempting to report it to GCP. Cancel the Flexprice subscription to stop this.
</Warning>

To detect these events, subscribe to your product's Procurement API notifications in your own application. Flexprice does not subscribe to them.

## Final Usage When an Entitlement Is Cancelled

GCP gives a window of about **one hour** after the cancellation to submit usage for a cancelled entitlement.

<Warning>
  Use the timestamp from the Procurement API notification, not the time you process it. GCP requires the final report to end **strictly before** the cancellation it recorded, and rejects usage reported at or after that instant. Flexprice reports against `cancel_at`, so a `cancel_at` later than the real cancellation loses the final usage.
</Warning>

See [When the Marketplace Agreement Ends](/integrations/marketplace-integration/overview#when-the-marketplace-agreement-ends) for how the final usage flush works and how to cancel correctly.

## Troubleshooting

| Symptom                                                      | Likely cause                                                                                             | Fix                                                                                                                            |
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| No usage in GCP at all                                       | Agreement never registered                                                                               | Confirm registration succeeded, see [Agreement Registration](/integrations/marketplace-integration/gcp/agreement-registration) |
| Usage appears late                                           | Expected: reporting is scheduled, not real time                                                          | None                                                                                                                           |
| GCP bills the wrong amount                                   | Metric not priced at `$0.01` per unit                                                                    | Correct the metric price on your GCP product                                                                                   |
| Reports rejected with a permission error naming your service | The service name in your plan mapping does not match a real, provisioned Service Control managed service | Confirm the product's pricing has been approved and the managed service is live                                                |

## Next Steps

<CardGroup cols={2}>
  <Card icon="plug" href="/integrations/marketplace-integration/gcp/connection-setup" title="Connection Setup">
    Set up your GCP listing, Workload Identity Federation, and Flexprice connection.
  </Card>

  <Card icon="link" href="/integrations/marketplace-integration/gcp/agreement-registration" title="Agreement Registration">
    Link each buyer's GCP entitlement to a Flexprice subscription.
  </Card>
</CardGroup>
