Reading starts here
ChurnAtlas

Customer event deduplication: 3 steps for renewal feeds

Short answer. Deduplicate renewal feed events in 3 steps: check event ids against processed records, order changes by resource_version, and keep idempotency keys apart.

ChurnAtlas Editorial Team. How posts are made is set out in the editorial standards.

Published · Sources checked · 10 min read

  1. Inputs Your product plan, your permissions and the task you want to finish.
  2. Decision Whether the help page matches what you see on your screen.
  3. Next action Do the task on one test account, then record what you changed.

Check whether each incoming event was already processed before handling it again, using the event id as the unique identifier, according to Chargebee.

Key takeaways

  • Identify each incoming event by its id parameter, since that value uniquely identifies the event, according to Chargebee.
  • Check whether the event id is already processed, and skip any event that is.
  • Detect duplicates in your own application to ensure the idempotency of the webhook call.
  • Order changes with the resource_version attribute, not the event id.
  • Attach an idempotency key to each downstream request, as a separate control from the event id, according to Stripe.

Customer event deduplication: the setup sequence

When configuring renewal data feeds, the first operational step is to identify the incoming event. The Events documentation states that you can do this by examining the id parameter since its value uniquely identifies an event, according to Chargebee. This unique identifier serves as the primary reference point for tracking individual webhook deliveries. Without a reliable way to distinguish one event from another, your integration cannot determine if a specific renewal notification has already been received.

Once the event is identified, the next step is to verify its processing status. The documentation instructs you to check whether the event id is already processed, according to Chargebee. This check prevents your system from executing the same business logic twice for a single renewal occurrence. If the id exists in your processed records, the event is a duplicate. If it does not exist, the event is new and requires standard processing.

Finally, you must handle the detection logic within your own application layer. The source notes that you should detect such duplicates within your application to ensure the idempotency of the webhook call, according to Chargebee. This places the responsibility for duplicate prevention on the receiving system rather than relying solely on the sender. Your integration code must maintain a record of processed event ids and compare incoming payloads against this record.

For the feed side of this setup, see Customer data sync: 4 steps for account activity feeds.

Identify the incoming event and check whether it was processed

Start by examining the id parameter of the incoming webhook payload. This identification step is the foundation for your duplicate detection logic. You must verify whether the specific event id has already been processed by your system before executing any further business logic. The documentation advises checking whether the event id is already processed to prevent redundant actions.

Implement this check within your application code. This means your integration must maintain a record of processed event id s. When a new event arrives, compare its id against your stored records. If a match is found, skip the processing of that event. If no match is found, proceed with the standard handling routine and record the id for future reference.

This approach separates the identity of the event from the state of your local database. The id serves as the unique key for the incoming signal. Your application is responsible for the comparison logic. Do not rely on external systems to filter duplicates before they reach your webhook endpoint. The responsibility for idempotency lies with the receiving application. By explicitly checking the id against processed records, you create a deterministic guard against repeated execution.

Consider the timing of this check. This minimizes the risk of side effects from duplicate events. If your system crashes after processing an event but before recording the id, the duplicate check will fail on retry. To mitigate this, ensure that recording the id is part of the same transaction as the event processing, or use a mechanism that guarantees atomicity.

Order resource changes using the resource version

Event IDs identify duplicates, but they do not establish the chronological sequence of resource modifications. To manage the order of incoming changes, examine the resource_version attribute attached to the resource sent by the webhook. According to Chargebee, you can order the events by examining the resource_version attribute of the resource sent by the webhook. This attribute provides a distinct mechanism for sequencing data that operates independently from the event identification logic used to detect repeats.

According to Chargebee, for every change made to the resource, resource_version is updated with a new timestamp in milliseconds. This millisecond precision allows you to distinguish between rapid successive updates to the same customer or subscription record. When a renewal feed processes multiple updates to a single account, comparing these timestamps reveals the exact order in which the changes occurred.

Do not rely on the event ID to determine which change happened first. The event ID serves a different purpose: it allows your application to detect if a specific event has already been processed. The resource_version serves the purpose of ordering. When you receive a webhook payload, extract the resource_version value and compare it against the version currently stored in your database for that resource. If the incoming version is older than the stored version, the data is stale and should not overwrite your current records. If the incoming version is newer, apply the changes to reflect the most recent state of the resource.

Illustrative example: one renewal event delivered twice

Suppose the same renewal event arrives twice. The first delivery is processed and its id is stored. The second delivery carries the same id, so the handler skips it. An update with a resource_version of 9 arriving after a stored version of 10 is not applied, because the stored version is newer. These values are illustrative only.

Key downstream requests and interpret retry responses

Attach an IdempotencyKey element to your request options to perform an idempotent request, according to Stripe. This key allows you to safely repeat a request after a connection error without the risk of creating a second object or performing the update twice, according to Stripe. When you send a repeated request, the idempotency layer compares the incoming parameters to those of the original request and errors if they are not the same to prevent accidental misuse, according to Stripe.

Interpret retry responses carefully because not every failure saves an idempotent result. If incoming parameters fail validation, or the request conflicts with another request that is executing concurrently, the system does not save the idempotent result because no API endpoint initiates the execution, according to Stripe. For retry errors, see CS integration errors: 9 mistakes in request retries.

For email-based renewal notifications, Resend enforces specific key constraints. A 400: invalid_idempotency_key error indicates the idempotency key has to be between 1–256 characters, according to Resend. If you receive a 409: invalid_idempotent_request error, it means this idempotency key has already been used on a request that had a different payload, according to Resend. Distinguish between these two error types: a 400 error requires you to adjust the key length, while a 409 error requires you to use a new key for the modified payload.

Publisher Idempotency Mechanism Key Constraint or Limit
Stripe Compares incoming parameters to the original request Errors if parameters are not the same
Stripe Does not save result on validation failure No API endpoint initiates execution
Stripe Does not save result on concurrent conflict No API endpoint initiates execution
Resend Validates key length on submission Key must be 1–256 characters
Resend Detects payload changes on reuse Returns 409 if payload differs

Document which downstream requests use idempotency keys and note the specific error codes returned by your integration.

Publisher reference table for duplicate handling

The table below compares how four distinct platforms handle duplicate requests. Each row describes the specific mechanism documented by that publisher, ensuring you do not apply one vendor’s rule to another.

Publisher Duplicate Detection Method Retention or Validation Rule
Chargebee Detect duplicates inside the application Ensure idempotency of the webhook call
Stripe Preserve original request parameters Compare incoming parameters to the original request
Adyen Recognize previously processed payment requests Return the response to the first attempt without duplication
Resend Check for emails with the same idempotency key Check if the email was sent in the last 24 hours
Editorial Document integration-specific logic Verify field mappings for renewal feeds

If the Adyen payments platform already processed the request, the response to the first attempt will be returned without duplication, according to Adyen. This behavior applies specifically to payment requests that have already completed processing on their side.

Review your integration logs to confirm which of these mechanisms applies to your specific renewal feed setup.

Keep event IDs, resource versions and request responses on file

Document the specific identifiers and response codes for every integration point to support troubleshooting. When a renewal feed encounters a repeated event or a failed downstream call, the recorded data allows you to distinguish between a new change and a duplicate transmission.

Resend advises including an idempotency key in any email requests to ensure that the same email request is processed only once, even if it’s sent multiple times, according to Resend. This practice applies to email requests within that specific platform.

When a retry occurs, the response code indicates the system's state. A 409 status with the concurrent_idempotent_requests message means another request with the same idempotency key is in progress, according to Resend. Recording this specific response helps you understand that the system is still processing the original request rather than failing due to a missing key or a different error.

Data Type Source Purpose in Deduplication
Idempotency key Resend Ensures the same email request is processed only once
Event ID Chargebee Identifies the incoming event for duplicate detection

Store the event ID for each incoming notification to verify whether it has already been handled. While the current section focuses on request-level deduplication, the event ID serves as the primary identifier for the data payload itself. Keeping a log of processed event IDs allows your application to skip handling if the same ID appears again.

For downstream requests, record the idempotency key alongside the response code. If you receive a 409 concurrent_idempotent_requests response, note the timestamp and the key used. This record confirms that the system recognized the duplicate and is managing the concurrency, rather than silently dropping the request or creating a duplicate record.

Inspect one renewal integration and document which field identifies an incoming event, how processed events are detected and which downstream requests use idempotency keys.

Related guides: Customer record matching: 4 steps for the CS handoff · Customer usage discrepancies: 4 steps before renewal.

FAQ: repeated renewal events and downstream requests

How does customer event deduplication work during renewal feed setup?

The setup process requires checking whether the event id is already processed before handling the payload again according to Chargebee. This check prevents the application from re-executing logic for a duplicate webhook delivery.

What identifies a Chargebee event uniquely?

The id parameter uniquely identifies an event according to Chargebee. You can identify the incoming event by examining this specific parameter value.

How can Chargebee resource versions order incoming changes?

You can order the events by examining the resource_version attribute of the resource sent by the webhook according to Chargebee. This attribute allows you to sequence changes separately from the unique event identifier.

Does Resend still retain my request key after 24 hours?

Idempotency keys are kept in the system for 24 hours according to Resend. After this period, the system no longer retains the key for duplicate detection.

What happens when a Stripe retry uses different parameters?

The idempotency layer compares incoming parameters to those of the original request and errors if they’re not the same to prevent accidental misuse according to Stripe. A retry with altered parameters will trigger an error rather than a duplicate execution.

Sources

Limits of this post

This post is general operational information, not legal advice about notice periods or renewal clauses. It does not promise that any method keeps a customer. Software can get a fact wrong, so open the sources before you act.