Testing and integration
AWS Marketplace Metering Implementation: BatchMeterUsage, Duplicate Billing, and Missed Submissions
Published: Updated:
Key takeaways
In AWS Marketplace metering, your SaaS sends each hour's usage with BatchMeterUsage, and AWS bills from those records. A quantity you have sent cannot be corrected, and if you resend a different quantity, the first one is billed. To prevent duplicate billing and missed submissions, finalize the quantity before sending, check the result of every record in the response, send the final usage within the one hour after a contract ends, and keep your own record of what you sent so that you can reconcile it. Before launch, check quantity finalization, retries, LicenseArn, the delivery deadline and month-end boundary, and contract start and end, split between local tests and your Limited product.
Editorial information. This article was translated into English by AI from Deshima’s Japanese article; it has not been reviewed or certified by AWS. Among the AWS pages linked in this article, the BatchMeterUsage, UsageRecord, and GetEntitlements API references, and AWS’s pages on metering configuration, SaaS contract pricing, SaaS event management with Amazon EventBridge, the list of Amazon EventBridge events, Amazon SNS notifications for SaaS products, SaaS Subscription integration, onboarding customers to your SaaS product, SaaS product code examples, and the Daily Usage data feed, as well as the specification of AWS’s metering agent skill (SKILL.md), were current as of November 15, 2026. AWS’s pages on SaaS subscription pricing, SaaS product settings, and creating an initial SaaS product page were current as of November 16, 2026. AWS’s Partner Revenue Measurement guide was current as of October 29, 2026. The other AWS documentation and announcements were current as of October 5, 2026. Scope: sellers listing a new SaaS product that includes usage-based pricing (SaaS Subscription and SaaS Contract with Consumption). This article is published by Anti-Pattern Inc., the provider of Deshima; the ledger design, retry policy, and proposed tests are our own recommendations, not AWS guidance.
When you list a usage-based SaaS product on AWS Marketplace, metering tends to be scoped as “a job that calls BatchMeterUsage every hour.” The call itself really is about that simple. The trouble is that a quantity you have sent cannot be corrected.
Suppose, for example, that an aggregation job sends one hour’s usage before it is final. You can resend the final value later, but the quantity that is billed is the first one. (Configuring metering for usage) Duplicate billing and quantity mismatches come not only from how you call the API but also from how you decide the quantity and when you send it.
Pricing models that need metering, and how billing works
Two pricing models require you to send usage. With SaaS Subscription (a pay-as-you-go pricing model that bills by hourly usage), all billing is based on the usage your SaaS sends. With SaaS Contract with Consumption (a SaaS contract with usage-based pricing, which bills usage beyond the contract’s quantities in addition to the contract price), you send only the usage beyond the contracted quantity. (Configuring metering for usage) With a SaaS Contract product (a pricing model in which the contract period and the entitlements the buyer purchases are fixed in advance and billed up front or on a payment schedule), your SaaS does not send usage; it checks what the buyer purchased with the entitlement-checking API. (SaaS contract pricing) For a comparison of the models, see our article on AWS Marketplace SaaS pricing models.
On its SaaS subscription pricing page, AWS requires you to meter and report everything you bill for, hour by hour. AWS can bill only when it receives a record from the seller, and the seller is responsible for the records being sent and received correctly. (SaaS subscription pricing) A missed submission becomes usage that cannot be billed.
The unit you send is the pricing dimension you defined when you created the product. A dimension’s API name and unit cannot be changed after creation. (SaaS product settings) For design considerations on what to count as one unit, see our article What are AWS Marketplace pricing dimensions?
What to pass to BatchMeterUsage in a new integration
BatchMeterUsage is the API through which your SaaS sends per-buyer usage records to AWS Marketplace. One request carries one product’s records, at most 25 records, and the request must be smaller than 1 MB. (BatchMeterUsage API) For the whole integration, including registration, entitlement checks, and contract notifications, see our article What an AWS Marketplace SaaS integration requires.
AWS calls the mechanism that lets a buyer in one AWS account hold several contracts at the same time Concurrent Agreements. A new SaaS product created on or after June 1, 2026 must support it, and you identify the buyer with CustomerAWSAccountId and the contract with LicenseArn. In an integration for a new product, you cannot use CustomerIdentifier, and you do not pass ProductCode at the request level. This is because LicenseArn identifies both the product and the individual contract. (BatchMeterUsage API) In this article, we call this way of sending records, with CustomerAWSAccountId and LicenseArn, the “new method,” and the way earlier products send them, with CustomerIdentifier and ProductCode, the “old method.”
CustomerAWSAccountId and LicenseArn are returned in the ResolveCustomer response when the buyer arrives at your registration page. (SaaS product code examples) Save them there, together with the ProductCode in the same response. AWS asks you to persist these values for future calls. (SaaS Subscription integration) You do not pass ProductCode in a new-method BatchMeterUsage request, but it is a required parameter of the entitlement check (GetEntitlements). (GetEntitlements)
A record contains the following fields. (UsageRecord)
| Field | Content |
|---|---|
| Timestamp | The time (UTC) at which the usage occurred, not the time you sent it |
| CustomerAWSAccountId | The buyer’s AWS account ID |
| LicenseArn | The identifier of the individual contract (license) |
| Dimension | The API name of the dimension you defined when you created the product |
| Quantity | An integer from 0 to 2147483647. AWS’s API reference marks it as deprecated, and it cannot be specified in the same record as QuantityAsDecimal. If you omit both, it is 0 |
| QuantityAsDecimal | A string representing a quantity that may include decimals (for example, 17.42), with at most 10 integer digits and 6 decimal digits. AWS says to use this instead of Quantity; send fractional usage with it |
| UsageAllocations | Optional. A breakdown by tag. The allocation quantities must add up to the record’s quantity and use the same type as the record (integer or decimal) |
If even one record breaks a condition that AWS lists as a check, such as specifying both Quantity and QuantityAsDecimal in a record or using an allocation quantity whose type does not match the record, the whole BatchMeterUsage request fails and no record is processed. (UsageRecord) The UsageRecord page does not let us tell whether a value that breaks the quantity format (digit limits), such as one with seven or more decimal digits, is treated the same way, or which exception is returned. Check this with your Limited product. A Limited product is a product whose product details and delivery configuration are complete and that is visible only to some AWS accounts for testing. A Limited product can be viewed by the AWS account that created it and by AWS accounts you add to the allowlist. (Creating an initial SaaS product page, SaaS product settings) In its testing procedure for SaaS Subscription integration, AWS tells you to subscribe to the product with an allowed account and check the post-purchase flow. (SaaS Subscription integration)
In Timestamp, put the time for which you report the usage. You can send records going back 24 hours, but make sure the time is not earlier than the start of use. (UsageRecord) We at Anti-Pattern Inc., the provider of Deshima, recommend setting the Timestamp of each hourly record to the start of that hour (03:00 for hour 3). If you use the time you sent the record, hour-3 usage becomes a record for hour 4, and the unit of deduplication shifts too.
Only for the first hour of a contract that starts partway through an hour, use a value at or after the contract’s start time instead of the start of the hour. As the contract’s start time, we recommend using the time at which your SaaS enabled use of that contract after receiving the License Updated event. AWS requires that you do not enable use of the product until you receive this event, so no usage for that contract occurs before this time. (Onboarding customers to your SaaS product through AWS Marketplace) For a contract whose use you enabled at 10:30, the Timestamp of the record for the 10:00 hour is 10:30 or later, not 10:00. The UsageRecord API reference does not let us tell whether its “start of the software usage” is the same as this time, or which result an earlier Timestamp returns. Check this with the contract start and end cases in the section “Tests before launch.”
AWS’s pages describe differently how far back you can go. The UsageRecord and BatchMeterUsage API references say 24 hours, but a comment in AWS’s SaaS product code examples says that AWS Marketplace can only accept records for up to an hour in the past. (AWS’s SaaS product code examples) The specification of AWS’s metering agent skill (SKILL.md) gives the Timestamp window as 24 hours. We recommend designing to the 24-hour deadline in the API references while keeping each hourly submission to the previous hour. Check whether a record that is more than one hour late is accepted with the delivery deadline and month-end boundary cases in the section “Tests before launch.”
Adding a response check to AWS’s code example gives the following call. This code shows the shape of the response check. Before you use it, verify its behavior with your Limited product.
import boto3
client = boto3.client("meteringmarketplace")
def send(records):
# records: at most 25. Do not include ProductCode in the request
response = client.batch_meter_usage(UsageRecords=records)
# Per-record result (Success / CustomerNotSubscribed / DuplicateRecord)
for result in response["Results"]:
print(result["Status"], result.get("MeteringRecordId"))
# Records not processed because of a service-side error. Resend with the same content
return response["UnprocessedRecords"]
For products that support Concurrent Agreements, metering works per contract. Even if one buyer has several active contracts, usage is tracked per contract and billed separately. (Configuring metering for usage) Your SaaS also needs a mechanism that decides which contract a given usage counts toward. For mapping contracts to tenants, see our article How do you map AWS Marketplace agreements to SaaS tenants?; for the overall picture of the new requirements, see our article What are AWS Marketplace Concurrent Agreements?
Finalize an hour’s quantity before sending it
So when should you finalize the quantity? AWS’s deduplication and correction rules constrain the answer.
For products that support Concurrent Agreements (new products), the unit of deduplication is the combination of license, buyer, hour, and dimension. For products that do not, it is the combination of product, buyer, hour, and dimension. (Configuring metering for usage) Whether or not a product supports Concurrent Agreements, if you resend with a different quantity for the same combination, the first quantity is billed. For duplicate detection, 17, 17.0, and 17.00 are compared by value and treated as the same quantity. (Configuring metering for usage) Records for the same combination sent in separate requests are not added together. (Configuring metering for usage) A reported quantity cannot be corrected even if it is 0, so AWS recommends reporting the previous full hour. (Configuring metering for usage)
AWS’s seller guide and API reference describe the deduplication unit differently. The seller guide’s metering page includes the license in the unit for products that support Concurrent Agreements. The UsageRecordResult API reference describes DuplicateRecord as a record with the same customer, dimension, and time but a different quantity, and it does not include the license. We recommend including LicenseArn in the unique key of your submission ledger. If you send records for the same hour to two licenses of one buyer and one of them returns DuplicateRecord, ask AWS Marketplace Seller Operations, AWS’s support team for sellers (contact them through the support page in AWS Partner Central; AWS’s metering page calls it the AWS Marketplace Operations team).
You need to decide when to close an hour, allowing for usage events that arrive late. In AWS’s log-analysis example, a job runs at 10 minutes past each hour, reads the previous hour’s usage, builds a batch, and sends it. (Configuring metering for usage) Set the closing time by how late your own events can arrive. If you delay too long, you lose margin against the 24-hour submission deadline.
For quantities, also decide how to handle fractional units and hours with no usage.
- Fractional quantities: fractions such as a number of GB can be sent with QuantityAsDecimal (if you use Deshima, only whole numbers are accepted; see the section “Where to check before you start implementing”). Decide the number of decimal places your ledger keeps (AWS accepts at most six) and, if you convert to whole numbers, the rounding rule (up, down, or to nearest), to match your price list
- Hours with no usage: sending a record with quantity 0 every hour is strongly recommended. (SaaS Subscription integration)
A record of 0 is useful on your side too. Always create a record for every hour, including the 0 records. A missing record for an hour is itself the sign of a missed submission.
How duplicate billing and quantity mismatches happen
Requests with identical content are deduplicated, so resending them unchanged does not bill twice. (BatchMeterUsage API) Billing goes wrong through other paths.
Migrating from the old method to the new one is one of them. If you send records for the same customer and the same hour under both ProductCode and LicenseArn, the customer is double-billed. When you migrate, stop sending with ProductCode before you start sending with LicenseArn. (BatchMeterUsage API) According to AWS’s migration guide, requests under both methods run at the same time during the migration. The limit of reporting the same usage once per hour (AWS’s migration guide calls it the one-time-per-hour rate limit) is applied to each method separately, so you could unintentionally report the same hour twice. We understand this limit to be not a cap on how many times you can call the API, but the deduplication that treats records for the same hour as duplicates (see the section “Finalize an hour’s quantity before sending it”). AWS’s SaaS Subscription integration page says that metering requests are de-duplicated on the hour, but it does not show that this is the same thing as the limit in the migration guide. Existing products are not migrated automatically; they move to the new method only after the seller applies to opt in. (Concurrent Agreements migration guide on the AWS Marketplace blog)
Resending with a changed quantity also throws billing off. It does not double-bill, but the quantity AWS holds and your quantity diverge. A record for the same customer, dimension, and time with a different quantity comes back in the response with the DuplicateRecord status and is not adopted. (UsageRecordResult) Because the API cannot correct it, if the first submission was wrong, that quantity is the basis for billing.
Recomputing a quantity also creates mismatches. If your implementation reruns the aggregation on every retry, the resent quantity changes from the first submission by the amount of any late-arriving events. Our recommended countermeasure is simple. Finalize each hour’s quantity once, and use the finalized value as is in every later resend. Because the same record has the same content however many times you send it, you keep the benefit of AWS’s idempotent resends.
How missed submissions happen
Missed submissions come from both AWS’s acceptance conditions and your own sending process.
One of AWS’s acceptance conditions is the submission deadline. Records for usage that occurred 24 hours or more ago are not accepted. We recommend counting these 24 hours from the record’s Timestamp (the start of that hour). For an hour-3 record, the deadline is 03:00 the next day, not 24 hours after 04:00, when hour 3 ends. At the end of a billing month there is a six-hour grace period: records for the previous month are accepted until 06:00 UTC on the first day of the next month. After 06:00 UTC, previous-month records are rejected even if the usage occurred within the last 24 hours. For example, usage in the 23:00 hour at the end of the month has a deadline of 06:00 UTC, seven hours after 23:00. After the deadline, you get a TimestampOutOfBoundsException error. (BatchMeterUsage API) Moreover, if even one record is out of range, the whole batch is not processed. You need a step that checks the age of each record before sending and removes expired records from the batch.
On its metering page, AWS also says that for a subscribed buyer you can send Timestamps up to 24 hours in the past. (Configuring metering for usage) The design shown in the later section “How hour-3 usage gets sent” (send hour 3 at 04:10 and retry from 04:15) also fits within this deadline.
Records are also not accepted when the buyer has no active contract. CustomerNotSubscribed is returned when the identifier is invalid, the buyer has no active contract, or the account is suspended. AWS’s UsageRecordResult API reference describes this on the assumption of the old buyer identifier (CustomerIdentifier), and says that subsequent records for that buyer keep failing until a subscription is established. (UsageRecordResult) Because metering runs per contract for products that support Concurrent Agreements, we recommend stopping only the submissions for the LicenseArn that returned the error and continuing to send for the buyer’s other active licenses. The API reference description does not let us tell whether a submission under a different LicenseArn of the same buyer is accepted, so test this with your Limited product before launch.
For a new product, the trigger to start sending usage records is receiving the License Updated event from Amazon EventBridge. According to AWS’s page on registering buyers with a SaaS product, the buyer’s account is ready to accept metering at the moment you receive this event, and records sent earlier are not counted. On the same page, AWS also asks you not to enable use of the product until you receive License Updated. (Onboarding customers to your SaaS product through AWS Marketplace) You cannot send the first record right after identifying the buyer with ResolveCustomer.
The official detail-type of each event this article covers has a suffix, “ - Manufacturer” or “ - Proposer” (for example, License Updated - Manufacturer). According to AWS’s page, events are sent to your default event bus, and when you sell directly you are both manufacturer and proposer, so you receive only the proposer event for Purchase Agreement Created, Amended, and Ended. License Updated and License Deprovisioned are sent to the manufacturer only. Purchase Agreement Free Trial Converted, which tells you a free trial has converted to a paid subscription, is also sent to the manufacturer only. As the seller’s response to this event, AWS lists sending any remaining metering records for usage during the free trial. (SaaS event management with Amazon EventBridge) In this article, we write event names without the suffix.
In your own sending process, overlooking the response leads to missed submissions. When a call succeeds you get HTTP 200, but the result for each record is in the response’s Results. Results contains both the records that were adopted and the records that were invalid. (BatchMeterUsage API) Even for a call that ends without an exception, you cannot tell whether each record was adopted unless you check Results.
A stopped sending job also causes misses. If you do not send usage every hour, a failure makes records fall further behind. If the failure is repaired after the contract period has ended, unreported usage may remain. (Configuring metering for usage) As a safeguard, decide how old an unsent record may get before you raise an alert, working backward from the 24-hour deadline. A good rule of thumb is to alert at half the deadline (12 hours). For previous-month usage at the end of a month, measure from the time remaining until 06:00 UTC, not 24 hours. For a contract whose termination notification you have received, measure the unsent usage from the time remaining until the one-hour grace period ends, not 24 hours.
Reading the response and the retry policy
Implement per-response retry handling by using the “What we recommend” column of the following table as a guide. AWS specifies the action in its API reference for only four cases: retrying UnprocessedRecords, retrying InternalServiceErrorException, resending after fixing invalid records, and resending after removing out-of-range records. The other actions are our proposals. (BatchMeterUsage API, UsageRecordResult)
| Response | What AWS says | What we recommend |
|---|---|---|
| Success | The record was adopted | Mark the ledger row sent and keep the MeteringRecordId |
| DuplicateRecord | A record with a different quantity for the same customer, dimension, and time exists already | Do not resend. Investigate the difference from the ledger quantity |
| CustomerNotSubscribed | Invalid identifier, no active contract, or suspended account | Stop sending only the LicenseArn that returned the error and check that contract’s state. Keep sending the buyer’s other active licenses |
| UnprocessedRecords | Not processed because of a service-side error. Can be retried with the same content | Resend with the same content, after a delay |
| TimestampOutOfBoundsException | One out-of-range record leaves the whole batch unprocessed | Drop the out-of-range records and resend the rest, and keep the dropped records in the ledger as expired |
| InvalidLicenseException | Invalid LicenseArn, mismatch with the buyer, or outside the validity period | Investigate and fix the LicenseArn and so on. Once you identify the offending record, keep only that record for investigation in the ledger (if it cannot be fixed, mark it rejected) and resend the rest with the finalized quantities |
| InvalidUsageDimensionException, InvalidUsageAllocationsException, InvalidTagException | The dimension name does not match the product, the allocations do not add up to the quantity or their quantity type does not match the record, or a tag is invalid or there are more than five | Fix the dimension name, tags, or allocations, then resend |
| ThrottlingException, InternalServiceErrorException | The call was throttled, or an internal error occurred (AWS advises retrying internal errors) | Resend the same content after a delay; investigate if it persists |
Keep the quantity unchanged on retry for any record whose outcome you do not know: no response, UnprocessedRecords, ThrottlingException, InternalServiceErrorException, and records from a batch that failed because of a wrong LicenseArn or dimension.
When AWS says the whole request is not processed, no quantity was accepted first. This applies to a batch with an out-of-range Timestamp and to a request containing a record that breaks a condition the UsageRecord page lists as a check (specifying both Quantity and QuantityAsDecimal, or an allocation quantity whose type does not match the record). We cannot tell whether a record that breaks the digit limits, such as one with seven or more decimal digits, is treated the same way. If you correct the format of a record, the corrected value becomes the new finalized quantity, and you do not change it on later retries. (BatchMeterUsage API, UsageRecord)
When a whole request fails, do not make the correct records wait for the faulty one. If the 24-hour deadline (06:00 UTC for previous-month usage at month-end) passes while they wait, those records can no longer be billed either. Once your own checks identify the offending record, keep only that record for investigation in the ledger and resend the rest with their finalized quantities. AWS says identical requests are idempotent and can be retried with the same or a subset of the records, so resending records that were already processed does not bill them twice. (BatchMeterUsage API) If you cannot identify the record, we recommend sending the records one at a time to find the one that returns an exception.
The final submission when a contract ends
After a buyer ends a contract, you can send the last usage for one hour only. After the hour passes, the entitlement is fully revoked, BatchMeterUsage rejects usage, and that usage cannot be billed. (SaaS event management with Amazon EventBridge) This hour is a separate constraint from the 24-hour deadline for regular records. After a contract ends, a record is not accepted once the hour has passed, even if the usage occurred within the last 24 hours.
AWS’s pages describe differently which notification starts the hour, and they do not let us settle on one starting point. We recommend finishing the final submission within one hour of the earliest termination notification you receive. In this article, we call that earliest termination notification the “termination event.” The following table lets you compare what each page says.
| AWS page | How it describes the start of the hour |
|---|---|
| SaaS event management with Amazon EventBridge | One hour from the License Deprovisioned event |
| SaaS subscription pricing | One hour from the point you receive the purchase agreement ended event (Purchase Agreement Ended). License Deprovisioned arrives after that hour |
| Creating a SaaS free trial offer | In its description of metering during a free trial: if a buyer cancels, one hour from the License Deprovisioned - Manufacturer event |
| Configuring metering for usage | One hour from the Amazon Simple Notification Service (Amazon SNS) unsubscribe-pending notification |
| SaaS contract pricing | One hour from the entitlement-updated notification (a notification that an entitlement has changed) that arrives when a contract expires |
| Concurrent Agreements migration guide on the AWS Marketplace blog | Describes the one-hour window for both Purchase Agreement Ended and License Deprovisioned |
| Specification of AWS’s metering agent skill (SKILL.md) | A specification for SaaS Subscription, in which License Deprovisioned opens a final submission window of about one hour. Purchase Agreement Ended does not trigger the final submission |
Amazon SNS notifications are not available if you registered your seller account after July 15, 2026; in that case you receive events through Amazon EventBridge. (Amazon SNS notifications for SaaS products) Ask AWS Marketplace Seller Operations which notification starts the hour, and in particular whether a notification that an entitlement has expired counts. Also confirm the order and timing of the notifications you actually receive by ending a contract with your Limited product.
For products that support Concurrent Agreements, the hour is counted per contract, not per product. If one of several contracts is cancelled, submissions for the others can continue. (Configuring metering for usage)
When a notification that also arrives for contract changes counts as a termination notification
A notification that also arrives for contract changes, such as License Updated or the Amazon SNS entitlement-updated, does not count as a termination notification just because you received it. Whether it counts depends on the pricing model.
For SaaS Contract and SaaS Contract with Consumption, as AWS’s SaaS contract pricing page says, the entitlement-updated notification arrives when a contract expires, and the entitlement check (GetEntitlements) returns an empty response. For these two pricing models only, we recommend counting a notification that also arrives for contract changes as a termination notification only when the entitlement check shows that the contract has ended, and counting the hour from the time you received it. The termination event includes a notification whose end was established this way. A SaaS Contract product does not send usage, so this check serves only to decide when to stop use of the contract. The final submission applies to SaaS Contract with Consumption products.
For the entitlement check, specify the ProductCode, filter by that contract’s LicenseArn (the filter key is LICENSE_ARN), and read through until there is no NextToken before you decide whether any valid entitlement remains. Besides an empty response, we recommend treating the contract as ended when none of the returned entitlements is valid (the product (ProductCode) differs, or the expiration date (ExpirationDate) has passed). What AWS’s SaaS contract pricing page describes as the response at expiry is an empty response. AWS’s SaaS product code examples mark filtering by the buyer’s AWS account ID (CUSTOMER_AWS_ACCOUNT_ID) as the preferred option, and list LICENSE_ARN as the way to get the entitlements for that license. (AWS’s SaaS product code examples) Using LICENSE_ARN to decide that a contract has ended is our recommendation. If you query by AWS account, the entitlements of another contract on the same account are returned, and you miss the end of the contract that ended. The API reference says that NextToken might still be present when the result contains an empty set of entitlements, and that it should then be used, so deciding that a contract has ended from an empty first page stops use and metering for a contract that is still valid. (GetEntitlements)
SaaS Subscription does not use entitlement checks (AWS’s SaaS Subscription integration page), so a notification that also arrives for contract changes does not count as a termination notification.
When a contract ends partway through an hour
A contract can also end partway through an hour. If you receive the termination event at 14:20, the one-hour grace period runs until 15:20. However, AWS describes the grace hour as a period for collecting and reporting unreported usage. (SaaS event management with Amazon EventBridge) On the other hand, InvalidLicenseException in BatchMeterUsage requires the usage to fall within the license’s validity period. (BatchMeterUsage API) These two pages do not let us tell whether usage that newly arises after termination can be billed during the grace hour. Measure this using the method described next, or ask AWS Marketplace Seller Operations.
Our proposal is to treat 14:20, when you received the termination event, as the end of the entitlement, and to finalize and send the 14:00 hour’s usage with the quantity up to that point. Records for the same buyer, dimension, and hour cannot be added to later, so you cannot send the usage from 14:20 to 14:59 for the same 14:00 hour as an addition. If you send a different quantity, you get DuplicateRecord. On its SaaS subscription pricing page, AWS leaves it to the seller to decide how to stop use. (SaaS subscription pricing) Decide in advance how to handle usage that arises after finalization.
We recommend stopping the contract’s use and metering when you receive the termination event. Because metering and use stop together, no usage that cannot be billed arises after finalization. With automatic renewals, however, AWS’s pages do not let us tell whether Purchase Agreement Ended for the old contract arrives separately from the renewed contract. If you also stop on a termination caused by a renewal, use and metering stop for a contract that is still valid after the renewal. According to AWS’s page listing Amazon EventBridge events, an automatic renewal creates a new contract, and the Purchase Agreement Created event for that contract (with intent RENEW) carries the ID of the contract before renewal in previousAgreementId. (Amazon EventBridge events) We recommend saving the relationship between the contract IDs before and after renewal each time you receive this event, and, when the contract ID of a Purchase Agreement Ended is saved as a contract ID before renewal, treating it as a termination caused by a renewal and not stopping use and metering solely because you received this event. For SaaS Contract and SaaS Contract with Consumption, even for a termination caused by a renewal, stop them if the entitlement check returns no valid entitlement. If you have not yet received the matching Purchase Agreement Created when you receive Purchase Agreement Ended, you cannot tell whether it is a renewal. In that case, treat the contract as ended for now, and recompute the state from your records when the matching event arrives. What a termination caused by a renewal leaves running is use and metering only. We recommend sending the unsent usage for the contract period before renewal within one hour of receiving Purchase Agreement Ended, with the LicenseArn from before the renewal, for renewals too. For how the LicenseArn from before the renewal becomes ended when a different LicenseArn is mapped to the renewed contract, and for the procedure that recomputes the state, see our articles Handling cancellations and refunds on AWS Marketplace and How do you map AWS Marketplace agreements to SaaS tenants?
If you keep serving the buyer during the grace hour, the pages SaaS event management with Amazon EventBridge and the BatchMeterUsage API reference do not let us tell which Timestamp you can attach to usage that arises after termination so that it is accepted and appears on the bill. Do not adopt this approach until you have measured it. To measure it, send a record that includes a time after termination with your Limited product, and record whether it is accepted, whether it is rejected with InvalidLicenseException, and whether it appears on the bill.
When you receive the termination event, send that contract’s unsent usage ahead of the regular job. For the cancellation and refund procedures and for controlling access in your SaaS, see our article Handling cancellations and refunds on AWS Marketplace.
Keep your own record of what you send
The ways you can check what you sent from the AWS side, hour by hour, are limited. The Daily Usage data feed is updated every 24 hours, and usage is aggregated by day. The date column (usage_date) has no time of day, and the usage column (usage_quantity) has up to two decimal places. agreement_id may be empty or may not match the billing line items. end_user_account_id and payer_account_id are hashes with a per-seller salt, not the AWS account IDs themselves. (Daily Usage data feed) With AWS CloudTrail, you can check the content of the API calls you sent. (Configuring metering for usage) The side that can keep hourly quantities and response results in a form that is easy to reconcile is the one that sent them.
So we recommend building a submission ledger in your own database. Make each row unique by LicenseArn, buyer, hour, and dimension, to match the deduplication unit shown on AWS’s metering page.
| Column | Content |
|---|---|
| license_arn, account_id, dimension, hour_utc | The unique key. Matches AWS’s deduplication unit |
| usage_timestamp | The time put in the record’s Timestamp. Normally the same value as hour_utc; only for the first hour of a contract that starts partway through an hour is it a value at or after the contract’s start time. Use the same value on retries |
| quantity | The finalized quantity. Not updated after finalization. When you correct the format of a record whose whole request was rejected before AWS accepted anything, the corrected value becomes the new finalized quantity, and you keep the reason. Correcting a LicenseArn fixes the unique key; it does not change the quantity |
| status | Pending, sent, rejected, or expired. We recommend adding under investigation for rows that you investigate instead of sending automatically |
| metering_record_id | The MeteringRecordId received in a Success response |
| attempts, last_error, sent_at | The number of retries, the latest error, and the time of sending |
With this ledger, you can run the following checks.
- Detecting missing hours: for each pair of an active contract and a dimension, check that there is a row for every hour up to the latest. Because records of 0 also become rows, a missing row directly shows a miss
- Detecting backlogs: raise a notification when a pending row exceeds the age you set. At month-end, before 06:00 UTC on the first day of the next month, check whether any previous-month records remain unsent. For a contract whose termination notification you have received, measure from the time remaining until the one-hour grace period ends
- Daily reconciliation: total the ledger quantities by day, dimension, and product, and compare them with the date (usage_date), dimension (dimension_key), product (product_id), and usage (usage_quantity) in the Daily Usage data feed. Because ledger rows are kept by LicenseArn, to total by product you need the mapping from LicenseArn to product, either as a ledger column or from your contract records. The feed updates daily, so compare days up to the day before. The feed’s page does not say which time zone defines the day in usage_date. Before you total hour_utc by day and compare, check on a day that shows a difference whether the feed’s day matches the UTC day. The ledger can hold up to six decimal places, but the feed’s usage has up to two. An exact comparison turns fractions into differences, so round the ledger totals to the feed’s precision before comparing, and treat differences that are only fractions separately from larger ones. Decide the tolerance for fractions yourself. To reconcile per buyer, you need to join with the Account feed, because the feed’s buyer columns are hashed
For reconciling per buyer, how to read a difference, and how this differs from sales and billing, see our article AWS Marketplace sales and usage reports.
Tests before launch
Before launch, AWS Marketplace Seller Operations checks that your SaaS can send metering records. Usually that means a mock registration and a check that records arrive. (Configuring metering for usage) AWS’s procedure has you test by purchasing your product with your own account, and this purchase incurs real charges. To keep the purchase charge low, you can temporarily lower the price; if you do, replace the test pricing in your Public Offer with the price buyers will pay before you publish. (SaaS Subscription integration) The Testing and integrations step in AWS Partner Central also includes a task to create a $0 Private Offer to your own account; for how to use it, see our article What Does “Testing and integrations” in AWS Partner Central Verify?
What AWS Marketplace Seller Operations checks is whether records arrive. Test the duplicate-billing and missed-submission paths described so far yourself, as additional tests.
Split where you check between local tests and your Limited product. A local test feeds synthetic input and an injected clock to an SDK mock or a local emulator of the AWS API (a tool that imitates AWS’s APIs on your machine). It verifies your own code’s decisions, such as a finalized quantity staying the same across retries or a pre-send check stopping a wrong record. A local pass does not show how AWS handles a record. Buy your Limited product and send real records to see that. Those records appear on the buyer’s invoice, so use small quantities. (Onboarding customers to your SaaS product through AWS Marketplace) Do not treat a local pass as evidence that AWS accepted a record. For how to record the two separately, see our article What still needs a real AWS environment in AWS Marketplace integrations.
In the tables below, the expected results mix what AWS specifies with our design proposals. Where AWS’s pages do not describe the behavior, the expected result is to record what comes back, and the place to check is your Limited product.
Quantity finalization
These cases check the failure of sending an unfinalized quantity and the failure of a quantity changing after it is finalized.
| Action | Expected result | Where to check |
|---|---|---|
| Run the closing job before the hour ends | The row for that hour is not set to pending and is not sent | Local test |
| Close an hour with no usage | A row with quantity 0 is created and sent, and the response is Success | Local test and Limited product |
| Deliver a usage event for the hour after closing it | The ledger quantity does not change, and the late amount is recorded separately | Local test |
| Close an hour with fractional usage, such as a number of GB | The ledger holds it in the format of the rule you chose. If you send QuantityAsDecimal, it is not in the same record as Quantity and is a string with at most six decimal places | Local test and Limited product |
Retries
These cases check that the quantity you send is the same as in the first submission.
| Action | Expected result | Where to check |
|---|---|---|
| A batch containing one offending record (for example, a wrong LicenseArn) fails | Only the offending record is kept for investigation, and the rest are resent with their finalized quantities | Local test |
| Send the same record twice (assume you never received the first response) | The ledger quantity and row count do not change. Record the second response’s Status and MeteringRecordId | Local test and Limited product |
| Receive a response containing UnprocessedRecords | Only the unprocessed records are resent, with the same quantities | Local test |
| Usage arrives after finalization, just before a retry | The quantity you resend remains the finalized value, with no recalculation | Local test |
| Send records with the same customer, dimension, and time but different quantities | The first quantity is the basis for billing. Record whether the response is DuplicateRecord. Your code does not resend and treats the difference from the ledger quantity as something to investigate | Limited product (classifying the response is a local test) |
LicenseArn
These cases check, for a buyer with several contracts, that usage is sent without mixing up contracts.
| Action | Expected result | Where to check |
|---|---|---|
| Send usage for the same hour and dimension under licenses A and B of the same buyer | A’s quantity goes under A’s LicenseArn and B’s under B’s, with no summing. Record whether both are Success (AWS’s pages describe the deduplication unit differently) | Local test and Limited product |
| Run tenant B’s usage with license A’s LicenseArn through the pre-send check | It stops before sending | Local test |
| In a new integration, put ProductCode in the request and CustomerIdentifier in a record | It stops before sending | Local test |
| In a product migrating from ProductCode to LicenseArn, send records under both methods for the same customer and hour | No path sends under both methods for the same hour (it would double-bill) | Local test |
| One LicenseArn returns CustomerNotSubscribed | Sending stops for that LicenseArn only, and records for the buyer’s other LicenseArn values keep being sent. Record whether AWS accepts the other records | Local test and Limited product |
Delivery deadline and month-end boundary
These cases give the test a clock so that you can create the moments just before and just after each boundary.
| Action | Expected result | Where to check |
|---|---|---|
| Send a batch mixing records within 24 hours of usage and records past 24 hours | Only the expired records are dropped and the rest are sent; the dropped records stay in the ledger as expired | Local test |
| Resend an hour-3 record after 04:15 with its Timestamp still 03:00 | Accepted if within 24 hours | Limited product |
| Send an hour-23 record for November 30 with the clock at 05:59 UTC and at 06:00 UTC on December 1 | Send at 05:59; from 06:00, do not send and treat as expired. The deadline is not 23:00 on December 1, 24 hours later | Local test |
| Create records for the last hour of a month (23:00) and the first hour of the next month (00:00) across the month boundary | The deadline and ledger row are determined by the month each Timestamp belongs to | Local test |
| Let unsent rows age to the age you set | A notification is raised. At month-end, measure the remaining time to 06:00 UTC on the first day of the next month, not 24 hours; for a contract whose termination notification you received, measure the time remaining until the one-hour grace period ends | Local test |
| Send a record exactly 24 hours after usage and a record with a future time | The BatchMeterUsage page says records 24 hours or more after the event are not accepted, and the UsageRecord page says you can send up to 24 hours in the past. Neither page addresses a future time. Record what comes back. Until you have checked, do not send either | Limited product |
| Send a previous-month record after 06:00 UTC on the first day of the month | AWS’s description is TimestampOutOfBoundsException. Record what comes back. You can check this only just after the month changes, so set the date in advance | Limited product |
Contract start and end
These cases check the order of notifications and the boundaries of the period in which records are accepted.
| Action | Expected result | Where to check |
|---|---|---|
| Run the sending job before and just after receiving License Updated | Nothing is sent before it, and a record sent just after is counted | Local test and Limited product |
| For a contract that starts partway through an hour (10:30), send one record with Timestamp 10:00 (the start of that hour) and one with 10:30 | The 10:30 record is not rejected as a Timestamp before the start. Record the result returned for the 10:00 record (the UsageRecord API reference does not let us tell which time the start of use refers to). Whatever the result, the implementation sends a value at or after the start time | Limited product |
| End a contract | Record the order and times at which Purchase Agreement Ended and License Deprovisioned arrive, and whether BatchMeterUsage accepts at each point | Limited product |
| For a SaaS Contract or SaaS Contract with Consumption contract that expires, receive a notification that also arrives for contract changes (such as License Updated), and the entitlement check, filtered by that contract’s LicenseArn and read until there is no NextToken, returns no valid entitlement (an empty response, or a response with only expired entitlements) | The unsent usage is sent within one hour of receiving that notification. A response in which only the first page is empty and later pages still hold entitlements does not stop use and metering. A response that returns another contract’s entitlements because the check was made by AWS account is not used to decide that the contract has ended | Local test |
| For a SaaS Subscription contract, input a notification that also arrives for contract changes (such as License Updated) | The entitlement check is not called, the notification is not counted as the starting point of termination, and use and metering do not stop | Local test |
| Receive the termination event (the earliest termination notification received). Also prepare an input for a termination caused by a renewal | For a termination that is not a renewal, the contract’s use and metering stop and the final usage up to the end is sent. Submissions for other contracts continue. For a renewal, the use and metering of the contract that stays valid after renewal do not stay stopped, and the unsent usage for the contract period before renewal is sent within one hour of receiving Purchase Agreement Ended, with the LicenseArn from before the renewal. Follow our refund and cancellation article for the details | Local test |
| Only if you keep serving the buyer during the grace hour, send a record whose time is after the termination | Record whether it is accepted or rejected with InvalidLicenseException, including whether it reaches billing | Limited product |
These tests correspond to R11 to R14 in our regression test matrix for AWS Marketplace SaaS integrations (retries, UnprocessedRecords, DuplicateRecord, and the month-end deadline) and R06 for multiple contracts. When you rerun them after each change, record the preconditions, input, expected result, and actual result in the same matrix. The classification of responses, resend batches, deadline checks, and pre-send checks can be run in a sample that does not connect to AWS. For the sample and how to investigate when you find records that are not accepted, see our article How to investigate usage that AWS Marketplace does not accept.
For the items checked in the review as a whole, see our article What AWS Marketplace checks in the SaaS review.
Where AWS’s official metering assistant AI fits
On September 30, 2026, AWS announced an agent skill for metering (aws-marketplace-metering) for building and validating the metering integration of pay-as-you-go (PAYG) SaaS, that is, SaaS Subscription. Through the AWS MCP Server, you can use it from AI coding assistants that support the Model Context Protocol (MCP), such as Amazon Q Developer and Kiro. It asks about your product type, pricing model, and dimensions, proposes suitable APIs, and generates code and an AWS CloudFormation stack that use ResolveCustomer, BatchMeterUsage, and Amazon EventBridge. It checks your dimensions against the product settings and verifies the integration’s behavior with an actual test. It also supports Concurrent Agreements, and helps existing sellers inspect and debug their metering records. (AWS announcement of September 30, 2026) The announcement targets PAYG SaaS, and the agent skill’s specification (SKILL.md) also states that SaaS Contract and SaaS Contract with Consumption are out of scope.
On its metering page too, AWS points to this agent skill and cautions you to review the generated code before production, because metering errors affect billing. (Configuring metering for usage) Rereading the generated code from three angles makes missing steps easier to find: the time at which an hour’s quantity is finalized, the submission ledger, and the final submission when a contract ends. For a comparison with Deshima, see our article What can AWS’s official metering assistant AI do?
How hour-3 usage gets sent
Usage for the 03:00 UTC hour is sent in this order.
| Time (UTC) | Processing |
|---|---|
| 03:00 to 03:59 | Usage events accumulate |
| 04:10 | Close hour 3. Finalize the quantity for each license and dimension, and write it to the ledger as pending with Timestamp 03:00 (0 if there is no usage) |
| 04:10 | Send to BatchMeterUsage 25 records at a time, and reflect the Results in the ledger |
| 04:15 and later | Resend UnprocessedRecords and transient errors with the ledger quantity unchanged |
| On a termination event | When you receive the earliest of Purchase Agreement Ended, License Deprovisioned, unsubscribe-pending (for products that also use Amazon SNS), and, for SaaS Contract and SaaS Contract with Consumption, a notification after which the entitlement check shows the contract has ended, stop that contract’s use and metering, finalize usage up to the end, and send the unsent usage first (for a termination caused by a renewal, do not stop use and metering; send only the unsent usage for the contract period before renewal) |
| Next day onward | Reconcile the ledger against the Daily Usage data feed |
The failure raised at the start, sending a quantity before it is final, does not occur in this flow. The quantity is decided once, when you finalize it at 04:10, and it does not change on later resends. A late-arriving event also cannot rewrite the quantity afterward.
However, what this prevents is quantity mismatches and duplicate billing. Usage that arrives after the close is not added together if you resend it in the same time slot, and if you change the quantity you get DuplicateRecord, so it remains as unbilled usage. Record this usage separately and investigate it; do not handle it by overwriting a quantity that has already been sent. AWS’s metering page does not describe a procedure for billing, later, usage that arrived after the close. (Configuring metering for usage) That page also does not let us tell whether you may bill it by including it in the quantity of the next hour that you have not sent yet. Decide in advance whether you absorb it as unbilled or consult AWS Marketplace Seller Operations about how to handle it, including whether it can go into the next hour.
Billing customers for usage is separate from measuring revenue contribution to AWS
BatchMeterUsage is the API for billing customers for usage. Because the names are similar it is easy to confuse, but the AWS Marketplace Metering method of Partner Revenue Measurement (PRM) is a separate mechanism. PRM measures revenue contribution based on the AWS service consumption that your product drives, and its automatic measurement covers Amazon Machine Image (AMI) products and Machine Learning (ML) products. (Getting started with Partner Revenue Measurement) In AWS’s PRM onboarding guide as of October 29, 2026, SaaS is not included in that automatic measurement. For what PRM measures, see our article What is AWS Partner Revenue Measurement (PRM)?; for the measurement method to adopt for SaaS, see our article How to implement AWS PRM.
Where to check before you start implementing
When you move on to implementing SaaS Subscription (PAYG), check the following two resources that AWS publishes. The agent skill’s specification (SKILL.md) is at aws-marketplace-metering. The PAYG integration procedure is at SaaS Subscription integration.
There is also a way to avoid running the BatchMeterUsage calls and retries yourself. As of November 11, 2026, Deshima supports SaaS products on AWS Marketplace. In addition to SaaS Contract, it supports sending usage for usage-based pricing (SaaS Subscription and the usage portion of SaaS Contract with Consumption). Channel Partner Private Offers (CPPO) are out of scope. For usage-based products, you issue an API key in the Deshima console, and your SaaS registers the usage finalized for each hour, per contract and dimension, through the Deshima API. Deshima sends the registered usage to AWS Marketplace with BatchMeterUsage. Deshima also retries records that failed to send, and you can check the submission status in the Deshima console.
In terms of the section “How hour-3 usage gets sent,” closing hour 3 and finalizing the quantity is your SaaS’s job, and sending to BatchMeterUsage and retrying are Deshima’s. The Deshima API accepts a finalized quantity for one hour; it is not an API that adds up individual usage events as they occur. As of November 15, 2026, the Deshima API accepts whole-number quantities only. Deshima sends usage to AWS with the Quantity field of BatchMeterUsage and does not use QuantityAsDecimal. If you want to bill in fractional units such as GB, we recommend defining the dimension’s unit at a granularity you can count in whole numbers (for example, MB instead of GB) and registering whole numbers. Set the unit price in your price list to match that unit. However, a dimension’s API name and unit cannot be changed after the dimension is created. (SaaS product settings) AWS’s SaaS subscription pricing page describes choosing the unit category in the product’s pricing settings, and these pages do not let you determine whether you can add, to a listed product, a dimension whose unit differs from the existing dimensions. Decide the unit before you create the dimension, and if you need a finer unit after listing, check with AWS Marketplace Seller Operations. Measuring usage, aggregating it per hour, and designing when to finalize a quantity remain your SaaS’s responsibility when you use Deshima too. Even with Deshima, usage that AWS has accepted cannot be corrected afterwards, so do not register a quantity before it is final. Specifying the hour differs in one way from calling BatchMeterUsage yourself. With the Deshima API, register the first hour of a contract that starts partway through an hour with the start of that hour (on the hour) too. Deshima adjusts the time reported to AWS so that it is at or after the contract’s start. You can register usage for past hours later, within a deadline. This deadline is set earlier than the deadline by which AWS accepts usage. Deshima uses the difference to send, and resend, the usage to AWS. You can also register a contract’s final usage with Deshima. Usage for an hour that has not finished yet normally cannot be registered. Only when Deshima has confirmed that the contract has ended can you register the usage for the partial hour up to the end. For Deshima to confirm that a contract has ended, the rules created by the seller account connection, which forward contract events to Deshima, must be active. The events that tell you a contract has ended also arrive in your own AWS account. We recommend that your SaaS also receives the termination event and registers the final usage, and the usage for any hours of that contract that you have not registered yet, right away, because AWS’s grace period is one hour and Deshima stops accepting the usage before that. When a contract ends, Deshima stops accepting that contract’s unregistered hours no later than the deadline for the final usage. An hour whose regular deadline is earlier closes at its regular deadline. For the specific deadlines, check the documentation in the product after you create an account, or ask through the contact form.
Before you start sending usage for usage-based pricing through Deshima, subscribe to Deshima on AWS Marketplace and complete the seller account connection. The seller account connection means creating a stack, from the AWS CloudFormation template that Deshima provides, in the AWS account you use for listing. Among other resources, the stack creates the AWS IAM role with which Deshima calls the AWS Marketplace APIs and the Amazon EventBridge rules that forward AWS Marketplace contract events to Deshima. If you completed the seller account connection before Deshima supported usage-based pricing, update the stack with the latest template. The permission to call BatchMeterUsage and the rule that forwards the events for the start, amendment, and end of a contract were added in the version of the template that supports usage-based pricing. Without the update, you can register usage, but it is not sent to AWS. Check the guidance in Deshima’s connection settings to see whether you need the update. You can register usage for contracts whose buyer, a buyer of your own SaaS product, completed registration through Deshima’s registration form after purchase. The registration form is the post-purchase registration page that Deshima provides, and it receives the buyer and contract information. Moving to Deshima the contracts of buyers who already registered through a registration page you built yourself is not something we currently offer as part of the supported scope. Please contact us. What you pay Deshima is Deshima’s sales-based fee, which applies only when your product sells; there is no setup fee and no monthly fee. Contact us for the rate. For how we think about pricing, see the pricing section. Separately from this, you pay AWS the listing fee, and you bear the effort of implementing and operating your own side and the cost of the AWS resources you need. Deshima is updated often, so for the latest features and scope, create a free account (currently in Japanese) and check the documentation in the product.