BatchMeterUsage API, keyed by the buyer’s AWS agreement.
The AWS Marketplace integration is in beta. The setup flow and API are stable enough to use, but details may change. Reach out to support before going to production.
How it works
Create your AWS Marketplace listing
Set up your product on AWS Marketplace with a single usage dimension. This is done entirely in your AWS Seller account.
Grant Flexprice permission to meter
Create a cross-account IAM role in your AWS account that Flexprice can assume to call
BatchMeterUsage on your behalf.Connect your AWS account to Flexprice
Create an
aws_marketplace connection in Flexprice with the role ARN, external ID, and region.Register each buyer's agreement
When a buyer subscribes on AWS Marketplace, resolve them on your own backend and register the agreement in Flexprice, linking it to a Flexprice subscription.
Prerequisites
Before you begin, make sure you have:- An approved AWS Marketplace seller account with permission to create products.
- A product on AWS Marketplace priced with a single usage dimension (see Step 1).
- Access to AWS IAM to create a policy and a role in your seller account.
- A Flexprice environment with the customers, plans, and subscriptions you want to meter already set up.
Step 1: Create your AWS Marketplace listing
Create your product in the AWS Marketplace Management Portal. The integration supports products priced with exactly one usage dimension.Start the product creation wizard
In the AWS Marketplace Management Portal, create a new SaaS product and complete the initial product details.
Create a single usage dimension
Add one usage dimension for your product. Note its API identifier — this is the dimension name Flexprice reports against, and it is immutable once created.
Step 2: Grant Flexprice permission to meter
Flexprice reports usage by assuming a cross-account IAM role in your AWS account. You create an IAM policy that allows theBatchMeterUsage action, then attach it to a role that trusts Flexprice’s AWS account and requires a Flexprice-provided external ID.
Create the IAM policy
In the AWS IAM console, create a policy with the following document. It grants the single permission Flexprice needs to meter usage.aws-marketplace:BatchMeterUsage is not resource-scopable in AWS’s permission model, so Resource is *. Flexprice requests no other permissions.Create the cross-account role
Create an IAM role that Flexprice can assume. Its trust policy names Flexprice’s AWS account as the principal and requires a matching external ID. Flexprice shows you the exact AWS account ID and external ID to use when you set up the connection in Step 3.Create a role for another AWS account
In the AWS IAM console, create a role of type AWS account → Another AWS account, and enter the AWS account ID Flexprice shows you.
Require an external ID
Select Require external ID and paste the external ID Flexprice shows you (for example,
flexprice-mp-6c3571d4-4c86-4902-a296-638103f96a60). Leave Require MFA unchecked.Review the trust relationship
Confirm the role’s trust policy matches the following. Replace the account ID and external ID with the values Flexprice gave you.
Step 3: Connect your AWS account to Flexprice
Create anaws_marketplace connection in Flexprice with the role ARN from Step 2, the external ID, and the AWS region your product is listed in.
Using the Flexprice dashboard
Create the connection from the Flexprice dashboard under Integrations → AWS Marketplace.Using the API
Endpoint:POST /api/v1/connections
Headers:
| Field | Description |
|---|---|
role_arn | The ARN of the cross-account role you created in Step 2 |
external_id | The external ID Flexprice provided, matching the role’s trust policy |
region | The AWS region your product is listed in (for example, us-east-1) |
region is stored on the connection and selects the AWS Marketplace Metering endpoint Flexprice reports to.
Step 4: Register marketplace agreements
When a buyer subscribes to your product on AWS Marketplace, AWS redirects them to your application with a registration token. On your own backend, resolve the buyer with the AWSResolveCustomer API to get their LicenseArn, CustomerAWSAccountId, and ProductCode. Create a Flexprice subscription for the buyer, then register the agreement in Flexprice to link the AWS identifiers to that subscription.
Endpoint: POST /api/v1/marketplace/agreements
Headers:
| Field | Description |
|---|---|
subscription_id | The Flexprice subscription that tracks this buyer’s usage. Must already exist and be active |
customer_id | The Flexprice customer for this buyer |
customer_aws_account_id | The buyer’s AWS account ID, from ResolveCustomer |
license_arn | The AWS agreement’s license ARN, from ResolveCustomer |
plan_id | The Flexprice plan the subscription is on |
product_code | Your AWS product code, from ResolveCustomer |
concurrent_agreements | Whether your product is enrolled in AWS Concurrent Agreements (see note below) |
dimension | The API identifier of your product’s single usage dimension |
Set
concurrent_agreements to true for products enrolled in AWS Concurrent Agreements. For these products, Flexprice reports usage using the LicenseArn and omits the ProductCode, as required by AWS. Set it to false for legacy products, where Flexprice includes the ProductCode.What Flexprice meters to AWS
Once a connection and agreements are in place, Flexprice reports usage automatically. No further action is needed.- Usage is computed on a schedule. Flexprice periodically computes each mapped subscription’s usage for the elapsed window, using the same commitment- and overage-aware computation as your Flexprice invoices, and stores it as a usage record.
- Usage is reported through
BatchMeterUsage. On a separate schedule, Flexprice reports each usage record to AWS. The billable amount Flexprice computes is sent as the quantity, against your product’s single dimension, timestamped to the end of the window. - Reporting is safe to retry. Each usage record is reported with a fixed timestamp, so AWS de-duplicates a repeated report and never double-bills. A record AWS does not accept stays unreported and is retried on the next run.

